* [PATCH for-4.22(?) v2] gnttab: simplify (really: drop) gnttab_set_frame_gfn()
@ 2026-05-12 14:46 Jan Beulich
2026-05-12 15:25 ` Andrew Cooper
2026-05-12 15:32 ` Oleksii Kurochko
0 siblings, 2 replies; 3+ messages in thread
From: Jan Beulich @ 2026-05-12 14:46 UTC (permalink / raw)
To: xen-devel@lists.xenproject.org
Cc: Julien Grall, Stefano Stabellini, Volodymyr Babchuk,
Bertrand Marquis, Michal Orzel, Andrew Cooper,
Roger Pau Monné, Teddy Astie, Anthony PERARD, Rafal Wojtczuk,
Oleksii Kurochko
It's not really doing anything for valid GFNs, which renders its one use
site pretty pointless. The other isn't so much about setting anything, but
rather about clearing.
The main point here, however, is about Rafal spotting the double
fetching of the GFN (first in gnttab_unpopulate_status_frames(), then
again in gnttab_set_frame_gfn()). Re-purpose the macro parameter to pass
in the already fetched GFN, while dropping the no longer used parameters.
As the result is a mere wrapper around guest_physmap_remove_page(), drop
the hook altogether.
Suggested-by: Rafal Wojtczuk <rafal.wojtczuk@7bulls.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
---
v2: Drop hook altogether.
--- a/xen/arch/arm/include/asm/grant_table.h
+++ b/xen/arch/arm/include/asm/grant_table.h
@@ -50,13 +50,6 @@ int replace_grant_host_mapping(uint64_t
#define gnttab_dom0_frames() \
min_t(unsigned int, opt_max_grant_frames, PFN_DOWN(_etext - _stext))
-#define gnttab_set_frame_gfn(gt, st, idx, gfn, mfn) \
- (gfn_eq(gfn, INVALID_GFN) \
- ? guest_physmap_remove_page((gt)->domain, \
- gnttab_get_frame_gfn(gt, st, idx), \
- mfn, 0) \
- : 0)
-
#define gnttab_get_frame_gfn(gt, st, idx) ({ \
(st) ? gnttab_status_gfn(NULL, gt, idx) \
: gnttab_shared_gfn(NULL, gt, idx); \
--- a/xen/arch/x86/include/asm/grant_table.h
+++ b/xen/arch/x86/include/asm/grant_table.h
@@ -32,12 +32,6 @@ static inline int replace_grant_host_map
return replace_grant_pv_mapping(addr, frame, new_addr, flags);
}
-#define gnttab_set_frame_gfn(gt, st, idx, gfn, mfn) \
- (gfn_eq(gfn, INVALID_GFN) \
- ? guest_physmap_remove_page((gt)->domain, \
- gnttab_get_frame_gfn(gt, st, idx), \
- mfn, 0) \
- : 0 /* Handled in add_to_physmap_one(). */)
#define gnttab_get_frame_gfn(gt, st, idx) ({ \
mfn_t mfn_ = (st) ? gnttab_status_mfn(gt, idx) \
: gnttab_shared_mfn(gt, idx); \
--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -1844,8 +1844,7 @@ gnttab_unpopulate_status_frames(struct d
{
int rc = gfn_eq(gfn, INVALID_GFN)
? 0
- : gnttab_set_frame_gfn(gt, true, i, INVALID_GFN,
- page_to_mfn(pg));
+ : guest_physmap_remove_page(d, gfn, page_to_mfn(pg), 0);
if ( rc )
{
@@ -4285,8 +4284,6 @@ int gnttab_map_frame_begin(
*/
if ( !get_page(pg, d) )
rc = -EBUSY;
- else if ( (rc = gnttab_set_frame_gfn(gt, status, idx, gfn, *mfn)) )
- put_page(pg);
}
if ( rc )
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH for-4.22(?) v2] gnttab: simplify (really: drop) gnttab_set_frame_gfn()
2026-05-12 14:46 [PATCH for-4.22(?) v2] gnttab: simplify (really: drop) gnttab_set_frame_gfn() Jan Beulich
@ 2026-05-12 15:25 ` Andrew Cooper
2026-05-12 15:32 ` Oleksii Kurochko
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2026-05-12 15:25 UTC (permalink / raw)
To: Jan Beulich, xen-devel@lists.xenproject.org
Cc: Andrew Cooper, Julien Grall, Stefano Stabellini,
Volodymyr Babchuk, Bertrand Marquis, Michal Orzel,
Roger Pau Monné, Teddy Astie, Anthony PERARD, Rafal Wojtczuk,
Oleksii Kurochko
On 12/05/2026 3:46 pm, Jan Beulich wrote:
> It's not really doing anything for valid GFNs, which renders its one use
> site pretty pointless. The other isn't so much about setting anything, but
> rather about clearing.
>
> The main point here, however, is about Rafal spotting the double
> fetching of the GFN (first in gnttab_unpopulate_status_frames(), then
> again in gnttab_set_frame_gfn()). Re-purpose the macro parameter to pass
> in the already fetched GFN, while dropping the no longer used parameters.
>
> As the result is a mere wrapper around guest_physmap_remove_page(), drop
> the hook altogether.
>
> Suggested-by: Rafal Wojtczuk <rafal.wojtczuk@7bulls.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH for-4.22(?) v2] gnttab: simplify (really: drop) gnttab_set_frame_gfn()
2026-05-12 14:46 [PATCH for-4.22(?) v2] gnttab: simplify (really: drop) gnttab_set_frame_gfn() Jan Beulich
2026-05-12 15:25 ` Andrew Cooper
@ 2026-05-12 15:32 ` Oleksii Kurochko
1 sibling, 0 replies; 3+ messages in thread
From: Oleksii Kurochko @ 2026-05-12 15:32 UTC (permalink / raw)
To: Jan Beulich, xen-devel@lists.xenproject.org
Cc: Julien Grall, Stefano Stabellini, Volodymyr Babchuk,
Bertrand Marquis, Michal Orzel, Andrew Cooper,
Roger Pau Monné, Teddy Astie, Anthony PERARD, Rafal Wojtczuk
On 5/12/26 4:46 PM, Jan Beulich wrote:
> It's not really doing anything for valid GFNs, which renders its one use
> site pretty pointless. The other isn't so much about setting anything, but
> rather about clearing.
>
> The main point here, however, is about Rafal spotting the double
> fetching of the GFN (first in gnttab_unpopulate_status_frames(), then
> again in gnttab_set_frame_gfn()). Re-purpose the macro parameter to pass
> in the already fetched GFN, while dropping the no longer used parameters.
>
> As the result is a mere wrapper around guest_physmap_remove_page(), drop
> the hook altogether.
>
> Suggested-by: Rafal Wojtczuk <rafal.wojtczuk@7bulls.com>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Release-Acked-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Thanks.
~ Oleksii
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-05-12 15:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-12 14:46 [PATCH for-4.22(?) v2] gnttab: simplify (really: drop) gnttab_set_frame_gfn() Jan Beulich
2026-05-12 15:25 ` Andrew Cooper
2026-05-12 15:32 ` Oleksii Kurochko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.