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

Re: [Xen-devel] [PATCH v3 27/38] arm/p2m: Introduce p2m_lookup_attr



Hello Sergej,

On 16/08/2016 23:17, Sergej Proskurin wrote:
The function "p2m_lookup_attr" allows to lookup the mfn, memory type,
access rights, and page order corresponding to a domain's gfn.

Signed-off-by: Sergej Proskurin <proskurin@xxxxxxxxxxxxx>
---
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Julien Grall <julien.grall@xxxxxxx>
---
v3: Change function prototype of "p2m_lookup_attr" by removing the
    function parameter "unsigned int *mattr", as it is not needed by the
    callers.

    Change function prototype of "p2m_lookup_attr" by changing the
    parameter of type xenmem_access_t to p2m_access_t.
---
 xen/arch/arm/p2m.c        | 15 +++++++++++++++
 xen/include/asm-arm/p2m.h | 10 ++++++++++
 2 files changed, 25 insertions(+)

diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 1d3df0f..cef05ed 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -429,6 +429,21 @@ mfn_t p2m_lookup(struct domain *d, gfn_t gfn, p2m_type_t 
*t)
     return ret;
 }

+mfn_t p2m_lookup_attr(struct p2m_domain *p2m,
+                      gfn_t gfn,
+                      p2m_type_t *t,
+                      p2m_access_t *a,
+                      unsigned int *page_order)
+{
+    mfn_t ret;
+
+    p2m_read_lock(p2m);
+    ret = p2m_get_entry(p2m, gfn, t, a, page_order);
+    p2m_read_unlock(p2m);
+
+    return ret;
+}
+

Why don't you directly use p2m_get_entry from altp2m code? Looking at the callers, there is a potential chance of deadlock because you use sequentially twice p2m_read_lock on the same p2m.

Give a look on how you handle h2pm in altp2m_set_mem_access.

In any case, I really don't think this function is useful as most of the time you will already have the lock taken.

Regards,

--
Julien Grall

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

 


Rackspace

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