lkml.org 
[lkml]   [2019]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH] RISC-V: Issue a local tlb flush if possible.
Date
On Mon, 2019-08-12 at 07:56 -0700, Christoph Hellwig wrote:
> I agree with the comment that we really should move this out of line
> now, and

sure.

> also that we can simplify it further, which also includes
> not bothering with the SBI call if we were the only online CPU.

I already had that optimization in my patch.

> I also thing we need to use get_cpu/put_cpu to be preemption safe.
>
ok. I will update that.

> Also why would we need to do a local flush if we have a mask that
> doesn't include the local CPU?
>

I thought if it recieves an empty cpumask, then it should at least do a
local flush is the expected behavior. Are you saying that we should
just skip all and return ?


> How about something like:
>
> void __riscv_flush_tlb(struct cpumask *cpumask, unsigned long start,
> unsigned long size)
> {
> unsigned int cpu;
>
> if (!cpumask)
> cpumask = cpu_online_mask;
>
> cpu = get_cpu();
> if (!cpumask || cpumask_test_cpu(cpu, cpumask) {
> 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, cpumask);

This will modify the original cpumask which is not correct. clear part
has to be done on hmask to avoid a copy.

Regards,
Atish
> }
>
> if (!cpumask_empty(cpumask)) {
> struct cpumask hmask;
>
> riscv_cpuid_to_hartid_mask(cpumask, &hmask);
> sbi_remote_sfence_vma(hmask.bits, start, size);
> }
> put_cpu();
> }

\
 
 \ /
  Last update: 2019-08-13 02:16    [W:0.113 / U:0.080 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site