Skip to contentSkip to conversation

x86/hyperv: Set pv_info.name to "Hyper-V"

PATCH Superseded Andrea Parri 2 participants 3 messages Oct 15, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/hyperv: Set pv_info.name to "Hyper-V"

Michael reported that the x86/hyperv initialization code printed the following dmesg when running in a VM on Hyper-V:

  [    0.000738] Booting paravirtualized kernel on bare hardware

Let the x86/hyperv initialization code set pv_info.name to "Hyper-V"; with this addition, the dmesg read:

  [    0.000138] Booting paravirtualized kernel on Hyper-V
---
 arch/x86/kernel/cpu/mshyperv.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/cpu/mshyperv.c +2 -0
index 105844d542e5..c7d1801fa88b 100644
@@ -154,6 +154,8 @@ static uint32_t  __init ms_hyperv_platform(void)
 	if (!boot_cpu_has(X86_FEATURE_HYPERVISOR))
 		return 0;
 
+	pv_info.name = "Hyper-V";
+
 	cpuid(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS,
 	      &eax, &hyp_signature[0], &hyp_signature[1], &hyp_signature[2]);
 
Signature · 1 line
2.17.1
maintainer
#1 lore raw

arch/x86/kernel/cpu/mshyperv.c static uint32_t __init ms_hyperv_platform(void)

Quoted 22 lines · Andrea Parri

Michael reported that the x86/hyperv initialization code printed the following dmesg when running in a VM on Hyper-V:

  [    0.000738] Booting paravirtualized kernel on bare hardware

Let the x86/hyperv initialization code set pv_info.name to "Hyper-V"; with this addition, the dmesg read:

  [    0.000138] Booting paravirtualized kernel on Hyper-V
---
 arch/x86/kernel/cpu/mshyperv.c | 2 ++
 1 file changed, 2 insertions(+)
arch/x86/kernel/cpu/mshyperv.c +0 -0
index 105844d542e5..c7d1801fa88b 100644
@@ -154,6 +154,8 @@ static uint32_t  __init ms_hyperv_platform(void)

This function is for platform detection only.

arch/x86/kernel/cpu/mshyperv.c static uint32_t __init ms_hyperv_platform(void) · line 158

Quoted 5 lines
arch/x86/kernel/cpu/mshyperv.c +2 -0
        if (!boot_cpu_has(X86_FEATURE_HYPERVISOR))
                return 0;
 
+       pv_info.name = "Hyper-V";
+

At this point we're not sure if Linux is really running on Hyper-V yet.

Setting pv_info.name should be moved to the init_platform hook, i.e. ms_hyperv_init_platform.

Wei.

Quoted 6 lines
arch/x86/kernel/cpu/mshyperv.c +0 -1
        cpuid(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS,
              &eax, &hyp_signature[0], &hyp_signature[1], &hyp_signature[2]);
 
--

2.17.1

#2 lore raw
Quoted 7 lines

Review static uint32_t __init ms_hyperv_platform(void)

Quoted 1 line
(quoted diff) +0 -0
@@ -154,6 +154,8 @@ static uint32_t  __init ms_hyperv_platform(void)

This function is for platform detection only.

Quoted 3 lines
arch/x86/kernel/cpu/mshyperv.c +0 -0
        if (!boot_cpu_has(X86_FEATURE_HYPERVISOR))
                return 0;
 
Quoted 7 lines

arch/x86/kernel/cpu/mshyperv.c static uint32_t __init ms_hyperv_platform(void) · line 158

Quoted 2 lines
arch/x86/kernel/cpu/mshyperv.c +2 -0
+       pv_info.name = "Hyper-V";
+

At this point we're not sure if Linux is really running on Hyper-V yet.

Setting pv_info.name should be moved to the init_platform hook, i.e. ms_hyperv_init_platform.

Thank you for the review, Wei. I'll move this to the init_platform hook and re-submit shortly.

Thanks,
Andrea