On 31.10.2023 17:22, Matias Ezequiel Vara Larsen wrote:
> This commit prevents PGT_none type pages to be validated/devalidated.

This isn't quite true. It is rather the case that (de)validation of this
type is trivial, and hence can be short-circuited just like is done for
certain other types.

> This is required for the use-case in which a guest-agnostic resource is
> allocated. In this case, these pages may be accessible by an "owning" PV
> domain. To lock the page from guest pov, pages are required to be marked
> with PGT_none with a single type ref. In particular, this commit makes
> the stats_table resource type to use this flag during
> get_page_and_type(). 

Imo the change here wants to come first, so that stats_vcpu_alloc_mfn()
can use PGT_none right away (rather than being transiently broken).

Beyond that I think justification needs extending here. In particular,
"lock the page" is at best misleading, considering page_lock() and
PGT_locked that we have. What you mean is "lock the page read-only". You
may want to further refer to the place where this is also done
(share_xen_page_with_guest()), just without get_page_and_type(). This is
not the least to explain why share_xen_page_with_guest() cannot be used
for your purpose, or why doing it this way is a better approach
(potentially then wanting using elsewhere as well).

Jan

Reply via email to