x86/pod: fix decrease_reservation() clearing of M2P entries
PATCH 1/1 x86/pod: fix decrease_reservation() clearing of M2P entries
Add the missing index increase in the M2P clearing loop, otherwise the loop keeps pointlessly setting the same MFN entry repeatedly. This seems to be an oversight from the change that introduced support to process high order pages in one go.
--- xen/arch/x86/mm/p2m-pod.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/arch/x86/mm/p2m-pod.c +1 -1
@@ -655,7 +655,7 @@ decrease_reservation(struct domain *d, gfn_t gfn, unsigned int order) }p2m_tlb_flush_sync (p2m);for ( j =0 ; j < n; ++j ) -set_gpfn_from_mfn (mfn_x (mfn),INVALID_M2P_ENTRY ); +set_gpfn_from_mfn (mfn_x (mfn) + j,INVALID_M2P_ENTRY );p2m_pod_cache_add (p2m, page, cur_order);ioreq_request_mapcache_invalidate (d);
Signature · 1 line
2.51.0
Quoted 4 lines · Roger Pau Monne
Add the missing index increase in the M2P clearing loop, otherwise the loop keeps pointlessly setting the same MFN entry repeatedly. This seems to be an oversight from the change that introduced support to process high order pages in one go.
Ouch.
Quoted 2 lines
Fixes 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")Signed-off-by Roger Pau Monné <[email protected]>
I'd like to note that things were broken in the same way before that commit, too, simply because the order wasn't taken into account all. (This is not a request to change the Fixes: tag, though. It's just an observation.)
Jan
Quoted 8 lines · Jan Beulich
Quoted 4 lines · Roger Pau Monne
Add the missing index increase in the M2P clearing loop, otherwise the loop keeps pointlessly setting the same MFN entry repeatedly. This seems to be an oversight from the change that introduced support to process high order pages in one go.
Ouch.
Quoted 8 lines
Quoted 2 lines
Fixes 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")Signed-off-by Roger Pau Monné <[email protected]>Reviewed-by Jan Beulich <[email protected]>I'd like to note that things were broken in the same way before that commit, too, simply because the order wasn't taken into account all. (This is not a request to change the Fixes: tag, though. It's just an observation.)
Are you sure? Previous to that commit the order is not taken into account, and each 4K page is processed independently: the i index is strictly increased with +1 for each loop.
Thanks, Roger.
Quoted 14 lines · Roger Pau Monné
Quoted 13 lines · Jan Beulich
Quoted 4 lines · Roger Pau Monne
Add the missing index increase in the M2P clearing loop, otherwise the loop keeps pointlessly setting the same MFN entry repeatedly. This seems to be an oversight from the change that introduced support to process high order pages in one go.
Ouch.
Quoted 2 lines
Fixes 3c352011c0d3 ("x86/PoD: shorten certain operations on higher order ranges")Signed-off-by Roger Pau Monné <[email protected]>Reviewed-by Jan Beulich <[email protected]>
Quoted 7 lines
Quoted 3 lines
I'd like to note that things were broken in the same way before that commit, too, simply because the order wasn't taken into account all. (This is not a request to change the Fixes: tag, though. It's just an observation.)
Are you sure? Previous to that commit the order is not taken into account, and each 4K page is processed independently: the
iindex is strictly increased with +1 for each loop.
Indeed. No idea what I was thinking I was seeing.
Jan