[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <m2r25t8r1a.fsf@linux-m68k.org>
Date: Sat, 10 Aug 2019 08:37:21 +0200
From: Andreas Schwab <schwab@...ux-m68k.org>
To: Atish Patra <atish.patra@....com>
Cc: linux-kernel@...r.kernel.org, Albert Ou <aou@...s.berkeley.edu>,
Alexios Zavras <alexios.zavras@...el.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Palmer Dabbelt <palmer@...ive.com>,
Anup Patel <anup.patel@....com>,
Paul Walmsley <paul.walmsley@...ive.com>,
linux-riscv@...ts.infradead.org,
Allison Randal <allison@...utok.net>
Subject: Re: [PATCH] RISC-V: Issue a local tlb flush if possible.
On Aug 09 2019, Atish Patra <atish.patra@....com> wrote:
> @@ -46,14 +47,38 @@ static inline void remote_sfence_vma(struct cpumask *cmask, unsigned long start,
> unsigned long size)
> {
> struct cpumask hmask;
> + struct cpumask tmask;
> + int cpuid = smp_processor_id();
>
> cpumask_clear(&hmask);
> - riscv_cpuid_to_hartid_mask(cmask, &hmask);
> - sbi_remote_sfence_vma(hmask.bits, start, size);
> + cpumask_clear(&tmask);
> +
> + if (cmask)
> + cpumask_copy(&tmask, cmask);
> + else
> + cpumask_copy(&tmask, cpu_online_mask);
> +
> + if (cpumask_test_cpu(cpuid, &tmask)) {
> + /* Save trap cost by issuing a local tlb flush here */
> + if ((start == 0 && size == -1) || (size > PAGE_SIZE))
> + local_flush_tlb_all();
> + else if (size == PAGE_SIZE)
> + local_flush_tlb_page(start);
> + cpumask_clear_cpu(cpuid, &tmask);
> + } else if (cpumask_empty(&tmask)) {
> + /* cpumask is empty. So just do a local flush */
> + local_flush_tlb_all();
> + return;
> + }
> +
> + if (!cpumask_empty(&tmask)) {
> + riscv_cpuid_to_hartid_mask(&tmask, &hmask);
> + sbi_remote_sfence_vma(hmask.bits, start, size);
> + }
> }
I think it's becoming too big to be inline.
Andreas.
--
Andreas Schwab, schwab@...ux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
Powered by blists - more mailing lists