]> xenbits.xensource.com Git - xen.git/commit
x86/P2M: synchronize fast and slow paths of p2m_get_page_from_gfn()
authorJan Beulich <jbeulich@suse.com>
Wed, 2 Apr 2025 12:22:27 +0000 (14:22 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 2 Apr 2025 12:22:27 +0000 (14:22 +0200)
commitb1bbf20a9329d7540a3d2d3fd900919aae5cbe72
tree9f559f48638f5d4274f5ebe25f040ae646b31f6c
parent64f9c54daa5b727291db49c87fa70964f268e85d
x86/P2M: synchronize fast and slow paths of p2m_get_page_from_gfn()

Handling of both grants and foreign pages was different between the two
paths.

While permitting access to grants would be desirable, doing so would
require more involved handling; undo that for the time being. In
particular the page reference obtained would prevent the owning domain
from changing e.g. the page's type (after the grantee has released the
last reference of the grant). Instead perhaps another reference on the
grant would need obtaining. Which in turn would require determining
which grant that was.

Foreign pages in any event need permitting on both paths.

Introduce a helper function to be used on both paths, such that
respective checking differs in just the extra "to be unshared" condition
on the fast path.

While there adjust the sanity check for foreign pages: Don't leak the
reference on release builds when on a debug build the assertion would
have triggered. (Thanks to Roger for the suggestion.)

Fixes: 80ea7af17269 ("x86/mm: Introduce get_page_from_gfn()")
Fixes: 50fe6e737059 ("pvh dom0: add and remove foreign pages")
Fixes: cbbca7be4aaa ("x86/p2m: make p2m_get_page_from_gfn() handle grant case correctly")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
master commit: a8325f981ce4ff8ac8bcc73735f357846b0a0fbb
master date: 2025-03-31 09:21:12 +0200
xen/arch/x86/mm/p2m.c