[GIT PULL] RISC-V Patches for the 6.15 Merge Window, Part 1

Linus Torvalds torvalds at linux-foundation.org
Fri Apr 4 09:51:55 PDT 2025


On Fri, 4 Apr 2025 at 08:58, Palmer Dabbelt <palmer at rivosinc.com> wrote:
>
> --- a/arch/riscv/mm/tlbflush.c
> +++ b/arch/riscv/mm/tlbflush.c
> @@ -192,10 +192,9 @@ bool arch_tlbbatch_should_defer(struct mm_struct *mm)
>  void arch_tlbbatch_add_pending(struct arch_tlbflush_unmap_batch *batch,
>                 struct mm_struct *mm, unsigned long start, unsigned long end)
>  {
> -       unsigned long start = uaddr & PAGE_MASK;
> -
>         cpumask_or(&batch->cpumask, &batch->cpumask, mm_cpumask(mm));
> -       mmu_notifier_arch_invalidate_secondary_tlbs(mm, start, start + PAGE_SIZE);
> +       mmu_notifier_arch_invalidate_secondary_tlbs(mm, start & PAGE_MASK,
> +                                                   (end & PAGE_MASK) + PAGE_SIZE);
>  }

That just seems wrong.

All the PAGE_MASK and PAGE_SIZE games look entirely wrong and pointless.

As far as I can tell, the code should just call
mmu_notifier_arch_invalidate_secondary_tlbs() with the completely
unmodified start and end values. They should already be page-aligned,
and 'end' is already the 'one past' thing, not the final byte.

And maybe I'm missing something and my resolution is wrong, but that's
what I did.

Somebody should obviously test it.

            Linus



More information about the linux-riscv mailing list