All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 0/2] alpha: complete the direct-mm shootdown fixes
@ 2026-10-10 14:33 Magnus Lindholm
  2026-10-10 14:33 ` [PATCH v4 1/2] alpha: do not clear remote MMU contexts in migrate_flush_tlb_page() Magnus Lindholm
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Magnus Lindholm @ 2026-10-10 14:33 UTC (permalink / raw)
  To: richard.henderson, mattst88, linux-kernel, linux-alpha; +Cc: linmag7

This is the second of two series. Apply all eight patches of "alpha: fix
stale TLB translations breaking copy-on-write and writeback" v4 first,
then these two patches. The base-commit and prerequisite-patch-id lines
below describe that ordering from for-next at 33465f6ab697.

Patch 1 removes the remote context-clearing loop after the migration
shootdown rendezvous. The callbacks have already updated their own slots;
clearing them remotely can hide a CPU still running the mm.

Patch 2 fixes the mm_users <= 1 shootdown shortcut. A kthread_use_mm()
borrower takes mmgrab(), not mmget(), so mm_users does not count it.
Inspect remote context slots instead of clearing them, and skip IPIs
only when no other CPU has a context. Together the two patches remove
runtime remote writes to those slots.

The full-mm, icache and migration callbacks now test current->mm, like
the page-flush IPI handler. A CPU retaining the mm only lazily clears its
slot instead of publishing a new ASN. The migration callback still does
the per-VA tbi() afterwards. Returning to the mm allocates a new ASN
through ev5_switch_mm(), or through the direct-load path for an explicit
borrow by current.

The caller-side tests in flush_tlb_mm() and flush_icache_user_page()
remain current->active_mm. A lazy caller can publish its own slot, but
it also performs the shortcut check, which excludes the calling CPU.
The claim about retiring lazy slots applies to the callbacks; it does
not mean that every path now tests current->mm.

Context publication from ev5_switch_mm() is ordered before use of the
mm by the mb() in Alpha's arch_spin_unlock(), when finish_lock_switch()
drops the rq lock. This is an Alpha property, not a generic guarantee
that unlocking the scheduler lock is a full barrier. A comment at the
store now records that dependency. The smp_mb() added to
__load_new_mm_context() in v3 remains necessary for publications from
check_mmu_context(), which runs after the scheduler has dropped the lock.

Changes since v3:

  - Drop the stale v2 Message-ID trailer from patch 1. Its code is
    unchanged and Matt's Reviewed-by is retained.
  - Test current->mm in ipi_flush_mm_and_page(), so migration callbacks
    also retire lazy slots rather than repopulating them on each page.
  - Explain why the caller-side active_mm tests remain unchanged.
  - Name Alpha's arch_spin_unlock() mb() in the ordering argument and
    document the dependency next to the ev5_switch_mm() publication.
  - Add Matt's Reviewed-by to patch 2 with the migration-handler change
    he requested as the condition for that tag.

Testing

Fresh fork-throughput measurements and an SMP run under compaction are
still pending for this revision. Targeted Alpha SMP, UP and SMP with
compaction builds passed, as did a full ES40 CONFIG_COMPACTION=y build. The earlier fork numbers do not measure
these handler changes and are not presented as results for v4.

For comparison only, on 2026-10-09 the preceding MMU v3 plus stale-TLB v4
passed nine lost-store rounds, nine stale-read rounds and ten writeback
rounds on an ES40, EV68AL Tsunami, with four CPUs online and
CONFIG_COMPACTION=n. No new kernel errors were observed. That run did not
exercise the migration callback changed here and is not validation of
this revision under compaction.

The direct context-load fix moved to stale-TLB v4 patch 1. Its existing
review/test tags remain there; it is not duplicated in this series.
Both patches here retain Cc: stable, including the migration cleanup as
the shortcut's prerequisite.

Thanks to Matt Turner for the review and EV7 testing.

Earlier revision:
  v2: https://lore.kernel.org/linux-alpha/20261008195608.965266-1-linmag7@gmail.com/
  v3: https://lore.kernel.org/linux-alpha/20261009212501.971158-1-linmag7@gmail.com/

Magnus Lindholm (2):
  alpha: do not clear remote MMU contexts in migrate_flush_tlb_page()
  alpha: do not skip TLB shootdown IPIs for kthread-borrowed mms

 arch/alpha/include/asm/mmu_context.h |  7 +++-
 arch/alpha/kernel/smp.c              | 52 ++++++++++++++--------------
 arch/alpha/mm/fault.c                |  4 ++-
 arch/alpha/mm/tlbflush.c             | 18 +---------
 4 files changed, 36 insertions(+), 45 deletions(-)


base-commit: 33465f6ab697abceafd9a340067a544d551c4412
prerequisite-patch-id: d194ee1170a45793fa8533400dbc5599fc0e59ae
prerequisite-patch-id: 17df30a2da268e1bd07c7b44de4ef061cb744c50
prerequisite-patch-id: 94856bd5734d96521ef19e59cdb77af1d577fefa
prerequisite-patch-id: 7326de756f1a933cd3c44e4f7669c5a7c4519678
prerequisite-patch-id: 9e39c93f5b7267d1e8ffd176988803681ba03eeb
prerequisite-patch-id: c3f48cfa74e60b966610f88f73f7a393b5adf0b2
prerequisite-patch-id: 73a4faf81a8a0929ba8ba03a6d9a3286e0d9bd2b
prerequisite-patch-id: 55fb49cef84ea661b5340f14c56d73c04556f565
-- 
2.43.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-10-11 15:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-10 14:33 [PATCH v4 0/2] alpha: complete the direct-mm shootdown fixes Magnus Lindholm
2026-10-10 14:33 ` [PATCH v4 1/2] alpha: do not clear remote MMU contexts in migrate_flush_tlb_page() Magnus Lindholm
2026-10-10 14:33 ` [PATCH v4 2/2] alpha: do not skip TLB shootdown IPIs for kthread-borrowed mms Magnus Lindholm
2026-10-10 23:34   ` Matt Turner
2026-10-11 15:09     ` Magnus Lindholm
2026-10-10 23:33 ` [PATCH v4 0/2] alpha: complete the direct-mm shootdown fixes Matt Turner

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.