From: Andreas Schwab <schwab@linux-m68k.org>
To: Atish Patra <atish.patra@wdc.com>
Cc: linux-kernel@vger.kernel.org, Albert Ou <aou@eecs.berkeley.edu>,
Alexios Zavras <alexios.zavras@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Palmer Dabbelt <palmer@sifive.com>,
Anup Patel <anup.patel@wdc.com>,
Paul Walmsley <paul.walmsley@sifive.com>,
linux-riscv@lists.infradead.org,
Allison Randal <allison@lohutok.net>
Subject: Re: [PATCH] RISC-V: Issue a local tlb flush if possible.
Date: Sat, 10 Aug 2019 08:37:21 +0200 [thread overview]
Message-ID: <m2r25t8r1a.fsf@linux-m68k.org> (raw)
In-Reply-To: <20190810014309.20838-1-atish.patra@wdc.com> (Atish Patra's message of "Fri, 9 Aug 2019 18:43:09 -0700")
On Aug 09 2019, Atish Patra <atish.patra@wdc.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@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
next prev parent reply other threads:[~2019-08-10 6:37 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-10 1:43 [PATCH] RISC-V: Issue a local tlb flush if possible Atish Patra
2019-08-10 3:30 ` Anup Patel
2019-08-10 5:28 ` Atish Patra
2019-08-10 6:37 ` Andreas Schwab [this message]
2019-08-10 9:21 ` Atish Patra
2019-08-12 14:56 ` Christoph Hellwig
2019-08-13 0:15 ` Atish Patra
2019-08-13 14:30 ` hch
2019-08-15 20:37 ` Atish Patra
2019-08-19 14:46 ` hch
2019-08-19 15:09 ` Anup Patel
2019-08-19 15:10 ` hch
2019-08-20 0:02 ` Atish Patra
2019-08-12 15:36 ` Troy Benjegerdes
2019-08-12 17:13 ` Atish Patra
2019-08-12 17:55 ` Christoph Hellwig
2019-08-13 18:25 ` Paul Walmsley
2019-08-14 1:49 ` Atish Patra
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2r25t8r1a.fsf@linux-m68k.org \
--to=schwab@linux-m68k.org \
--cc=alexios.zavras@intel.com \
--cc=allison@lohutok.net \
--cc=anup.patel@wdc.com \
--cc=aou@eecs.berkeley.edu \
--cc=atish.patra@wdc.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=palmer@sifive.com \
--cc=paul.walmsley@sifive.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).