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

Re: [Xen-devel] [PATCH v2 11/25] arm/altp2m: Add HVMOP_altp2m_destroy_p2m.





On 06/08/2016 10:54, Sergej Proskurin wrote:
Hi Julien,

Hello Sergej,

On 08/04/2016 01:46 PM, Julien Grall wrote:
Hello Sergej,

On 01/08/16 18:10, Sergej Proskurin wrote:
Signed-off-by: Sergej Proskurin <proskurin@xxxxxxxxxxxxx>
---
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Julien Grall <julien.grall@xxxxxxx>
---
v2: Substituted the call to tlb_flush for p2m_flush_table.
    Added comments.
    Cosmetic fixes.
---
 xen/arch/arm/altp2m.c        | 50
++++++++++++++++++++++++++++++++++++++++++++
 xen/arch/arm/hvm.c           |  2 +-
 xen/include/asm-arm/altp2m.h |  4 ++++
 3 files changed, 55 insertions(+), 1 deletion(-)

diff --git a/xen/arch/arm/altp2m.c b/xen/arch/arm/altp2m.c
index c22d2e4..80ed553 100644
--- a/xen/arch/arm/altp2m.c
+++ b/xen/arch/arm/altp2m.c

[...]

+
+            p2m_flush_table(p2m);
+
+            /*
+             * Reset VTTBR.
+             *
+             * Note that VMID is not freed so that it can be reused
later.
+             */
+            p2m->vttbr.vttbr = INVALID_VTTBR;
+            d->arch.altp2m_vttbr[idx] = INVALID_VTTBR;
+
+            read_unlock(&p2m->lock);

Why did you decide to reset the p2m rather than free it? The code
would be simpler with the latter.


* First, to be as similar to the x86 implementation as possible.
* Second, simply to reuse already allocated p2m's without additional
overhead.

I don't really buy those arguments. The x86 implementation may not fit the ARM model. Initializing a p2m on ARM is very quick: allocating the p2m and the root pages (up to 2 page).

So the overhead is really minimal. Therefore, I don't see any reason to introduce complex bookkeeping when NULL can be used for the same purpose.

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®.