[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] x86/xen: Tolerate nested XEN_LAZY_MMU entering/leaving



On 09/05/2026 08:32, Jürgen Groß wrote:
> On 08.05.26 22:54, Kevin Brodsky wrote:
>> On 08/05/2026 16:39, Juergen Gross wrote:
>>> With the support of nested lazy mmu sections it can happen that
>>> arch_enter_lazy_mmu_mode() is being called twice without a call of
>>> arch_leave_lazy_mmu_mode() in between, as the lazy_mmu_*() helpers
>>> are not disabling preemption when checking for nested lazy mmu
>>> sections.
>>
>> I think this is a correct description of the issue, i.e. potentially we
>> have arch_enter_lazy_mmu_mode() called twice *sequentially*. Therefore I
>> don't think that disabling preemption inside arch_enter_lazy_mmu_mode()
>> is enough - we have a problem with preemption occurring inside
>> lazy_mmu_mode_enable() generally, not necessarily inside
>> arch_enter_lazy_mmu_mode().
>>
>> Preemption shouldn't matter if commit 291b3abed657 is reverted. AFAICT
>> this is the only easy fix.
> The description wasn't really complete, I think.
>
> The double call will only be possible if arch_end_context_switch() is
> calling arch_enter_lazy_mmu_mode(), and this is happening for Xen PV
> only.
> arch_end_context_switch() is a nop for all other cases.

Right, agreed. Would be good to update the commit message.

>
> So this can be handled completely internal of Xen (otherwise a revert of
> 291b3abed657 wouldn't help), and it is easy to do so as my patch is
> showing.
>
> As said, I'd like to get rid of the extra tracking by Xen regarding
> lazy mode.

Got it, that would be best.

This patch should ensure that xen_lazy_mode always has the correct value
regardless of preemption, which is what matters for Xen.

Reviewed-by: Kevin Brodsky <kevin.brodsky@xxxxxxx>



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.