Linux-HyperV Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] x86/hyperv: Set pv_info.name to "Hyper-V"
@ 2019-10-15  9:29 Andrea Parri
  2019-10-15  9:39 ` Wei Liu
  0 siblings, 1 reply; 3+ messages in thread
From: Andrea Parri @ 2019-10-15  9:29 UTC (permalink / raw)
  To: linux-kernel, linux-hyperv, x86
  Cc: K . Y . Srinivasan, Haiyang Zhang, Stephen Hemminger,
	Sasha Levin, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	H . Peter Anvin, Michael Kelley, Vitaly Kuznetsov, Dexuan Cui,
	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

Reported-by: Michael Kelley <mikelley@microsoft.com>
Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
---
 arch/x86/kernel/cpu/mshyperv.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 105844d542e5..c7d1801fa88b 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -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]);
 
-- 
2.17.1


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

* Re: [PATCH] x86/hyperv: Set pv_info.name to "Hyper-V"
  2019-10-15  9:29 [PATCH] x86/hyperv: Set pv_info.name to "Hyper-V" Andrea Parri
@ 2019-10-15  9:39 ` Wei Liu
  2019-10-15 10:25   ` Andrea Parri
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Liu @ 2019-10-15  9:39 UTC (permalink / raw)
  To: Andrea Parri
  Cc: Linux Kernel List, Linux on Hyper-V List, x86,
	K . Y . Srinivasan, Haiyang Zhang, Stephen Hemminger,
	Sasha Levin, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	H . Peter Anvin, Michael Kelley, Vitaly Kuznetsov, Dexuan Cui

On Tue, 15 Oct 2019 at 10:30, Andrea Parri <parri.andrea@gmail.com> wrote:
>
> 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
>
> Reported-by: Michael Kelley <mikelley@microsoft.com>
> Signed-off-by: Andrea Parri <parri.andrea@gmail.com>
> ---
>  arch/x86/kernel/cpu/mshyperv.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
> index 105844d542e5..c7d1801fa88b 100644
> --- a/arch/x86/kernel/cpu/mshyperv.c
> +++ b/arch/x86/kernel/cpu/mshyperv.c
> @@ -154,6 +154,8 @@ static uint32_t  __init ms_hyperv_platform(void)

This function is for platform detection only.

>         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.

>         cpuid(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS,
>               &eax, &hyp_signature[0], &hyp_signature[1], &hyp_signature[2]);
>
> --
> 2.17.1
>

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

* Re: [PATCH] x86/hyperv: Set pv_info.name to "Hyper-V"
  2019-10-15  9:39 ` Wei Liu
@ 2019-10-15 10:25   ` Andrea Parri
  0 siblings, 0 replies; 3+ messages in thread
From: Andrea Parri @ 2019-10-15 10:25 UTC (permalink / raw)
  To: Wei Liu
  Cc: Linux Kernel List, Linux on Hyper-V List, x86,
	K . Y . Srinivasan, Haiyang Zhang, Stephen Hemminger,
	Sasha Levin, Thomas Gleixner, Ingo Molnar, Borislav Petkov,
	H . Peter Anvin, Michael Kelley, Vitaly Kuznetsov, Dexuan Cui

> > @@ -154,6 +154,8 @@ static uint32_t  __init ms_hyperv_platform(void)
> 
> This function is for platform detection only.
> 
> >         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.

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

Thanks,
  Andrea

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

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15  9:29 [PATCH] x86/hyperv: Set pv_info.name to "Hyper-V" Andrea Parri
2019-10-15  9:39 ` Wei Liu
2019-10-15 10:25   ` Andrea Parri

Linux-HyperV Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-hyperv/0 linux-hyperv/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-hyperv linux-hyperv/ https://lore.kernel.org/linux-hyperv \
		linux-hyperv@vger.kernel.org
	public-inbox-index linux-hyperv

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-hyperv


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git