mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [RFC PATCH 1/1] mshyperv: fix recognition of Hyper-V guest crash MSR's
@ 2015-07-02 10:17 Denis V. Lunev
  2015-07-02 11:22 ` Vitaly Kuznetsov
  0 siblings, 1 reply; 2+ messages in thread
From: Denis V. Lunev @ 2015-07-02 10:17 UTC (permalink / raw)
  Cc: devel, linux-kernel, virtualization, Andrey Smetanin,
	Denis V. Lunev, Nick Meier, K. Y. Srinivasan, Haiyang Zhang

From: Andrey Smetanin <asmetanin@virtuozzo.com>

Hypervisor Top Level Functional Specification v3.1/4.0 notes that cpuid
(0x40000003) EDX's 10th bit should be used to check that Hyper-V guest
crash MSR's functionality available.

This patch should fix this recognition. Currently the code checks EAX
register instead of EDX.

Signed-off-by: Andrey Smetanin <asmetanin@virtuozzo.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Nick Meier <nmeier@microsoft.com>
CC: K. Y. Srinivasan <kys@microsoft.com>
CC: Haiyang Zhang <haiyangz@microsoft.com>
---
 arch/x86/include/asm/mshyperv.h | 1 +
 arch/x86/kernel/cpu/mshyperv.c  | 1 +
 drivers/hv/vmbus_drv.c          | 4 ++--
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
index c163215..eebe433 100644
--- a/arch/x86/include/asm/mshyperv.h
+++ b/arch/x86/include/asm/mshyperv.h
@@ -7,6 +7,7 @@
 
 struct ms_hyperv_info {
 	u32 features;
+	u32 misc_features;
 	u32 hints;
 };
 
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index aad4bd8..6d172a2 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -114,6 +114,7 @@ static void __init ms_hyperv_init_platform(void)
 	 * Extract the features and hints
 	 */
 	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);
 
 	printk(KERN_INFO "HyperV: features 0x%x, hints 0x%x\n",
diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index cf20400..67af13a 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -841,7 +841,7 @@ static int vmbus_bus_init(int irq)
 	/*
 	 * Only register if the crash MSRs are available
 	 */
-	if (ms_hyperv.features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) {
+	if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) {
 		atomic_notifier_chain_register(&panic_notifier_list,
 					       &hyperv_panic_block);
 	}
@@ -1110,7 +1110,7 @@ static void __exit vmbus_exit(void)
 	hv_remove_vmbus_irq();
 	tasklet_kill(&msg_dpc);
 	vmbus_free_channels();
-	if (ms_hyperv.features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) {
+	if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) {
 		atomic_notifier_chain_unregister(&panic_notifier_list,
 						 &hyperv_panic_block);
 	}
-- 
2.1.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFC PATCH 1/1] mshyperv: fix recognition of Hyper-V guest crash MSR's
  2015-07-02 10:17 [RFC PATCH 1/1] mshyperv: fix recognition of Hyper-V guest crash MSR's Denis V. Lunev
@ 2015-07-02 11:22 ` Vitaly Kuznetsov
  0 siblings, 0 replies; 2+ messages in thread
From: Vitaly Kuznetsov @ 2015-07-02 11:22 UTC (permalink / raw)
  To: Denis V. Lunev
  Cc: Haiyang Zhang, linux-kernel, virtualization, Nick Meier,
	Andrey Smetanin, devel, K. Y. Srinivasan

"Denis V. Lunev" <den@openvz.org> writes:

> From: Andrey Smetanin <asmetanin@virtuozzo.com>
>
> Hypervisor Top Level Functional Specification v3.1/4.0 notes that cpuid
> (0x40000003) EDX's 10th bit should be used to check that Hyper-V guest
> crash MSR's functionality available.
>
> This patch should fix this recognition. Currently the code checks EAX
> register instead of EDX.
>
> Signed-off-by: Andrey Smetanin <asmetanin@virtuozzo.com>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> CC: Nick Meier <nmeier@microsoft.com>
> CC: K. Y. Srinivasan <kys@microsoft.com>
> CC: Haiyang Zhang <haiyangz@microsoft.com>

Something went wrong and I don't see K.Y. on the CC: list of your
email. Fixed now.

> ---
>  arch/x86/include/asm/mshyperv.h | 1 +
>  arch/x86/kernel/cpu/mshyperv.c  | 1 +
>  drivers/hv/vmbus_drv.c          | 4 ++--
>  3 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h
> index c163215..eebe433 100644
> --- a/arch/x86/include/asm/mshyperv.h
> +++ b/arch/x86/include/asm/mshyperv.h
> @@ -7,6 +7,7 @@
>
>  struct ms_hyperv_info {
>  	u32 features;
> +	u32 misc_features;
>  	u32 hints;
>  };
>
> diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
> index aad4bd8..6d172a2 100644
> --- a/arch/x86/kernel/cpu/mshyperv.c
> +++ b/arch/x86/kernel/cpu/mshyperv.c
> @@ -114,6 +114,7 @@ static void __init ms_hyperv_init_platform(void)
>  	 * Extract the features and hints
>  	 */
>  	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);
>
>  	printk(KERN_INFO "HyperV: features 0x%x, hints 0x%x\n",
> diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
> index cf20400..67af13a 100644
> --- a/drivers/hv/vmbus_drv.c
> +++ b/drivers/hv/vmbus_drv.c
> @@ -841,7 +841,7 @@ static int vmbus_bus_init(int irq)
>  	/*
>  	 * Only register if the crash MSRs are available
>  	 */
> -	if (ms_hyperv.features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) {
> +	if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) {
>  		atomic_notifier_chain_register(&panic_notifier_list,
>  					       &hyperv_panic_block);
>  	}
> @@ -1110,7 +1110,7 @@ static void __exit vmbus_exit(void)
>  	hv_remove_vmbus_irq();
>  	tasklet_kill(&msg_dpc);
>  	vmbus_free_channels();
> -	if (ms_hyperv.features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) {
> +	if (ms_hyperv.misc_features & HV_FEATURE_GUEST_CRASH_MSR_AVAILABLE) {
>  		atomic_notifier_chain_unregister(&panic_notifier_list,
>  						 &hyperv_panic_block);
>  	}

-- 
  Vitaly

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-02 11:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-02 10:17 [RFC PATCH 1/1] mshyperv: fix recognition of Hyper-V guest crash MSR's Denis V. Lunev
2015-07-02 11:22 ` Vitaly Kuznetsov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome