All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] DOM0_GETDOMAININFO hypercall support for DOMID_SELF
@ 2005-12-17  1:39 Cihula, Joseph
  2005-12-17  2:09 ` Anthony Liguori
  0 siblings, 1 reply; 3+ messages in thread
From: Cihula, Joseph @ 2005-12-17  1:39 UTC (permalink / raw)
  To: Xen-devel

[-- Attachment #1: Type: text/plain, Size: 978 bytes --]

The attached (and following) patch allows a privileged domain to use the
DOM0_GETDOMAININFO dom0_op (and by extension, userspace apps to use
xc_domain_getinfo()) to query about themselves by specifying the domid
as DOMID_SELF.

Most importantly, this allows the domain to determine its own domid.

Signed-off-by: joseph.cihula@intel.com

diff -r 6ee4c16bfdec xen/common/dom0_ops.c
--- a/xen/common/dom0_ops.c     Fri Dec 16 17:58:21 2005
+++ b/xen/common/dom0_ops.c     Fri Dec 16 18:40:39 2005
@@ -358,12 +358,17 @@
     case DOM0_GETDOMAININFO:
     {
         struct domain *d;
+        domid_t dom;
+
+        dom = op->u.getdomaininfo.domain;
+        if ( dom == DOMID_SELF )
+            dom = current->domain->domain_id;

         read_lock(&domlist_lock);

         for_each_domain ( d )
         {
-            if ( d->domain_id >= op->u.getdomaininfo.domain )
+            if ( d->domain_id >= dom )
                 break;
         }


[-- Attachment #2: getinfo.patch --]
[-- Type: application/octet-stream, Size: 605 bytes --]

diff -r 6ee4c16bfdec xen/common/dom0_ops.c
--- a/xen/common/dom0_ops.c	Fri Dec 16 17:58:21 2005
+++ b/xen/common/dom0_ops.c	Fri Dec 16 18:40:39 2005
@@ -358,12 +358,17 @@
     case DOM0_GETDOMAININFO:
     { 
         struct domain *d;
+        domid_t dom;
+
+        dom = op->u.getdomaininfo.domain;
+        if ( dom == DOMID_SELF )
+            dom = current->domain->domain_id;
 
         read_lock(&domlist_lock);
 
         for_each_domain ( d )
         {
-            if ( d->domain_id >= op->u.getdomaininfo.domain )
+            if ( d->domain_id >= dom )
                 break;
         }
 

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xensource.com
http://lists.xensource.com/xen-devel

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

* Re: [PATCH] DOM0_GETDOMAININFO hypercall support for DOMID_SELF
  2005-12-17  1:39 [PATCH] DOM0_GETDOMAININFO hypercall support for DOMID_SELF Cihula, Joseph
@ 2005-12-17  2:09 ` Anthony Liguori
  0 siblings, 0 replies; 3+ messages in thread
From: Anthony Liguori @ 2005-12-17  2:09 UTC (permalink / raw)
  To: Cihula, Joseph; +Cc: Xen-devel

Cihula, Joseph wrote:

>The attached (and following) patch allows a privileged domain to use the
>DOM0_GETDOMAININFO dom0_op (and by extension, userspace apps to use
>xc_domain_getinfo()) to query about themselves by specifying the domid
>as DOMID_SELF.
>
>Most importantly, this allows the domain to determine its own domid.
>  
>
If you want to find out your domid (you'll have to be very careful wrt 
save/restore/migrate btw) what you can do today is:

1) Copy libxenctrl.so.3.0.0, libxenstore.so, and xenstore-read into your 
guest.
2) xenstore-read domid

This will work in any type of domain.  You can also just use libxenstore 
directly (just make sure to use xs_domain_open()).
Regards,

Anthony Liguori

>Signed-off-by: joseph.cihula@intel.com
>
>diff -r 6ee4c16bfdec xen/common/dom0_ops.c
>--- a/xen/common/dom0_ops.c     Fri Dec 16 17:58:21 2005
>+++ b/xen/common/dom0_ops.c     Fri Dec 16 18:40:39 2005
>@@ -358,12 +358,17 @@
>     case DOM0_GETDOMAININFO:
>     {
>         struct domain *d;
>+        domid_t dom;
>+
>+        dom = op->u.getdomaininfo.domain;
>+        if ( dom == DOMID_SELF )
>+            dom = current->domain->domain_id;
>
>         read_lock(&domlist_lock);
>
>         for_each_domain ( d )
>         {
>-            if ( d->domain_id >= op->u.getdomaininfo.domain )
>+            if ( d->domain_id >= dom )
>                 break;
>         }
>
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Xen-devel mailing list
>Xen-devel@lists.xensource.com
>http://lists.xensource.com/xen-devel
>  
>

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

* RE: [PATCH] DOM0_GETDOMAININFO hypercall support for DOMID_SELF
@ 2005-12-17  2:19 Cihula, Joseph
  0 siblings, 0 replies; 3+ messages in thread
From: Cihula, Joseph @ 2005-12-17  2:19 UTC (permalink / raw)
  To: Anthony Liguori; +Cc: Xen-devel

On Friday, December 16, 2005 6:09 PM,  Anthony Liguori
<mailto:aliguori@us.ibm.com> wrote:
> Cihula, Joseph wrote:
> 
>> The attached (and following) patch allows a privileged domain to use
>> the DOM0_GETDOMAININFO dom0_op (and by extension, userspace apps to
>> use xc_domain_getinfo()) to query about themselves by specifying the
>> domid as DOMID_SELF. 
>> 
>> Most importantly, this allows the domain to determine its own domid.
>> 
>> 
> If you want to find out your domid (you'll have to be very careful wrt
> save/restore/migrate btw) what you can do today is:
> 
> 1) Copy libxenctrl.so.3.0.0, libxenstore.so, and xenstore-read into
> your 
> guest.
> 2) xenstore-read domid
> 
> This will work in any type of domain.  You can also just use
> libxenstore 
> directly (just make sure to use xs_domain_open()).
> Regards,
> 
> Anthony Liguori

Good point.  I would expect xenstore to be the preferred way to get this
info.

However, my need for the domid is for dom0 disagreggation where
xenstored (which needs to know its host domain for initialization) may
not be running in dom0 (and thus can't hardcode it).

But aside from that, this just seems like it should be supported by the
interface (and its trivial to do).

Joe

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

end of thread, other threads:[~2005-12-17  2:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-17  1:39 [PATCH] DOM0_GETDOMAININFO hypercall support for DOMID_SELF Cihula, Joseph
2005-12-17  2:09 ` Anthony Liguori
  -- strict thread matches above, loose matches on Subject: below --
2005-12-17  2:19 Cihula, Joseph

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.