linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: KY Srinivasan <kys@microsoft.com>
To: "Michael S. Tsirkin" <mst@redhat.com>
Cc: "x86@kernel.org" <x86@kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"devel@linuxdriverproject.org" <devel@linuxdriverproject.org>,
	"olaf@aepfle.de" <olaf@aepfle.de>,
	"apw@canonical.com" <apw@canonical.com>,
	"jasowang@redhat.com" <jasowang@redhat.com>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"hpa@zytor.com" <hpa@zytor.com>,
	"JBeulich@suse.com" <JBeulich@suse.com>,
	"bp@alien8.de" <bp@alien8.de>
Subject: RE: [PATCH 2/3] X86: Add a check to catch Xen emulation of Hyper-V
Date: Wed, 17 Apr 2013 14:12:12 +0000	[thread overview]
Message-ID: <3b76ebfdb240419aa601309465a4c154@SN2PR03MB061.namprd03.prod.outlook.com> (raw)
In-Reply-To: <20130417124852.GD6801@redhat.com>



> -----Original Message-----
> From: Michael S. Tsirkin [mailto:mst@redhat.com]
> Sent: Wednesday, April 17, 2013 8:49 AM
> To: KY Srinivasan
> Cc: x86@kernel.org; gregkh@linuxfoundation.org; linux-kernel@vger.kernel.org;
> devel@linuxdriverproject.org; olaf@aepfle.de; apw@canonical.com;
> jasowang@redhat.com; tglx@linutronix.de; hpa@zytor.com;
> JBeulich@suse.com; bp@alien8.de
> Subject: Re: [PATCH 2/3] X86: Add a check to catch Xen emulation of Hyper-V
> 
> On Wed, Apr 17, 2013 at 01:20:58PM +0000, KY Srinivasan wrote:
> >
> >
> > > -----Original Message-----
> > > From: Michael S. Tsirkin [mailto:mst@redhat.com]
> > > Sent: Wednesday, April 17, 2013 3:06 AM
> > > To: KY Srinivasan
> > > Cc: x86@kernel.org; gregkh@linuxfoundation.org; linux-
> kernel@vger.kernel.org;
> > > devel@linuxdriverproject.org; olaf@aepfle.de; apw@canonical.com;
> > > jasowang@redhat.com; tglx@linutronix.de; hpa@zytor.com;
> > > JBeulich@suse.com; bp@alien8.de
> > > Subject: Re: [PATCH 2/3] X86: Add a check to catch Xen emulation of Hyper-V
> > >
> > > On Sun, Feb 03, 2013 at 05:22:38PM -0800, K. Y. Srinivasan wrote:
> > > > Xen emulates Hyper-V to host enlightened Windows. Looks like this
> > > > emulation may be turned on by default even for Linux guests. Check and
> > > > fail Hyper-V detection if we are on Xen.
> > > >
> > > > Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
> > >
> > > I'm very curious what's the specific bug that is fixed here?
> > > I went over the original discussion in
> > > https://patchwork.kernel.org/patch/2064331/
> > > and that's still not clear to me. Is there a configuration
> > > that is broken without this patch but starts working with
> > > this patch?
> > >
> > > It seems that one might want to use hyper-v emulation e.g. to test
> > > hyper-v code without using windows, so the functionality
> > > that this patch disables is not completely useless,
> > > so there should be a good reason for disabling it.
> > >
> > > Could you enlighten me please? :)
> >
> > Michael,
> >
> > If I recall correctly, the issue here was that Xen was enabling
> > Hyper-V emulation un-conditionally even for Linux guests.
> 
> Okay so basically some Xen specific strangeness.
> 
> > Clearly,
> > this was not the intention to begin with. This check was added to
> > ensure that while hosting Linux we would not un-intentionally enable
> > Hyper-V emulation in Xen.
> 
> What if you want to intentionally enable Hyper-V emulation in Xen?
> There's no way to do this now, right?
> 
> > Not all Hyper-V features are tagged with a
> > CPUID feature bit and so it was agreed that it would be better to
> > disable Hyper-V emulation when hosting Linux on Xen.
> >
> > Regards,
> >
> > K. Y
> 
> I was just asking whether there are any specific examples of a bug
> or is this change done just in case?

Ideally, if Hyper-V could be emulated in a plug compatible way, in that the guest would not know
the difference as to whether Hyper-V was being emulated or indeed it was Hyper-V underneath, I would agree with you.
Even in this case, I would argue that we would somehow give preference to the native implementation rather
than the emulated environment. Having done the initial emulation of Hyper-V on Xen, I know the current emulation of 
Hyper-V is restricted to emulating a few features advertised via the CPUID bits. If I recall correctly, Xen did not implement
the enlightened TLB flush scheme. Furthermore, none of the Hyper-V emulations implement the I/O related infrastructure.
For Linux to run efficiently on Hyper-V, the I/O paths are significantly more important than what Hyper-V emulation there is
in Xen and I suspect in KVM. So, I don't think we want to run Linux on Xen/KVM that is emulating Hyper-V (cpuids).
The specific case I ran into that required this patch was when I moved the VMBUS interrupts to be delivered via a special
hypervisor vector (to support full interrupt distribution amongst all VCPUs in the guest). This feature is not tagged in the CPUID
feature bits and without this check, I would install an interrupt handler for the hypervisor vector that clearly did not make
any sense in anything other than Hyper-V. I suspect there will be more such situations as we go forward.

Regards,

K. Y 
> 
> > >
> > > > ---
> > > >  arch/x86/kernel/cpu/mshyperv.c |    7 +++++++
> > > >  1 files changed, 7 insertions(+), 0 deletions(-)
> > > >
> > > > diff --git a/arch/x86/kernel/cpu/mshyperv.c
> > > b/arch/x86/kernel/cpu/mshyperv.c
> > > > index 646d192..4dab317 100644
> > > > --- a/arch/x86/kernel/cpu/mshyperv.c
> > > > +++ b/arch/x86/kernel/cpu/mshyperv.c
> > > > @@ -30,6 +30,13 @@ static bool __init ms_hyperv_platform(void)
> > > >  	if (!boot_cpu_has(X86_FEATURE_HYPERVISOR))
> > > >  		return false;
> > > >
> > > > +	/*
> > > > +	 * Xen emulates Hyper-V to support enlightened Windows.
> > > > +	 * Check to see first if we are on a Xen Hypervisor.
> > > > +	 */
> > > > +	if (xen_cpuid_base())
> > > > +		return false;
> > > > +
> > > >  	cpuid(HYPERV_CPUID_VENDOR_AND_MAX_FUNCTIONS,
> > > >  	      &eax, &hyp_signature[0], &hyp_signature[1], &hyp_signature[2]);
> > > >
> > > > --
> > > > 1.7.4.1
> > > >
> > > > --
> > > > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > > > the body of a message to majordomo@vger.kernel.org
> > > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > > > Please read the FAQ at  http://www.tux.org/lkml/
> > >
> >
> 



  reply	other threads:[~2013-04-17 14:12 UTC|newest]

Thread overview: 55+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-04  1:21 [PATCH 0/3] X86: Deliver Hyper-V interrupts on a seperate IDT vector K. Y. Srinivasan
2013-02-04  1:22 ` [PATCH 1/3] x86: Hyper-V: register clocksource only if its advertised K. Y. Srinivasan
2013-02-04  1:22   ` [PATCH 2/3] X86: Add a check to catch Xen emulation of Hyper-V K. Y. Srinivasan
2013-02-13  0:57     ` [tip:x86/hyperv] " tip-bot for K. Y. Srinivasan
2013-04-17  7:06     ` [PATCH 2/3] " Michael S. Tsirkin
2013-04-17  9:10       ` KVM "Hyper-V emulation" -- this can be related "Linux on Hyper-V" ? Or "KVM emulates Hyper-V" as "Hyper-V emulates Hyper-V" ? " Victor Miasnikov
2013-04-17 10:16         ` Michael S. Tsirkin
2013-04-17 12:12           ` Jan Beulich
2013-04-17 12:15             ` Michael S. Tsirkin
     [not found]             ` <CAP2xkNqGgbYz1gdS85xjA8gwROGY89fAsiaRiGSE90xnzjJ4Xw@mail.gmail.com>
2013-04-17 12:43               ` Michael S. Tsirkin
2013-04-17 14:08                 ` Victor Miasnikov
2013-04-17 13:20       ` KY Srinivasan
2013-04-17 12:48         ` Michael S. Tsirkin
2013-04-17 14:12           ` KY Srinivasan [this message]
2013-04-17 13:25             ` Michael S. Tsirkin
2013-04-17 14:34               ` KY Srinivasan
2013-04-17 13:48                 ` Michael S. Tsirkin
2013-04-17 15:31                   ` KY Srinivasan
2013-04-17 15:50                     ` Jan Beulich
2013-04-17 16:28                       ` KY Srinivasan
2013-04-18  7:48                         ` Michael S. Tsirkin
2013-04-18 13:23                           ` KY Srinivasan
2013-04-18 13:30                             ` KY Srinivasan
2013-04-17 13:52         ` Jan Beulich
2013-04-17 13:01           ` Michael S. Tsirkin
2013-04-17 13:11             ` Michael S. Tsirkin
2013-04-17 14:09             ` Jan Beulich
2013-04-17 15:17               ` H. Peter Anvin
2013-02-04  1:22   ` [PATCH 3/3] X86: Handle Hyper-V vmbus interrupts as special hypervisor interrupts K. Y. Srinivasan
2013-02-13  0:58     ` [tip:x86/hyperv] " tip-bot for K. Y. Srinivasan
2013-02-13  1:58       ` [tip:x86/hyperv] x86, hyperv: HYPERV depends on X86_LOCAL_APIC tip-bot for H. Peter Anvin
2013-02-13  2:05         ` KY Srinivasan
2013-02-13  2:56       ` [tip:x86/hyperv] X86: Handle Hyper-V vmbus interrupts as special hypervisor interrupts Yinghai Lu
2013-02-13  3:32         ` KY Srinivasan
2013-02-13  3:46           ` H. Peter Anvin
2013-02-13  3:49             ` KY Srinivasan
2013-02-13  3:54               ` H. Peter Anvin
2013-02-13  3:58                 ` KY Srinivasan
2013-02-13  4:42                   ` Yinghai Lu
2013-02-13 12:47                     ` KY Srinivasan
2013-02-13  0:56   ` [tip:x86/hyperv] x86: Hyper-V: register clocksource only if its advertised tip-bot for Olaf Hering
2013-02-05 11:16 ` [PATCH 0/3] X86: Deliver Hyper-V interrupts on a seperate IDT vector KY Srinivasan
  -- strict thread matches above, loose matches on Subject: below --
2013-01-30  0:51 K. Y. Srinivasan
2013-01-30  0:51 ` [PATCH 1/3] x86: Hyper-V: register clocksource only if its advertised K. Y. Srinivasan
2013-01-30  0:51   ` [PATCH 2/3] X86: Add a check to catch Xen emulation of Hyper-V K. Y. Srinivasan
2013-01-30  8:53     ` Jan Beulich
2013-01-30 18:12       ` KY Srinivasan
2013-01-30 18:19         ` H. Peter Anvin
2013-01-31  7:37         ` Jan Beulich
2013-01-31 14:46           ` KY Srinivasan
2013-01-31 15:53             ` KY Srinivasan
2013-01-31 16:45               ` Jan Beulich
2013-01-31 18:29                 ` H. Peter Anvin
2013-01-31 21:41       ` H. Peter Anvin
2013-02-01 13:19         ` Stefano Stabellini
2013-02-01 15:10           ` KY Srinivasan
2013-02-01 19:34             ` KY Srinivasan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3b76ebfdb240419aa601309465a4c154@SN2PR03MB061.namprd03.prod.outlook.com \
    --to=kys@microsoft.com \
    --cc=JBeulich@suse.com \
    --cc=apw@canonical.com \
    --cc=bp@alien8.de \
    --cc=devel@linuxdriverproject.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hpa@zytor.com \
    --cc=jasowang@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mst@redhat.com \
    --cc=olaf@aepfle.de \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --subject='RE: [PATCH 2/3] X86: Add a check to catch Xen emulation of Hyper-V' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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