From: Alok Kataria <akataria@vmware.com>
To: Gerd Hoffmann <kraxel@redhat.com>
Cc: Ingo Molnar <mingo@elte.hu>, "H. Peter Anvin" <hpa@zytor.com>,
Thomas Gleixner <tglx@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>,
the arch/x86 maintainers <x86@kernel.org>,
Jeremy Fitzhardinge <jeremy@goop.org>,
"avi@redhat.com" <avi@redhat.com>,
Rusty Russell <rusty@rustcorp.com.au>,
Zach Amsden <zach@vmware.com>, Daniel Hecht <dhecht@vmware.com>,
"Jun.Nakajima@Intel.Com" <Jun.Nakajima@Intel.Com>
Subject: Re: Use CPUID to communicate with the hypervisor.
Date: Mon, 29 Sep 2008 12:38:05 -0700 [thread overview]
Message-ID: <1222717085.30247.44.camel@alok-dev1> (raw)
In-Reply-To: <48E1227B.9040809@redhat.com>
On Mon, 2008-09-29 at 11:46 -0700, Gerd Hoffmann wrote:
> Alok Kataria wrote:
> > Hi Gerd,
> >
> >> Shouldn't you check the hypervisor signature here?
> >
> > Nope the whole idea of not checking the hypervisor signature is that we
> > should keep this interface generic.
>
> Nice idea. Problem with that is that approach is that we don't have
> full control here. It probably isn't that a hard to have vmware, xen
> and kvm agree here, given vmware proposes this and for xen+kvm one can
> send patches.
Yep.
And please note that this does allow either Xen/KVM to propose a new
leaf and the rest of the hypervisor players can decide to export that
leaf or return a zero value.
> But even that you can't take for granted, see the
> discussion of the "tsc-may-change-on-migration" problem.
I may have been unclear in my first attempt to this question, let me try
again.
If the frequency of tsc changes during migration, it should be the task
of hypervisor to handle it. There could be multiple ways to solve that
problem, either the hypervisor emulates the old frequency (by whatever
way) or there are cpufreq drivers in the guest which detect changes in
frequency, and ask the hypervisor for the new frequency. The interface
still allows you to query the cpuid leaf and get the new frequency.
right ?
>
> The real big problem are other closed-source hypervisors (VirtualPC /
> Hyper-V / Parallels / ...). How can we be sure they don't define that
> leaf to something different?
How does that matter, if we are able to standardize all this then,
hypervisors which want to run a Linux guest should effectively play by
the standards over here or else they would never work properly on Linux.
What we are trying to do here is try to standardize things for Linux so
that the Linux kernel implementation for Virtualization is that much
more easier. If this goes well other closed source hypervisors too can
effectively follow these standards.
If the other closed source hypervisors define their own cpuid leafs they
will still have to make Linux kernel side changes to make use of these
new leafs. Which allows them to add to these pool of cpuid interface's
too.
>
> > Also one thing to remember is, that a hypervisor can decide to not
> > implement this level and just return "0" the kernel can then just ignore
> > that value. That's what we do currently in native_calibrate_tsc.
>
> The fudamental issue outlined above aside: Even the "ignore 0" part
> isn't in the patch right now.
Hmm, I am confused, from the patch i posted above, in
native_calibrate_tsc
+ tsc_khz = hypervisor_tsc_freq();
+ if (tsc_khz)
+ return tsc_khz;
We do ignore zero values over here.
>
> >> Right now both kvm and xen use the first one or two leafes (after info),
> >> but in incompatible ways, so for these the signature *must* be checked
> >> before using the info found there.
> >
> > Hmm that's unfortunate, but we can have exceptions for these one of
> > cases and AFAIK these are only checked in the kvm/xen code path and not
> > in any generic code as of now, right ?
>
> Yes.
>
> > btw, i could only find the semantics for 0x40000001 leaf in KVM's header
> > file but don't see Xen using that leaf, can you please point me which
> > leafs are you referring to here.
>
> pv drivers in hvm guests use that (and query very xen-specific stuff
> which wouldn't make much sense in other hypervisors). It isn't in the
> kernel source tree, look here instead:
>
> http://xenbits.xensource.com/xen-3.3-testing.hg?file/19201eebab16/unmodified_drivers/linux-2.6/platform-pci/platform-pci.c
Thanks for the pointer. This would fall in the exception too.
Thanks,
Alok
>
> cheers,
> Gerd
>
>
next prev parent reply other threads:[~2008-09-29 19:38 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-26 23:46 Use CPUID to communicate with the hypervisor Alok Kataria
2008-09-27 0:09 ` H. Peter Anvin
2008-09-27 0:30 ` Alok Kataria
2008-09-27 0:32 ` H. Peter Anvin
2008-09-27 0:59 ` Nakajima, Jun
2008-09-27 1:55 ` H. Peter Anvin
2008-09-27 4:52 ` Nakajima, Jun
2008-09-29 20:56 ` Karel Zak
2008-09-27 1:02 ` Jeremy Fitzhardinge
2008-09-27 1:28 ` H. Peter Anvin
2008-09-27 3:11 ` Alok Kataria
2008-09-27 4:20 ` H. Peter Anvin
2008-09-27 5:37 ` Alok Kataria
2008-09-28 5:01 ` Jeremy Fitzhardinge
2008-09-29 9:28 ` Tim Deegan
2008-09-29 9:44 ` Avi Kivity
2008-09-29 6:55 ` Gleb Natapov
2008-09-29 7:37 ` Avi Kivity
2008-09-29 9:08 ` Bernd Eckenfels
2008-09-29 9:33 ` Gleb Natapov
2008-09-29 15:32 ` Nakajima, Jun
2008-09-30 9:16 ` Avi Kivity
2008-09-29 8:24 ` Gerd Hoffmann
2008-09-29 17:55 ` Alok Kataria
2008-09-29 17:58 ` H. Peter Anvin
2008-09-29 18:46 ` Gerd Hoffmann
2008-09-29 19:38 ` Alok Kataria [this message]
2008-09-29 20:31 ` H. Peter Anvin
2008-09-29 20:55 ` Nakajima, Jun
2008-09-29 21:07 ` H. Peter Anvin
2008-09-29 21:28 ` Jeremy Fitzhardinge
2008-09-29 21:49 ` H. Peter Anvin
2008-09-29 23:20 ` Zachary Amsden
2008-09-30 0:33 ` H. Peter Anvin
2008-09-30 0:12 ` Alok Kataria
2008-09-30 0:31 ` H. Peter Anvin
2008-09-30 0:56 ` Nakajima, Jun
2008-09-30 0:58 ` H. Peter Anvin
2008-09-30 1:14 ` Nakajima, Jun
2008-09-30 2:21 ` H. Peter Anvin
2008-09-30 3:14 ` Nakajima, Jun
2008-09-30 3:48 ` H. Peter Anvin
2008-09-29 22:46 ` Gerd Hoffmann
2008-09-30 0:33 ` Alok Kataria
2008-09-30 8:11 ` Gerd Hoffmann
2008-09-30 16:42 ` Zachary Amsden
2008-10-02 11:52 ` Avi Kivity
2008-10-01 4:35 ` [Hypervisors] TSC frequency change Alok Kataria
2008-10-01 9:47 ` Gerd Hoffmann
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=1222717085.30247.44.camel@alok-dev1 \
--to=akataria@vmware.com \
--cc=Jun.Nakajima@Intel.Com \
--cc=avi@redhat.com \
--cc=dhecht@vmware.com \
--cc=hpa@zytor.com \
--cc=jeremy@goop.org \
--cc=kraxel@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=rusty@rustcorp.com.au \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=zach@vmware.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox