All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Sanda <ben.sanda@dornerworks.com>
To: xen-devel@lists.xenproject.org
Cc: Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <george.dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Julien Grall <julien.grall@arm.com>,
	Stefano Stabellini <stefano.stabellini@citrix.com>,
	Keir Fraser <keir@xen.org>
Subject: [PATCH V2 4/9] xentrace: Support for ARM platform
Date: Fri, 1 Apr 2016 16:33:49 -0400	[thread overview]
Message-ID: <1459542834-17522-6-git-send-email-ben.sanda@dornerworks.com> (raw)
In-Reply-To: <1459542834-17522-1-git-send-email-ben.sanda@dornerworks.com>

Moved get_pg_owner() and put_pg_owner() from the arch specific mm.c
source files into the common page_alloc.c source. This was done as
theses functions are now needed by both architectures to support
xentrace on the ARM platform. Forward declarations were added to mm.h.

One conditional compilation check was added in get_pg_owner() for the
is_pvh_domain(curr) check which is only valid to perform on X86
platforms.

Signed-off-by: Benjamin Sanda <ben.sanda@dornerworks.com>
---
 xen/common/page_alloc.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 51 insertions(+)

diff --git a/xen/common/page_alloc.c b/xen/common/page_alloc.c
index 98e30e5..8fe9c03 100644
--- a/xen/common/page_alloc.c
+++ b/xen/common/page_alloc.c
@@ -145,6 +145,7 @@
 #ifdef CONFIG_X86
 #include <asm/p2m.h>
 #include <asm/setup.h> /* for highmem_start only */
+#include <asm/paging.h>
 #else
 #define p2m_pod_offline_or_broken_hit(pg) 0
 #define p2m_pod_offline_or_broken_replace(pg) BUG_ON(pg != NULL)
@@ -1996,6 +1997,56 @@ 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");
+        goto out;
+    }
+
+#ifdef CONFIG_X86
+    if ( !is_pvh_domain(curr) && unlikely(paging_mode_translate(curr)) )
+    {
+        gdprintk(XENLOG_WARNING,"Cannot mix foreign mappings with translated domains");
+        goto out;
+    }
+#endif
+
+    switch ( domid )
+    {
+    case DOMID_IO:
+        pg_owner = rcu_lock_domain(dom_io);
+        break;
+    case DOMID_XEN:
+        pg_owner = rcu_lock_domain(dom_xen);
+        break;
+    default:
+        if ( (pg_owner = rcu_lock_domain_by_id(domid)) == NULL )
+        {
+            gdprintk(XENLOG_WARNING,"Unknown domain '%u'", domid);
+            break;
+        }
+        break;
+    }
+
+ out:
+    return pg_owner;
+}
+
+void put_pg_owner(struct domain *pg_owner)
+{
+    rcu_unlock_domain(pg_owner);
+}
+
 /*
  * Local variables:
  * mode: C
-- 
2.5.0


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

  parent reply	other threads:[~2016-04-01 20:34 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01 20:33 [PATCH V2 0/9] xentrace/xenalyze support on ARM Benjamin Sanda
2016-04-01 20:33 ` Benjamin Sanda
2016-04-01 20:33 ` [PATCH V2 1/9] xenalyze: Support for ARM platform Benjamin Sanda
2016-04-04 14:10   ` Wei Liu
2016-04-04 14:12     ` Wei Liu
2016-04-01 20:33 ` [PATCH V2 2/9] xentrace: " Benjamin Sanda
2016-04-01 20:33 ` [PATCH V2 3/9] " Benjamin Sanda
2016-04-01 20:33 ` Benjamin Sanda [this message]
2016-04-01 20:33 ` [PATCH V2 5/9] " Benjamin Sanda
2016-04-01 20:33 ` [PATCH V2 6/9] " Benjamin Sanda
2016-04-01 20:33 ` [PATCH V2 7/9] " Benjamin Sanda
2016-04-01 20:33 ` [PATCH V2 8/9] " Benjamin Sanda
2016-04-01 20:33 ` [PATCH V2 9/9] " Benjamin Sanda
2016-04-04 14:11 ` [PATCH V2 0/9] xentrace/xenalyze support on ARM Wei Liu
2016-04-04 15:02   ` Julien Grall
2016-04-04 15:50     ` Ben Sanda
2016-04-04 15:59       ` Wei Liu
2016-04-04 16:04       ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1459542834-17522-6-git-send-email-ben.sanda@dornerworks.com \
    --to=ben.sanda@dornerworks.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=julien.grall@arm.com \
    --cc=keir@xen.org \
    --cc=stefano.stabellini@citrix.com \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.