EBX of Implementation Recommendations MSR (0x40000004) indicates
recommended number of attempts to retry a spinlock failure before
notifying the hypervisor about the failures.

0xFFFFFFFF indicates never to retry.

Signed-off-by: Yi Sun <[email protected]>
Cc: "K. Y. Srinivasan" <[email protected]>
Cc: Haiyang Zhang <[email protected]>
Cc: Stephen Hemminger <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: Michael Kelley (EOSG) <[email protected]>
Cc: Juergen Gross <[email protected]>
---
 arch/x86/include/asm/mshyperv.h | 3 +++
 arch/x86/kernel/cpu/mshyperv.c  | 1 +
 2 files changed, 4 insertions(+)

diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index 0d6271c..f909365 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -11,10 +11,13 @@
 
 #define VP_INVAL       U32_MAX
 
+#define HYPERV_SPINLOCK_RETRY_NEVER    U32_MAX
+
 struct ms_hyperv_info {
        u32 features;
        u32 misc_features;
        u32 hints;
+       u32 num_spin_retry;
        u32 nested_features;
        u32 max_vp_index;
        u32 max_lp_index;
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 1c72f38..04f480a 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -222,6 +222,7 @@ static void __init ms_hyperv_init_platform(void)
        ms_hyperv.features = cpuid_eax(HYPERV_CPUID_FEATURES);
        ms_hyperv.misc_features = cpuid_edx(HYPERV_CPUID_FEATURES);
        ms_hyperv.hints    = cpuid_eax(HYPERV_CPUID_ENLIGHTMENT_INFO);
+       ms_hyperv.num_spin_retry = cpuid_ebx(HYPERV_CPUID_ENLIGHTMENT_INFO);
 
        pr_info("Hyper-V: features 0x%x, hints 0x%x\n",
                ms_hyperv.features, ms_hyperv.hints);
-- 
1.9.1

Reply via email to