WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [patch] new version of find_domain_by_id() without reference

To: <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [patch] new version of find_domain_by_id() without reference count [5/6]
From: "Santos, Jose Renato G" <joserenato.santos@xxxxxx>
Date: Fri, 8 Dec 2006 22:12:18 -0600
Cc: Yoshio Turner <yoshiotu@xxxxxxxxxx>, G John Janakiraman <john@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 08 Dec 2006 20:12:46 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AccbSDeAkC/hnIUfSXusUhffLHlpuA==
Thread-topic: [patch] new version of find_domain_by_id() without reference count [5/6]
Following Keir suggestion, this is set of patches to add a new version
of find_domain_by_id() which does not increment the domain reference
counter. This reduces the overhead and can be used by any function which
does not need to keep a domain reference beyond its current invocation,
as the rcu mechanism prevents the domain from being removed under our
feet. Of course, this can only be applied after the RCU patch posted
earlier.

Beyond adding the function the patch also replaces most invocations to
find_domain_by_id() with the new function find_domain_by_id_noref().
Only a few places needed to continue using the old function as the
reference was kept beyond the function invocation.
  
I only did minor tests on x86-32. Xen and dom0 boots fine and I can
create and destroy domains. But, no more exaustive tests were done. I
carefully checked if I removed all put_domain() associated with each
modified invocation of find_domain_by_id but mistakes are always
possible. It would be good to put this to some more exhaustive tests
before pushing it to the main tree. Waiting for post 3.0.4 release is
strongly suggested.

I also decomposed the patch in multiple parts so that the mantainers of
each architecture can review changes in their subtree, test  and apply
them at their convenience.

This patch:
5/6: replace find_domain_by_id on arch/powerpc

=======================================
Signed-off-by: Jose Renato Santos <jsantos@xxxxxxxxxx>

# HG changeset patch
# User root@xxxxxxxxxxxxxxxxxxx
# Node ID d7517609b3042fe073525501beeef96a926e1d18
# Parent  d0b80c3295f3e8329e634b7322c23b4177654957
Replace find_domain_by_id() with find_domain_by_id_noref() for powerpc
arch files

diff -r d0b80c3295f3 -r d7517609b304 xen/arch/powerpc/domctl.c
--- a/xen/arch/powerpc/domctl.c Fri Dec  8 18:17:18 2006 -0800
+++ b/xen/arch/powerpc/domctl.c Fri Dec  8 18:19:22 2006 -0800
@@ -47,7 +47,7 @@ long arch_do_domctl(struct xen_domctl *d
     case XEN_DOMCTL_getmemlist:
     {
         int i;
-        struct domain *d = find_domain_by_id(domctl->domain);
+        struct domain *d = find_domain_by_id_noref(domctl->domain);
         unsigned long max_pfns = domctl->u.getmemlist.max_pfns;
         xen_pfn_t mfn;
         struct list_head *list_ent;
@@ -75,8 +75,6 @@ long arch_do_domctl(struct xen_domctl *d
 
             domctl->u.getmemlist.num_pfns = i;
             copy_to_guest(u_domctl, domctl, 1);
-            
-            put_domain(d);
         }
     }
     break;
@@ -84,11 +82,10 @@ long arch_do_domctl(struct xen_domctl *d
     {
         struct domain *d;
         ret = -ESRCH;
-        d = find_domain_by_id(domctl->domain);
+        d = find_domain_by_id_noref(domctl->domain);
         if ( d != NULL )
         {
             ret = shadow_domctl(d, &domctl->u.shadow_op, u_domctl);
-            put_domain(d);
             copy_to_guest(u_domctl, domctl, 1);
         } 
     }
@@ -99,12 +96,11 @@ long arch_do_domctl(struct xen_domctl *d
         unsigned int log = domctl->u.real_mode_area.log;
 
         ret = -ESRCH;
-        d = find_domain_by_id(domctl->domain);
+        d = find_domain_by_id_noref(domctl->domain);
         if (d != NULL) {
             ret = -EINVAL;
             if (cpu_rma_valid(log))
                 ret = allocate_rma(d, log - PAGE_SHIFT);
-            put_domain(d);
         }
     }
     break;

Attachment: find_domain_by_id_noref_5.patch
Description: find_domain_by_id_noref_5.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [patch] new version of find_domain_by_id() without reference count [5/6], Santos, Jose Renato G <=