Re: [PATCH] sparc64: replace move_pte() with a D-cache flush in flush_cache_range()
From: Mike Rapoport
Date: Wed Nov 04 2026 - 08:50:50 EST
On Wed, Nov 04, 2026 at 11:52:58AM +0100, Imre Kaloz wrote:
> mremap() can move a page to an address of the other D-cache color,
> leaving lines of the old color in the virtually indexed D-cache of
> Spitfire and Cheetah CPUs. move_pte() flushed the page for each PTE
> moved, which is only correct while move_ptes() handles one PTE at a
> time.
>
> Drop move_pte(), which no other architecture defines, and flush the
> whole D-cache in flush_cache_range(), which mremap() calls on the old
> range before moving the PTEs. This keeps the fix in sparc64 without
> a page table walk.
>
> Suggested-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>
> Link: https://lore.kernel.org/all/409079fe-ab52-4389-9fe0-d7246eb27bad@xxxxxxxxxx/
> Signed-off-by: Imre Kaloz <kaloz@xxxxxxxxxx>
> ---
> Andreas asked for this as a separate patch once the merge window was
> over [1]. It applies on top of sparc for-next.
>
> [1] https://lore.kernel.org/all/4fba060e-c4f4-4d73-8efe-dbed0b5a7bc3@xxxxxxxxxxx/
>
> arch/sparc/include/asm/cacheflush_64.h | 4 ++--
> arch/sparc/include/asm/pgtable_64.h | 21 ---------------------
> arch/sparc/mm/init_64.c | 18 ++++++++++++++++++
> include/linux/pgtable.h | 4 ----
> mm/mremap.c | 1 -
> 5 files changed, 20 insertions(+), 28 deletions(-)
Lovely indeed :)
Acked-by: Mike Rapoport (Microsoft) <rppt@xxxxxxxxxx>
--
Sincerely yours,
Mike.