Re: [PATCH 1/6] alpha: run check_mmu_context() from finish_arch_post_lock_switch()

Magnus Lindholm <[email protected]>
Newsgroups gmane.linux.ports.alpha,gmane.linux.kernel
Message-ID <CA+=Fv5Quu0kXAt1jNO60GoU=Y7ex9FuJR3OAXdp6n6Fqwd0-Ag@mail.gmail.com>
On Mon, Aug 10, 2026 at 4:40 AM Matt Turner <[email protected]> wrote:

> > arch/alpha/include/asm/switch_to.h:12 calls it, then finish_task_switch() calls
> > the new hook a few lines later. Between them the rq lock is held and IRQs are
> > off (finish_lock_switch() → raw_spin_rq_unlock_irq), so no shootdown IPI can
> > land in that window.
> >
> > I think we should drop it from switch_to.h?
>

Thanks Matt, agreed. I’ll drop the now-redundant check_mmu_context() from
switch_to() and let finish_arch_post_lock_switch() handle it.

> Another thing. Pre-existing issue, I believe:
>
> preemptible() is true in kthread_use_mm(), so the hook does nothing,
> and ev5_switch_mm()'s asn_lock = 1 stays set on that CPU until the
> next real switch_to.
>
> Benign, but patch 2 depends on this. patch 2's own commit message says
> current->mm can be true with the mm's context not loaded
> (kthread_use_mm), and the only thing saving that case is the leaked
> asn_lock forcing asn_locked() → flush_tlb_other(). Should probably
> document that in one of these patches.

Good point, thanks. I’ll document in the commit message that kthread_use_mm()
can leave asn_lock set until the next real switch, and that the later
TLB handling
relies on this.

Magnus
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.