All of lore.kernel.org
 help / color / mirror / Atom feed
* determining if kernel is dom0 kernel or not.
@ 2007-07-11 18:40 jd
  2007-07-11 19:18 ` Keir Fraser
  0 siblings, 1 reply; 6+ messages in thread
From: jd @ 2007-07-11 18:40 UTC (permalink / raw)
  To: xendevel

Hi
  How do I reliably determine if the current kernel is
dom0 (xen capable) or not ? 
   
   Presence of some file in  linux /proc/xen and
solaris /dev/xen/  ?  

   Any platform independent way ? Some python API ?
Any other ways?

Thanks
/Jd


       
____________________________________________________________________________________
Yahoo! oneSearch: Finally, mobile search 
that gives answers, not web links. 
http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: determining if kernel is dom0 kernel or not.
  2007-07-11 18:40 determining if kernel is dom0 kernel or not jd
@ 2007-07-11 19:18 ` Keir Fraser
  2007-07-11 20:38   ` Ian Campbell
  0 siblings, 1 reply; 6+ messages in thread
From: Keir Fraser @ 2007-07-11 19:18 UTC (permalink / raw)
  To: jd, xendevel

If you are looking for running on Xen versus not on Xen (rather than dom0
versus domU), and you are interested in x86 only, then the program in
tools/misc/xen-detect.c is along the lines of what you want (and can be cut
down to size if you just want e.g., a non-zero return code if running on
Xen).

If you want to detect dom0 specifically then that's trickier --
/proc/xen/privcmd for example exists even in a domU, if the kernel is
dom0-capable. You'd have to be root and then try a privileged hypercall. :-)

 -- Keir

On 11/7/07 19:40, "jd" <jdsw2002@yahoo.com> wrote:

> Hi
>   How do I reliably determine if the current kernel is
> dom0 (xen capable) or not ?
>    
>    Presence of some file in  linux /proc/xen and
> solaris /dev/xen/  ?
> 
>    Any platform independent way ? Some python API ?
> Any other ways?
> 
> Thanks
> /Jd
> 
> 
>        
> ______________________________________________________________________________
> ______
> Yahoo! oneSearch: Finally, mobile search
> that gives answers, not web links.
> http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: determining if kernel is dom0 kernel or not.
  2007-07-11 19:18 ` Keir Fraser
@ 2007-07-11 20:38   ` Ian Campbell
  2007-07-11 21:39     ` Keir Fraser
  0 siblings, 1 reply; 6+ messages in thread
From: Ian Campbell @ 2007-07-11 20:38 UTC (permalink / raw)
  To: Keir Fraser; +Cc: xendevel, jd

On Wed, 2007-07-11 at 20:18 +0100, Keir Fraser wrote:
> If you want to detect dom0 specifically then that's trickier --
> /proc/xen/privcmd for example exists even in a domU, if the kernel is
> dom0-capable. You'd have to be root and then try a privileged hypercall. :-)

Doesn't /proc/xen/capabilities contain something different on dom0 vs.
domU?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: determining if kernel is dom0 kernel or not.
  2007-07-11 20:38   ` Ian Campbell
@ 2007-07-11 21:39     ` Keir Fraser
  2007-07-11 22:04       ` jd
  0 siblings, 1 reply; 6+ messages in thread
From: Keir Fraser @ 2007-07-11 21:39 UTC (permalink / raw)
  To: Ian Campbell; +Cc: xendevel, jd

On 11/7/07 21:38, "Ian Campbell" <Ian.Campbell@XenSource.com> wrote:

> On Wed, 2007-07-11 at 20:18 +0100, Keir Fraser wrote:
>> If you want to detect dom0 specifically then that's trickier --
>> /proc/xen/privcmd for example exists even in a domU, if the kernel is
>> dom0-capable. You'd have to be root and then try a privileged hypercall. :-)
> 
> Doesn't /proc/xen/capabilities contain something different on dom0 vs.
> domU?

Oh yes, of course. It contains 'control_d' if you are dom0.

 -- Keir

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: determining if kernel is dom0 kernel or not.
  2007-07-11 21:39     ` Keir Fraser
@ 2007-07-11 22:04       ` jd
  2007-07-12 13:35         ` Mark Williamson
  0 siblings, 1 reply; 6+ messages in thread
From: jd @ 2007-07-11 22:04 UTC (permalink / raw)
  To: Keir Fraser, Ian Campbell; +Cc: xendevel, jd

Cool. This is what I was looking for. 

Optional : 
Any history behind it containing 'control_d' ? 
Control Dom ?

Thanks
/Jd
--- Keir Fraser <keir@xensource.com> wrote:

> On 11/7/07 21:38, "Ian Campbell"
> <Ian.Campbell@XenSource.com> wrote:
> 
> > On Wed, 2007-07-11 at 20:18 +0100, Keir Fraser
> wrote:
> >> If you want to detect dom0 specifically then
> that's trickier --
> >> /proc/xen/privcmd for example exists even in a
> domU, if the kernel is
> >> dom0-capable. You'd have to be root and then try
> a privileged hypercall. :-)
> > 
> > Doesn't /proc/xen/capabilities contain something
> different on dom0 vs.
> > domU?
> 
> Oh yes, of course. It contains 'control_d' if you
> are dom0.
> 
>  -- Keir
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel
> 



      ____________________________________________________________________________________
Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s user panel and lay it on us. http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: determining if kernel is dom0 kernel or not.
  2007-07-11 22:04       ` jd
@ 2007-07-12 13:35         ` Mark Williamson
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Williamson @ 2007-07-12 13:35 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Campbell, Keir Fraser, jd

> Optional :
> Any history behind it containing 'control_d' ?
> Control Dom ?

Yeah, I should think that's what it stands for ;-)

Dom0's kernel knows if it's dom0, anyhow - it has to know it's supposed to 
manage various privileged stuff.  The /proc/xen/capabilities interface is 
just a convenient way of it telling userspace (was introduced, IIRC, for 
purposes such as making init scripts do the Right Thing withoout breaking in 
all cases, rather than having to be manually set up differently for native / 
dom0 / domU).

Cheers.
Mark

> Thanks
> /Jd
>
> --- Keir Fraser <keir@xensource.com> wrote:
> > On 11/7/07 21:38, "Ian Campbell"
> >
> > <Ian.Campbell@XenSource.com> wrote:
> > > On Wed, 2007-07-11 at 20:18 +0100, Keir Fraser
> >
> > wrote:
> > >> If you want to detect dom0 specifically then
> >
> > that's trickier --
> >
> > >> /proc/xen/privcmd for example exists even in a
> >
> > domU, if the kernel is
> >
> > >> dom0-capable. You'd have to be root and then try
> >
> > a privileged hypercall. :-)
> >
> > > Doesn't /proc/xen/capabilities contain something
> >
> > different on dom0 vs.
> >
> > > domU?
> >
> > Oh yes, of course. It contains 'control_d' if you
> > are dom0.
> >
> >  -- Keir
> >
> >
> > _______________________________________________
> > Xen-devel mailing list
> > Xen-devel@lists.xensource.com
> > http://lists.xensource.com/xen-devel
>
>      
> ___________________________________________________________________________
>_________ Fussy? Opinionated? Impossible to please? Perfect.  Join Yahoo!'s
> user panel and lay it on us.
> http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
>
>
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xensource.com
> http://lists.xensource.com/xen-devel



-- 
Dave: Just a question. What use is a unicyle with no seat?  And no pedals!
Mark: To answer a question with a question: What use is a skateboard?
Dave: Skateboards have wheels.
Mark: My wheel has a wheel!

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-07-12 13:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-11 18:40 determining if kernel is dom0 kernel or not jd
2007-07-11 19:18 ` Keir Fraser
2007-07-11 20:38   ` Ian Campbell
2007-07-11 21:39     ` Keir Fraser
2007-07-11 22:04       ` jd
2007-07-12 13:35         ` Mark Williamson

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.