* [PATCH] Add find_domain_rcu_lock() and domain_rcu_unlock functions
@ 2007-02-09 19:29 Santos, Jose Renato G
2007-02-21 16:33 ` Keir Fraser
0 siblings, 1 reply; 4+ messages in thread
From: Santos, Jose Renato G @ 2007-02-09 19:29 UTC (permalink / raw)
To: Keir Fraser, xen-devel
[-- Attachment #1: Type: text/plain, Size: 476 bytes --]
Sorry,
Forgot to attach the file in previous message
Renato
> -----Original Message-----
> From: Santos, Jose Renato G
> Sent: Friday, February 09, 2007 11:28 AM
> To: Keir Fraser; xen-devel@lists.xensource.com
> Subject: [PATCH] Add find_domain_rcu_lock() and
> domain_rcu_unlock functions
>
>
> Keir,
>
> This patch adds find_domain_rcu_lock() and
> domain_rcu_unlock() functions that we have discussed before.
>
> Thanks
>
> Renato
>
>
[-- Attachment #2: find_domain_rcu.patch --]
[-- Type: application/octet-stream, Size: 2353 bytes --]
Signed-off-by: Jose Renato Santos <jsantos@hpl.hp.com>
# HG changeset patch
# User root@lsnpsvr3.hpl.hp.com
# Date 1170878467 28800
# Node ID c768b2d65ef5f8da47826c3ebe236b49acff97a9
# Parent d5d00004a11e8ce494aea869ebf3c23fd9f87e38
[XEN] add find_domain_rcu_lock() and domain_rcu_unlock()
diff -r d5d00004a11e -r c768b2d65ef5 xen/common/domain.c
--- a/xen/common/domain.c Wed Feb 07 09:48:39 2007 -0800
+++ b/xen/common/domain.c Wed Feb 07 12:01:07 2007 -0800
@@ -233,6 +233,30 @@ struct domain *get_domain_by_id(domid_t
return d;
}
+/* find_domain_rcu_lock() is more efficient than get_domain_by_id()
+ * This is the preferred function if the returned domain reference
+ * is short lived, but it cannot be used if the domain reference needs
+ * to be kept beyond the current xen invocation.
+ * It is good practice to call domain_rcu_unlock() when the returned
+ * domain reference is no longer needed.
+ */
+struct domain *find_domain_rcu_lock(domid_t dom)
+{
+ struct domain *d;
+
+ rcu_read_lock();
+ d = rcu_dereference(domain_hash[DOMAIN_HASH(dom)]);
+ while ( d != NULL )
+ {
+ if ( d->domain_id == dom )
+ return d;
+ d = rcu_dereference(d->next_in_hashbucket);
+ }
+ rcu_read_unlock();
+
+ return NULL;
+}
+
void domain_kill(struct domain *d)
{
diff -r d5d00004a11e -r c768b2d65ef5 xen/include/xen/sched.h
--- a/xen/include/xen/sched.h Wed Feb 07 09:48:39 2007 -0800
+++ b/xen/include/xen/sched.h Wed Feb 07 12:01:07 2007 -0800
@@ -278,6 +278,21 @@ int construct_dom0(
unsigned long image_start, unsigned long image_len,
unsigned long initrd_start, unsigned long initrd_len,
char *cmdline);
+
+/* find_domain_rcu_lock() is more efficient than get_domain_by_id()
+ * This is the preferred function if the returned domain reference
+ * is short lived, but it cannot be used if the domain reference needs
+ * to be kept beyond the current xen invocation.
+ * It is good practice to call domain_rcu_unlock() when the returned
+ * domain reference is no longer needed.
+ */
+struct domain *find_domain_rcu_lock(domid_t dom);
+
+/* unlock rcu reader side section locked by find_domain_rcu_lock() */
+static inline void domain_rcu_unlock(void)
+{
+ rcu_read_unlock();
+}
struct domain *get_domain_by_id(domid_t dom);
void domain_destroy(struct domain *d);
[-- 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] 4+ messages in thread
* Re: [PATCH] Add find_domain_rcu_lock() and domain_rcu_unlock functions
2007-02-09 19:29 [PATCH] Add find_domain_rcu_lock() and domain_rcu_unlock functions Santos, Jose Renato G
@ 2007-02-21 16:33 ` Keir Fraser
2007-02-21 17:53 ` Santos, Jose Renato G
0 siblings, 1 reply; 4+ messages in thread
From: Keir Fraser @ 2007-02-21 16:33 UTC (permalink / raw)
To: Santos, Jose Renato G, xen-devel
The RCU patches so far are now checked in, so you can carry on to actually
make use of find_domain_rcu_lock() now. By the way I changed some of the
function prototypes to take extra (dummy arguments) to make code more self
documenting. So you'll want to obtain latest xen-unstable once the RCU
patches have passed the regression tests and been pushed to the public tree,
and base further patches off that.
-- Keir
On 9/2/07 19:29, "Santos, Jose Renato G" <joserenato.santos@hp.com> wrote:
> Sorry,
> Forgot to attach the file in previous message
>
> Renato
>
>> -----Original Message-----
>> From: Santos, Jose Renato G
>> Sent: Friday, February 09, 2007 11:28 AM
>> To: Keir Fraser; xen-devel@lists.xensource.com
>> Subject: [PATCH] Add find_domain_rcu_lock() and
>> domain_rcu_unlock functions
>>
>>
>> Keir,
>>
>> This patch adds find_domain_rcu_lock() and
>> domain_rcu_unlock() functions that we have discussed before.
>>
>> Thanks
>>
>> Renato
>>
>>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] Add find_domain_rcu_lock() and domain_rcu_unlock functions
2007-02-21 16:33 ` Keir Fraser
@ 2007-02-21 17:53 ` Santos, Jose Renato G
0 siblings, 0 replies; 4+ messages in thread
From: Santos, Jose Renato G @ 2007-02-21 17:53 UTC (permalink / raw)
To: Keir Fraser, xen-devel
Great!
Thanks
Renato
> -----Original Message-----
> From: Keir Fraser [mailto:keir@xensource.com]
> Sent: Wednesday, February 21, 2007 8:34 AM
> To: Santos, Jose Renato G; xen-devel@lists.xensource.com
> Subject: Re: [PATCH] Add find_domain_rcu_lock() and
> domain_rcu_unlock functions
>
>
> The RCU patches so far are now checked in, so you can carry
> on to actually make use of find_domain_rcu_lock() now. By the
> way I changed some of the function prototypes to take extra
> (dummy arguments) to make code more self documenting. So
> you'll want to obtain latest xen-unstable once the RCU
> patches have passed the regression tests and been pushed to
> the public tree, and base further patches off that.
>
> -- Keir
>
> On 9/2/07 19:29, "Santos, Jose Renato G"
> <joserenato.santos@hp.com> wrote:
>
> > Sorry,
> > Forgot to attach the file in previous message
> >
> > Renato
> >
> >> -----Original Message-----
> >> From: Santos, Jose Renato G
> >> Sent: Friday, February 09, 2007 11:28 AM
> >> To: Keir Fraser; xen-devel@lists.xensource.com
> >> Subject: [PATCH] Add find_domain_rcu_lock() and domain_rcu_unlock
> >> functions
> >>
> >>
> >> Keir,
> >>
> >> This patch adds find_domain_rcu_lock() and
> >> domain_rcu_unlock() functions that we have discussed before.
> >>
> >> Thanks
> >>
> >> Renato
> >>
> >>
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] Add find_domain_rcu_lock() and domain_rcu_unlock functions
@ 2007-02-09 19:27 Santos, Jose Renato G
0 siblings, 0 replies; 4+ messages in thread
From: Santos, Jose Renato G @ 2007-02-09 19:27 UTC (permalink / raw)
To: Keir Fraser, xen-devel
Keir,
This patch adds find_domain_rcu_lock() and domain_rcu_unlock() functions
that we have discussed before.
Thanks
Renato
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-02-21 17:53 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-09 19:29 [PATCH] Add find_domain_rcu_lock() and domain_rcu_unlock functions Santos, Jose Renato G
2007-02-21 16:33 ` Keir Fraser
2007-02-21 17:53 ` Santos, Jose Renato G
-- strict thread matches above, loose matches on Subject: below --
2007-02-09 19:27 Santos, Jose Renato G
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.