Re: [PATCH v3 0/4] sparc64: D-cache alias flushing fixes
From: Andreas Larsson
Date: Fri Oct 23 2026 - 05:26:03 EST
On 2026-10-22 01:33, Imre Kaloz wrote:
> These fix D-cache alias flushing on sparc64 CPUs with a virtually
> indexed L1 D-cache (Spitfire and Cheetah).
>
> 1/4 makes xcall_deliver() bail out before it touches the trap block
> when there is no other CPU to call, so an early cross call, before
> init_IRQ() sets up the mondo blocks, can't end up writing to physical
> address 0.
>
> 2/4 flushes only the page a PTE maps instead of its whole folio, which
> removes about a million redundant page flushes from a colour-changing
> mremap() of a large folio (7.3 s on a Sun Fire V240).
>
> 3/4 implements flush_cache_vmap() and flush_cache_vunmap(), which have
> been no-ops. Stale vmalloc lines corrupt BPF programs and module data
> on UltraSPARC III.
>
> 4/4 passes the number of PTEs to move_pte(), as Andreas suggested. It
> touches mm/mremap.c and include/linux/pgtable.h, so it needs an ack
> from the mm folks.
>
> 1-3 don't depend on 4 and can go in on their own. 2 and 3 are for
> stable (3 needs 2), 1 and 4 aren't. The series is on top of the sparc
> for-next branch.
>
> Changes in v3:
> - new 1/4 and 4/4, following Andreas' review
> - 2/4: reworded the message and the move_pte() comment, marked the
> UP #endif
> - 3/4: reworded the message, dropped the Suggested-by (I have no
> email address for nsafran1217, the Link credits them), noted the
> stable dependency on 2/4
> - picked up Stian's and Adrian's Tested-by tags
>
> v2: https://lore.kernel.org/r/20260928132102.1707-1-kaloz@xxxxxxxxxx
>
> Imre Kaloz (4):
> sparc64: skip the trap block in xcall_deliver() when there is no
> target
> sparc64: flush only the aliased page, not its whole folio
> sparc64: flush vmalloc ranges from the D-cache on map and unmap
> mm: pass the number of PTEs to move_pte()
>
> arch/sparc/include/asm/cacheflush_64.h | 9 ++--
> arch/sparc/include/asm/pgtable_64.h | 14 ++++--
> arch/sparc/kernel/smp_64.c | 51 +++++++++++++++-----
> arch/sparc/mm/init_64.c | 65 ++++++++++++++++++++++++++
> arch/sparc/mm/tlb.c | 2 +-
> arch/sparc/mm/ultra.S | 25 ++++++++++
> include/linux/pgtable.h | 2 +-
> mm/mremap.c | 2 +-
> 8 files changed, 148 insertions(+), 22 deletions(-)
>
>
> base-commit: 2bc58762a3d74e42de129d717ae3ba10ecf0ab96
Reviewed-by: Andreas Larsson <andreas@xxxxxxxxxxx>
Picking patches 1-3 to my for-next. I won't pick number 4 up at this
point without confirmation from the mm folks.
Thanks,
Andreas