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: <e6acf664-5ebd-4273-9330-cbec283ede23@cs-soprasteria.com>
Date: Thu, 22 Aug 2024 06:39:33 +0000
From: LEROY Christophe <christophe.leroy2@...soprasteria.com>
To: Christoph Hellwig <hch@....de>
CC: Christian Lamparter <christian.lamparter@....uni-stuttgart.de>, Benjamin
 Herrenschmidt <benh@...nel.crashing.org>, Paul Mackerras <paulus@...ba.org>,
	Michael Ellerman <mpe@...erman.id.au>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>, "linuxppc-dev@...ts.ozlabs.org"
	<linuxppc-dev@...ts.ozlabs.org>, Stan Johnson <userm57@...oo.com>, Finn Thain
	<fthain@...ux-m68k.org>
Subject: Re: [PATCH v2] powerpc: warn on emulation of dcbz instruction in
 kernel mode



Le 22/08/2024 à 07:32, Christoph Hellwig a écrit :
> On Thu, Aug 22, 2024 at 05:25:10AM +0000, LEROY Christophe wrote:
>>> and this results in a call to dma_direct_allocation(), which has one
>>> innocent looking memset():
>>
>>
>> memset() can't be used on non-cached memory, memset_io() has to be used
>> instead.
> 
> No, we use memset on uncached memory all the time.  Note that uncached
> memory != __iomem memory, for which you DO have to use memset_io.
> 

Then we have a subject here.

powerpc has a magic instruction 'dcbz' which clears a full cacheline in 
one go. It is far more efficient than a loop to store zeros, and since 
2015 memset(0) has been implemented with that instruction (commit 
5b2a32e80634 ("powerpc/32: memset(0): use cacheable_memzero"))

But that instruction generates an alignment exception when used on 
non-cached memory (whether it is RAM or not doesn't matter). It is then 
emulated by the kernel but it of course leads to a serious performance 
degradation, hence the warning added by commit cbe654c77961 ("powerpc: 
warn on emulation of dcbz instruction in kernel mode"). Until now it 
helped identify and fix use of memset() on IO memory.

But if memset() is expected to be used with non-cached RAM, then I don't 
know what to do. Any suggestion ?

Christophe

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ