[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-users] xen guest detection.


  • To: xen-users@xxxxxxxxxxxxxxxxxxx
  • From: "Michael Closson" <closms@xxxxxxxxx>
  • Date: Tue, 18 Mar 2008 10:46:43 -0400
  • Delivery-date: Tue, 18 Mar 2008 07:47:19 -0700
  • Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:mime-version:content-type; b=x3Qqf56+UIGtjUE2uPz8MGToPHALXfxDQYm74GqVL5Yc+jdinP3hNR2FpqO4OIFWBxfkCsg5hZOyXE9e4+f9LmmUq+6s2PtIqDKF/lS8Xc2iVclcLNPFibV773D4hLd2nsKQ+N1gXlKF6zPtfkgKyJi2bMRp4kr8pzLQM4qLLps=
  • List-id: Xen user discussion <xen-users.lists.xensource.com>

Hey All,
 
I'm working on robust way for a process to be able to detect that it is running in xen guest, and distinguish between a para-vitualized and fully-virtualized environment.
 
Here are the clues I can use:
 
#1) If I pin a process to a specific virtual cpu with sched_setaffinity() and then fetch the proccesors local apic id with the cpuid instruction, multiple calls will/may give me different ids since the xen hypervisor doesn't always map the same virtual cpu to the same physical cpu.
 
This method isn't very robust.  Say a in-guest process runs cpuid multiple times and always gets the same apic id.  Maybe there is only one processor on the host and maybe the hypervisor just keeps mapping the virtual cpu to the same physical cpu for each call.
 
#2) I noticed that in a para-virt environment, the motherboard BIOS area in physical ram (64k starting at 0xf0000) is all zeros.  But can I count on this to be the same for future versions of xen?
 
#3) Check the existence of /proc/xen and the absence of xend/the xend xmlrpc socket.  This method is a little bit error prone because paths may change (Xen installation may be redhat or xen enterprise).  Other proccesses may match "xend".  How can I distinguish the two cases: 1) baremetal + xen enabled kernel but xend is not installed  2) a real xen guest environment.
 
#4) Check if the virtual ethernet hw address is a xen address.  But I think users can just specify there own ethernet hw address.
 
 
Thoughts?
 
I'm leaning toward #2 or #3.
 
Thanks Ahead!
Mike Closson
 
_______________________________________________
Xen-users mailing list
Xen-users@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-users

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.