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

Re: [Xen-devel] [PATCH for-4.12 v2 1/8] xen/page_alloc: Move get_pg_owner()/put_pg_owner() from x86 to common code



Hi,

On 20/12/2018 22:59, Andrew Cooper wrote:
On 20/12/2018 22:53, Stefano Stabellini wrote:

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 2c6509e3a0..edb93b8ada 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -2509,6 +2510,43 @@ static __init int register_heap_trigger(void)
  }
  __initcall(register_heap_trigger);
+struct domain *get_pg_owner(domid_t domid)
+{
+    struct domain *pg_owner = NULL, *curr = current->domain;
+
+    if ( likely(domid == DOMID_SELF) )
+    {
+        pg_owner = rcu_lock_current_domain();
+        goto out;
+    }
+
+    if ( unlikely(domid == curr->domain_id) )
+    {
+        gdprintk(XENLOG_WARNING, "Cannot specify itself as foreign domain\n");
+        goto out;
+    }
+
+    switch ( domid )
+    {
+    case DOMID_IO:
+        pg_owner = rcu_lock_domain(dom_io);
+        break;

Newline.

+    case DOMID_XEN:
+        pg_owner = rcu_lock_domain(dom_xen);
+        break;

Newline.

+    default:
+        if ( (pg_owner = rcu_lock_domain_by_id(domid)) == NULL )
+        {
+            gdprintk(XENLOG_WARNING, "Unknown domain d%d\n", domid);
+            break;
+        }
+        break;

if ( (pg_owner = rcu_lock_domain_by_id(domid)) == NULL )
     gdprintk(XENLOG_WARNING, "Unknown domain d%d\n", domid);

break;

All trivial, so Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
and please fix on commit.

Thank you! I have now committed this patch.

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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