|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v7 2/2] x86: extend do_mmu_update() to support returning the old PTE value
On 02.12.2026 19:25, Kevin Lampis wrote:
> A new sub-op MMU_PT_UPDATE_SWAP when used will do an atomic swap to set
> the new value and return the old PTE value through the req.val field.
>
> - The old PTE value is passed back to the guest through the req.val field
>
> If MMU_PT_UPDATE_SWAP is not set then the old behavior is preserved
> do_mmu_update -> mod_l*_entry -> UPDATE_ENTRY -> paging_write_guest_entry
>
> The new MMU_PT_UPDATE_SWAP call chain looks like this
> do_mmu_update -> mod_l*_entry -> UPDATE_ENTRY -> paging_cmpxchg_guest_entry
>
> New feature flag XENFEAT_mmu_pt_update_swap.
>
> Signed-off-by: Kevin Lampis <kevin.lampis@xxxxxxxxxx>
> ---
> Changes in v7:
> - Use __copy_field_to_guest
> - Put missing newlines back in (smaller diff)
Well, I really don't know what to say. You did ...
> --- a/xen/arch/x86/mm.c
> +++ b/xen/arch/x86/mm.c
> @@ -4105,6 +4105,7 @@ long do_mmu_update(
> case MMU_NORMAL_PT_UPDATE:
> case MMU_PT_UPDATE_PRESERVE_AD:
> case MMU_PT_UPDATE_NO_TRANSLATE:
> + case MMU_PT_UPDATE_SWAP:
> {
> p2m_type_t p2mt;
>
> @@ -4161,42 +4162,69 @@ long do_mmu_update(
> if ( page_lock(page) )
> {
> unsigned int update_flags = 0;
> + intpte_t old_pte = 0;
>
> if ( cmd == MMU_PT_UPDATE_PRESERVE_AD )
> update_flags = PTE_UPDATE_PRESERVE_AD;
> else if ( cmd == MMU_PT_UPDATE_NO_TRANSLATE )
> update_flags = PTE_UPDATE_NO_TRANSLATE;
> + else if ( cmd == MMU_PT_UPDATE_SWAP )
> + update_flags = PTE_UPDATE_SWAP;
>
> switch ( page->u.inuse.type_info & PGT_type_mask )
> {
> case PGT_l1_page_table:
> + {
> + l1_pgentry_t ol1e = {};
> +
> rc = mod_l1_entry(va, l1e_from_intpte(req.val), mfn,
> - update_flags, v, pg_owner, NULL);
> + update_flags, v, pg_owner, &ol1e);
> + old_pte = l1e_get_intpte(ol1e);
> break;
>
> + }
... keep the newlines, yes, but you placed the figure braces wrongly.
We want the blank lines to _separate_ the case blocks. With the
adjustment:
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
Yet as said on patch 1 - a little more care would be nice. This sending
of a v7 has ended up pretty pointless, as on both patches there now
still need to be on-commit adjustments.
Jan
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |