[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
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Oleksandr <olekstysh@xxxxxxxxx>
- Date: Mon, 13 Sep 2021 22:57:02 +0300
- Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Mon, 13 Sep 2021 19:57:22 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
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);
-
ASSERT(mfn_valid(mfn));
put_page(mfn_to_page(mfn));
}
+
+#ifdef CONFIG_GRANT_TABLE
+ /*
+ * 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);
+#endif
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).
Jan
--
Regards,
Oleksandr Tyshchenko
|