lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f58814e156b918531f058acfac944abef34f5fb1.camel@wdc.com>
Date:   Tue, 13 Aug 2019 00:15:15 +0000
From:   Atish Patra <Atish.Patra@....com>
To:     "hch@...radead.org" <hch@...radead.org>
CC:     "linux-riscv@...ts.infradead.org" <linux-riscv@...ts.infradead.org>,
        Anup Patel <Anup.Patel@....com>,
        "gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
        "paul.walmsley@...ive.com" <paul.walmsley@...ive.com>,
        "aou@...s.berkeley.edu" <aou@...s.berkeley.edu>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "allison@...utok.net" <allison@...utok.net>,
        "alexios.zavras@...el.com" <alexios.zavras@...el.com>,
        "palmer@...ive.com" <palmer@...ive.com>
Subject: Re: [PATCH] RISC-V: Issue a local tlb flush if possible.

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();
> }

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ