diff mbox series

[v3,1/4] x86/cpufeatures: Add CPUID feature bit for the Bus Lock Threshold

Message ID 20241004053341.5726-2-manali.shukla@amd.com (mailing list archive)
State New
Headers show
Series Add support for the Bus Lock Threshold | expand

Commit Message

Manali Shukla Oct. 4, 2024, 5:33 a.m. UTC
Misbehaving guests can cause bus locks to degrade the performance of
the system. The Bus Lock Threshold feature can be used to address this
issue by providing capability to the hypervisor to limit guest's
ability to generate bus lock, thereby preventing system slowdown due
to performance penalities.

When the Bus Lock Threshold feature is enabled, the processor checks
the bus lock threshold count before executing the buslock and decides
whether to trigger bus lock exit or not.

The value of the bus lock threshold count '0' generates bus lock
exits, and if the value is greater than '0', the bus lock is executed
successfully and the bus lock threshold count is decremented.

Presence of the Bus Lock threshold feature is indicated via CPUID
function 0x8000000A_EDX[29].

Signed-off-by: Manali Shukla <manali.shukla@amd.com>
---
 arch/x86/include/asm/cpufeatures.h | 1 +
 1 file changed, 1 insertion(+)


base-commit: efbc6bd090f48ccf64f7a8dd5daea775821d57ec

Comments

Borislav Petkov Oct. 6, 2024, 6:26 a.m. UTC | #1
On October 4, 2024 7:33:38 AM GMT+02:00, Manali Shukla <manali.shukla@amd.com> wrote:
>Misbehaving guests can cause bus locks to degrade the performance of
>the system. The Bus Lock Threshold feature can be used to address this
>issue by providing capability to the hypervisor to limit guest's
>ability to generate bus lock, thereby preventing system slowdown due
>to performance penalities.
>
>When the Bus Lock Threshold feature is enabled, the processor checks
>the bus lock threshold count before executing the buslock and decides
>whether to trigger bus lock exit or not.
>
>The value of the bus lock threshold count '0' generates bus lock
>exits, and if the value is greater than '0', the bus lock is executed
>successfully and the bus lock threshold count is decremented.
>
>Presence of the Bus Lock threshold feature is indicated via CPUID
>function 0x8000000A_EDX[29].
>
>Signed-off-by: Manali Shukla <manali.shukla@amd.com>
>---
> arch/x86/include/asm/cpufeatures.h | 1 +
> 1 file changed, 1 insertion(+)
>
>diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
>index dd4682857c12..77fa8e743ccc 100644
>--- a/arch/x86/include/asm/cpufeatures.h
>+++ b/arch/x86/include/asm/cpufeatures.h
>@@ -382,6 +382,7 @@
> #define X86_FEATURE_V_SPEC_CTRL		(15*32+20) /* "v_spec_ctrl" Virtual SPEC_CTRL */
> #define X86_FEATURE_VNMI		(15*32+25) /* "vnmi" Virtual NMI */
> #define X86_FEATURE_SVME_ADDR_CHK	(15*32+28) /* SVME addr check */
>+#define X86_FEATURE_BUS_LOCK_THRESHOLD	(15*32+29) /* "buslock" Bus lock threshold */

Why does this feature flag need to be visible in /proc/cpuinfo?
Manali Shukla Oct. 7, 2024, 4:39 a.m. UTC | #2
On 10/6/2024 11:56 AM, Borislav Petkov wrote:
> On October 4, 2024 7:33:38 AM GMT+02:00, Manali Shukla <manali.shukla@amd.com> wrote:
>> Misbehaving guests can cause bus locks to degrade the performance of
>> the system. The Bus Lock Threshold feature can be used to address this
>> issue by providing capability to the hypervisor to limit guest's
>> ability to generate bus lock, thereby preventing system slowdown due
>> to performance penalities.
>>
>> When the Bus Lock Threshold feature is enabled, the processor checks
>> the bus lock threshold count before executing the buslock and decides
>> whether to trigger bus lock exit or not.
>>
>> The value of the bus lock threshold count '0' generates bus lock
>> exits, and if the value is greater than '0', the bus lock is executed
>> successfully and the bus lock threshold count is decremented.
>>
>> Presence of the Bus Lock threshold feature is indicated via CPUID
>> function 0x8000000A_EDX[29].
>>
>> Signed-off-by: Manali Shukla <manali.shukla@amd.com>
>> ---
>> arch/x86/include/asm/cpufeatures.h | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
>> index dd4682857c12..77fa8e743ccc 100644
>> --- a/arch/x86/include/asm/cpufeatures.h
>> +++ b/arch/x86/include/asm/cpufeatures.h
>> @@ -382,6 +382,7 @@
>> #define X86_FEATURE_V_SPEC_CTRL		(15*32+20) /* "v_spec_ctrl" Virtual SPEC_CTRL */
>> #define X86_FEATURE_VNMI		(15*32+25) /* "vnmi" Virtual NMI */
>> #define X86_FEATURE_SVME_ADDR_CHK	(15*32+28) /* SVME addr check */
>> +#define X86_FEATURE_BUS_LOCK_THRESHOLD	(15*32+29) /* "buslock" Bus lock threshold */
> 
> Why does this feature flag need to be visible in /proc/cpuinfo? 
> 
> 
This was already discussed on [v1] of the same series but never concluded.
As suggested in the discussion [v1], I have added "buslock" to be enumerated
in "/proc/cpuinfo". I really don't have any strong opinions about adding or
removing it from "/proc/cpuinfo". So, I would let maintainers decide how to
go about it.

v1: https://lore.kernel.org/kvm/76355a11-a0ba-4a28-bf51-454facfd59e5@amd.com/T/#mb225b5b5fad2c070d4fadd51a076e9a05330b6a3

-Manali
diff mbox series

Patch

diff --git a/arch/x86/include/asm/cpufeatures.h b/arch/x86/include/asm/cpufeatures.h
index dd4682857c12..77fa8e743ccc 100644
--- a/arch/x86/include/asm/cpufeatures.h
+++ b/arch/x86/include/asm/cpufeatures.h
@@ -382,6 +382,7 @@ 
 #define X86_FEATURE_V_SPEC_CTRL		(15*32+20) /* "v_spec_ctrl" Virtual SPEC_CTRL */
 #define X86_FEATURE_VNMI		(15*32+25) /* "vnmi" Virtual NMI */
 #define X86_FEATURE_SVME_ADDR_CHK	(15*32+28) /* SVME addr check */
+#define X86_FEATURE_BUS_LOCK_THRESHOLD	(15*32+29) /* "buslock" Bus lock threshold */
 
 /* Intel-defined CPU features, CPUID level 0x00000007:0 (ECX), word 16 */
 #define X86_FEATURE_AVX512VBMI		(16*32+ 1) /* "avx512vbmi" AVX512 Vector Bit Manipulation instructions*/