x86/xen: allow nesting of same lazy mode
authorJuergen Gross <jgross@suse.com>
Wed, 13 Sep 2023 11:38:28 +0000 (13:38 +0200)
committerJuergen Gross <jgross@suse.com>
Tue, 19 Sep 2023 05:04:49 +0000 (07:04 +0200)
commit49147beb0ccbf4c5bb81a44be93ec3bc5e4a79f1
tree9e152bf82cf2f3aa839865cff0bf589985ac5e4a
parenta4a7644c15096f57f92252dd6e1046bf269c87d8
x86/xen: allow nesting of same lazy mode

When running as a paravirtualized guest under Xen, Linux is using
"lazy mode" for issuing hypercalls which don't need to take immediate
effect in order to improve performance (examples are e.g. multiple
PTE changes).

There are two different lazy modes defined: MMU and CPU lazy mode.
Today it is not possible to nest multiple lazy mode sections, even if
they are of the same kind. A recent change in memory management added
nesting of MMU lazy mode sections, resulting in a regression when
running as Xen PV guest.

Technically there is no reason why nesting of multiple sections of the
same kind of lazy mode shouldn't be allowed. So add support for that
for fixing the regression.

Fixes: bcc6cc832573 ("mm: add default definition of set_ptes()")
Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Link: https://lore.kernel.org/r/20230913113828.18421-4-jgross@suse.com
Signed-off-by: Juergen Gross <jgross@suse.com>
arch/x86/include/asm/xen/hypervisor.h
arch/x86/xen/enlighten_pv.c