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

Re: [RFC PATCH] xen/gnttab: Store frame GFN in struct page_info on Arm

On 13.09.21 09:17, Jan Beulich wrote:

Hi Jan

On 10.09.2021 09:52, Jan Beulich wrote:
On 10.09.2021 01:04, Oleksandr Tyshchenko wrote:
@@ -731,11 +733,19 @@ static void p2m_put_l3_page(const lpae_t pte)
      if ( p2m_is_foreign(pte.p2m.type) )
-        mfn_t mfn = lpae_get_mfn(pte);
+    /*
+     * Check whether we deal with grant table page. As the grant table page
+     * is xen_heap page and its entry has known p2m type, detect it and mark
+     * the stored GFN as invalid.
+     */
+    if ( p2m_is_ram(pte.p2m.type) && is_xen_heap_mfn(mfn) )
+        page_set_frame_gfn(mfn_to_page(mfn), INVALID_GFN);
I take it the write done is benign for other Xen heap pages? I suppose
this would want making very explicit, as such an assumption is easy to
go stale by entirely unrelated changes.

I also wonder whether you really mean to include p2m_ram_ro pages here
as well.
Actually I've meanwhile realized I should put my question here quite
differently: Aren't you effectively introducing an M2P here for Arm,
except that you artificially limit it to the Xen heap pages needed for
the grant table?

Difficult to say, it might indeed look a bit close to M2P, so the answer to your question is more yes than no. But, I didn't have a plan to introduce M2P on Arm. It turned out that stashing GFN into page_info (as was suggested) avoided huge lookups, so we have got MFN->GFN in the end. The purpose of this patch was just to fix a potential issue with remapping grant-table frame on architecture without the M2P (Arm).



Oleksandr Tyshchenko



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