RE: Use CPUID to communicate with the hypervisor.

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Nakajima, Jun
Date: Friday, September 26, 2008 - 9:52 pm

On 9/26/2008 6:55:54 PM, H. Peter Anvin wrote:

Obviously the hypervisor implements such features, and the features available/exposed are up to the hypervisor. My point is that the kernel community can define such generic hypervisor features for Linux because the Linux kernel code needs to be modified anyway. Otherwise, each VMM vender could start changing the kernel in a random fashion. Or nothing happens...

Today each hypervisor already defines and implements such features (or API), and they would need some kind of translation layer to support such Linux hypervisor features (if defined) or they just need to write code.

Having said that,
+       if (cpu_has_hypervisor) {
+               max_cpuid_leaf = cpuid_eax(HYPERVISOR_INFO_LEAF);
+               if (max_cpuid_leaf >= HYPERVISOR_TIMING_LEAF) {
+                       tsc_khz = cpuid_eax(HYPERVISOR_TIMING_LEAF);
+                       printk(KERN_INFO
+                               "TSC frequency read from hypervisor\n");
+                       return tsc_khz;

To have more flexibility and extendability in terms of "supported/unsupported", I think we should use the bitmap first to detect the features as the native does. For example, some hypervisor does not want to implement HYPERVISOR_TIMING_LEAF, but want to implement something higher one (which could be defined in the future).


             .
Jun Nakajima | Intel Open Source Technology Center
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Use CPUID to communicate with the hypervisor., Alok Kataria, (Fri Sep 26, 4:46 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Fri Sep 26, 5:09 pm)
Re: Use CPUID to communicate with the hypervisor., Alok Kataria, (Fri Sep 26, 5:30 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Fri Sep 26, 5:32 pm)
RE: Use CPUID to communicate with the hypervisor., Nakajima, Jun, (Fri Sep 26, 5:59 pm)
Re: Use CPUID to communicate with the hypervisor., Jeremy Fitzhardinge, (Fri Sep 26, 6:02 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Fri Sep 26, 6:28 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Fri Sep 26, 6:55 pm)
Re: Use CPUID to communicate with the hypervisor., Alok Kataria, (Fri Sep 26, 8:11 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Fri Sep 26, 9:20 pm)
RE: Use CPUID to communicate with the hypervisor., Nakajima, Jun, (Fri Sep 26, 9:52 pm)
Re: Use CPUID to communicate with the hypervisor., Alok Kataria, (Fri Sep 26, 10:37 pm)
Re: Use CPUID to communicate with the hypervisor., Jeremy Fitzhardinge, (Sat Sep 27, 10:01 pm)
Re: Use CPUID to communicate with the hypervisor., Gleb Natapov, (Sun Sep 28, 11:55 pm)
Re: Use CPUID to communicate with the hypervisor., Avi Kivity, (Mon Sep 29, 12:37 am)
Re: Use CPUID to communicate with the hypervisor., Gerd Hoffmann, (Mon Sep 29, 1:24 am)
Re: Use CPUID to communicate with the hypervisor., Bernd Eckenfels, (Mon Sep 29, 2:08 am)
Re: Use CPUID to communicate with the hypervisor., Tim Deegan, (Mon Sep 29, 2:28 am)
Re: Use CPUID to communicate with the hypervisor., Gleb Natapov, (Mon Sep 29, 2:33 am)
Re: Use CPUID to communicate with the hypervisor., Avi Kivity, (Mon Sep 29, 2:44 am)
RE: Use CPUID to communicate with the hypervisor., Nakajima, Jun, (Mon Sep 29, 8:32 am)
Re: Use CPUID to communicate with the hypervisor., Alok Kataria, (Mon Sep 29, 10:55 am)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Mon Sep 29, 10:58 am)
Re: Use CPUID to communicate with the hypervisor., Gerd Hoffmann, (Mon Sep 29, 11:46 am)
Re: Use CPUID to communicate with the hypervisor., Alok Kataria, (Mon Sep 29, 12:38 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Mon Sep 29, 1:31 pm)
RE: Use CPUID to communicate with the hypervisor., Nakajima, Jun, (Mon Sep 29, 1:55 pm)
Re: Use CPUID to communicate with the hypervisor., Karel Zak, (Mon Sep 29, 1:56 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Mon Sep 29, 2:07 pm)
Re: Use CPUID to communicate with the hypervisor., Jeremy Fitzhardinge, (Mon Sep 29, 2:28 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Mon Sep 29, 2:49 pm)
Re: Use CPUID to communicate with the hypervisor., Gerd Hoffmann, (Mon Sep 29, 3:46 pm)
Re: Use CPUID to communicate with the hypervisor., Zachary Amsden, (Mon Sep 29, 4:20 pm)
Re: Use CPUID to communicate with the hypervisor., Alok Kataria, (Mon Sep 29, 5:12 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Mon Sep 29, 5:31 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Mon Sep 29, 5:33 pm)
Re: Use CPUID to communicate with the hypervisor., Alok Kataria, (Mon Sep 29, 5:33 pm)
RE: Use CPUID to communicate with the hypervisor., Nakajima, Jun, (Mon Sep 29, 5:56 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Mon Sep 29, 5:58 pm)
RE: Use CPUID to communicate with the hypervisor., Nakajima, Jun, (Mon Sep 29, 6:14 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Mon Sep 29, 7:21 pm)
RE: Use CPUID to communicate with the hypervisor., Nakajima, Jun, (Mon Sep 29, 8:14 pm)
Re: Use CPUID to communicate with the hypervisor., H. Peter Anvin, (Mon Sep 29, 8:48 pm)
Re: Use CPUID to communicate with the hypervisor., Gerd Hoffmann, (Tue Sep 30, 1:11 am)
Re: Use CPUID to communicate with the hypervisor., Avi Kivity, (Tue Sep 30, 2:16 am)
Re: Use CPUID to communicate with the hypervisor., Zachary Amsden, (Tue Sep 30, 9:42 am)
[Hypervisors] TSC frequency change, Alok Kataria, (Tue Sep 30, 9:35 pm)
Re: [Hypervisors] TSC frequency change, Gerd Hoffmann, (Wed Oct 1, 2:47 am)
Re: Use CPUID to communicate with the hypervisor., Avi Kivity, (Thu Oct 2, 4:52 am)