* Hypervisor detection from within a Linux VM
@ 2010-06-29 21:25 Chetan Loke
0 siblings, 0 replies; 6+ messages in thread
From: Chetan Loke @ 2010-06-29 21:25 UTC (permalink / raw)
To: Linux Kernel Mailing List, virtualization, kvm, chetanloke
Hello,
Requirement:
I have the need to support my apps(running on a Linux VM) on different
*nix hypervisors(ESX/Xen etc). I need to know on which hypervisor my
app is running. I read the CPUID usage thread -
http://thread.gmane.org/gmane.comp.emulators.kvm.devel/22643 but to be
honest in the end I looked at
http://lxr.linux.no/#linux+v2.6.34/arch/x86/kernel/cpu/vmware.c#L88
The vmware_platform() detection code is straight forward.
Current-hack:
As a quick hack we just grep lspci for VMware's pci-ids.
Solution:
I can write a bare minimal driver, check the cpu-id as VMware's
balloon driver does and then emit a proc/sysfs node. The setup
packages and the apps can then check for this node-string.I'm
currently working on ESX and I am hoping that this thin-driver will
work.
Question:
Q1)Is it possible to get this functionality as part of the stock
kernel or is that a bad idea? I suspect there could be other
users/apps who would need to know what *nix hypervisor(or a
non-virtualized environment) they are
running on?
Q2)If this is not the right approach then can someone please suggest
another approach?
Regards
Chetan Loke
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Hypervisor detection from within a Linux VM
2010-06-29 21:44 ` Anthony Liguori
@ 2010-06-29 23:41 ` Chetan Loke
2010-06-29 23:41 ` Chetan Loke
1 sibling, 0 replies; 6+ messages in thread
From: Chetan Loke @ 2010-06-29 23:41 UTC (permalink / raw)
To: Anthony Liguori; +Cc: Linux Kernel Mailing List, virtualization, kvm
On Tue, Jun 29, 2010 at 5:44 PM, Anthony Liguori <anthony@codemonkey.ws> wrote:
> On 06/29/2010 04:25 PM, Chetan Loke wrote:
> It can be done entirely in userspace. Take a look at virt-what:
>
> http://people.redhat.com/~rjones/virt-what/
>
Just posted a patch for virt-what.in which can be used as a wrapper
script. I will be using that for now.
>> Question:
>> Q1)Is it possible to get this functionality as part of the stock
>> kernel or is that a bad idea? I suspect there could be other
>> users/apps who would need to know what *nix hypervisor(or a
>> non-virtualized environment) they are
>> running on?
>
> It might be reasonable to list the hypervisor signature as a field in
> /proc/cpuinfo. There's also a /sys/hypervisor where such information could
> go.
>
I like the idea of spitting out a signature under /proc/cpuinfo
primarily because everyone is familiar with that node.
> Regards,
> Anthony Liguori
Regards
Chetan Loke
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Hypervisor detection from within a Linux VM
2010-06-29 21:44 ` Anthony Liguori
2010-06-29 23:41 ` Chetan Loke
@ 2010-06-29 23:41 ` Chetan Loke
1 sibling, 0 replies; 6+ messages in thread
From: Chetan Loke @ 2010-06-29 23:41 UTC (permalink / raw)
To: Anthony Liguori; +Cc: Linux Kernel Mailing List, kvm, virtualization
On Tue, Jun 29, 2010 at 5:44 PM, Anthony Liguori <anthony@codemonkey.ws> wrote:
> On 06/29/2010 04:25 PM, Chetan Loke wrote:
> It can be done entirely in userspace. Take a look at virt-what:
>
> http://people.redhat.com/~rjones/virt-what/
>
Just posted a patch for virt-what.in which can be used as a wrapper
script. I will be using that for now.
>> Question:
>> Q1)Is it possible to get this functionality as part of the stock
>> kernel or is that a bad idea? I suspect there could be other
>> users/apps who would need to know what *nix hypervisor(or a
>> non-virtualized environment) they are
>> running on?
>
> It might be reasonable to list the hypervisor signature as a field in
> /proc/cpuinfo. There's also a /sys/hypervisor where such information could
> go.
>
I like the idea of spitting out a signature under /proc/cpuinfo
primarily because everyone is familiar with that node.
> Regards,
> Anthony Liguori
Regards
Chetan Loke
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/virtualization
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Hypervisor detection from within a Linux VM
2010-06-29 21:25 Chetan Loke
2010-06-29 21:44 ` Anthony Liguori
@ 2010-06-29 21:44 ` Anthony Liguori
2010-06-29 23:41 ` Chetan Loke
2010-06-29 23:41 ` Chetan Loke
1 sibling, 2 replies; 6+ messages in thread
From: Anthony Liguori @ 2010-06-29 21:44 UTC (permalink / raw)
To: Chetan Loke; +Cc: Linux Kernel Mailing List, virtualization, kvm
On 06/29/2010 04:25 PM, Chetan Loke wrote:
> Hello,
>
>
> Requirement:
> I have the need to support my apps(running on a Linux VM) on different
> *nix hypervisors(ESX/Xen etc). I need to know on which hypervisor my
> app is running. I read the CPUID usage thread -
> http://thread.gmane.org/gmane.comp.emulators.kvm.devel/22643 but to be
> honest in the end I looked at
> http://lxr.linux.no/#linux+v2.6.34/arch/x86/kernel/cpu/vmware.c#L88
> The vmware_platform() detection code is straight forward.
>
> Current-hack:
> As a quick hack we just grep lspci for VMware's pci-ids.
>
> Solution:
> I can write a bare minimal driver, check the cpu-id as VMware's
> balloon driver does and then emit a proc/sysfs node. The setup
> packages and the apps can then check for this node-string.I'm
> currently working on ESX and I am hoping that this thin-driver will
> work.
>
It can be done entirely in userspace. Take a look at virt-what:
http://people.redhat.com/~rjones/virt-what/
> Question:
> Q1)Is it possible to get this functionality as part of the stock
> kernel or is that a bad idea? I suspect there could be other
> users/apps who would need to know what *nix hypervisor(or a
> non-virtualized environment) they are
> running on?
> Q2)If this is not the right approach then can someone please suggest
> another approach?
>
It might be reasonable to list the hypervisor signature as a field in
/proc/cpuinfo. There's also a /sys/hypervisor where such information
could go.
Regards,
Anthony Liguori
> Regards
> Chetan Loke
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Hypervisor detection from within a Linux VM
2010-06-29 21:25 Chetan Loke
@ 2010-06-29 21:44 ` Anthony Liguori
2010-06-29 21:44 ` Anthony Liguori
1 sibling, 0 replies; 6+ messages in thread
From: Anthony Liguori @ 2010-06-29 21:44 UTC (permalink / raw)
To: Chetan Loke; +Cc: Linux Kernel Mailing List, kvm, virtualization
On 06/29/2010 04:25 PM, Chetan Loke wrote:
> Hello,
>
>
> Requirement:
> I have the need to support my apps(running on a Linux VM) on different
> *nix hypervisors(ESX/Xen etc). I need to know on which hypervisor my
> app is running. I read the CPUID usage thread -
> http://thread.gmane.org/gmane.comp.emulators.kvm.devel/22643 but to be
> honest in the end I looked at
> http://lxr.linux.no/#linux+v2.6.34/arch/x86/kernel/cpu/vmware.c#L88
> The vmware_platform() detection code is straight forward.
>
> Current-hack:
> As a quick hack we just grep lspci for VMware's pci-ids.
>
> Solution:
> I can write a bare minimal driver, check the cpu-id as VMware's
> balloon driver does and then emit a proc/sysfs node. The setup
> packages and the apps can then check for this node-string.I'm
> currently working on ESX and I am hoping that this thin-driver will
> work.
>
It can be done entirely in userspace. Take a look at virt-what:
http://people.redhat.com/~rjones/virt-what/
> Question:
> Q1)Is it possible to get this functionality as part of the stock
> kernel or is that a bad idea? I suspect there could be other
> users/apps who would need to know what *nix hypervisor(or a
> non-virtualized environment) they are
> running on?
> Q2)If this is not the right approach then can someone please suggest
> another approach?
>
It might be reasonable to list the hypervisor signature as a field in
/proc/cpuinfo. There's also a /sys/hypervisor where such information
could go.
Regards,
Anthony Liguori
> Regards
> Chetan Loke
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Hypervisor detection from within a Linux VM
@ 2010-06-29 21:25 Chetan Loke
2010-06-29 21:44 ` Anthony Liguori
2010-06-29 21:44 ` Anthony Liguori
0 siblings, 2 replies; 6+ messages in thread
From: Chetan Loke @ 2010-06-29 21:25 UTC (permalink / raw)
To: Linux Kernel Mailing List, virtualization, kvm, chetanloke
Hello,
Requirement:
I have the need to support my apps(running on a Linux VM) on different
*nix hypervisors(ESX/Xen etc). I need to know on which hypervisor my
app is running. I read the CPUID usage thread -
http://thread.gmane.org/gmane.comp.emulators.kvm.devel/22643 but to be
honest in the end I looked at
http://lxr.linux.no/#linux+v2.6.34/arch/x86/kernel/cpu/vmware.c#L88
The vmware_platform() detection code is straight forward.
Current-hack:
As a quick hack we just grep lspci for VMware's pci-ids.
Solution:
I can write a bare minimal driver, check the cpu-id as VMware's
balloon driver does and then emit a proc/sysfs node. The setup
packages and the apps can then check for this node-string.I'm
currently working on ESX and I am hoping that this thin-driver will
work.
Question:
Q1)Is it possible to get this functionality as part of the stock
kernel or is that a bad idea? I suspect there could be other
users/apps who would need to know what *nix hypervisor(or a
non-virtualized environment) they are
running on?
Q2)If this is not the right approach then can someone please suggest
another approach?
Regards
Chetan Loke
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-06-29 23:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-29 21:25 Hypervisor detection from within a Linux VM Chetan Loke
2010-06-29 21:25 Chetan Loke
2010-06-29 21:44 ` Anthony Liguori
2010-06-29 21:44 ` Anthony Liguori
2010-06-29 23:41 ` Chetan Loke
2010-06-29 23:41 ` Chetan Loke
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.