[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c8127b03-245b-4eaa-98f5-6e14df094669@cs-soprasteria.com>
Date: Sat, 24 Aug 2024 09:01:33 +0000
From: LEROY Christophe <christophe.leroy2@...soprasteria.com>
To: Segher Boessenkool <segher@...nel.crashing.org>, 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 23/08/2024 à 21:19, Segher Boessenkool a écrit :
> ***ATTENTION, Sopra Steria Group cannot confirm the identity of this email sender (SPF record failure). This might be a fake email from an attacker, if you have any doubts report and delete the email.***
>
> ***ATTENTION, Sopra Steria Group ne peut pas confirmer l’identité de l’émetteur de ce message (SPF record failure). Il pourrait s’agir d’un faux message, à détruire si vous avez un doute ***
>
> Hi!
>
> On Fri, Aug 23, 2024 at 03:54:59PM +0200, Christoph Hellwig wrote:
>> On Fri, Aug 23, 2024 at 08:06:00AM -0500, Segher Boessenkool wrote:
>>> What does "uncached memory" even mean here? Literally it would be
>>> I=1 memory (uncachEABLE memory), but more likely you want M=0 memory
>>> here ("non-memory memory", "not well-behaved memory", MMIO often).
>>
>> Regular kernel memory vmapped with pgprot_noncached().
>
> So, I=1 (and G=1). Caching inhibited and guarded. But M=1 (memory
> coherence required) as with any other real memory :-)
>
>>> If memset() is expected to be used with M=0, you cannot do any serious
>>> optimisations to it at all. If memset() is expected to be used with I=1
>>> it should use a separate code path for it, probably the caller should
>>> make the distinction.
>>
>> DMA coherent memory which uses uncached memory for platforms that
>> do not provide hardware dma coherence can end up just about anywhere
>> in the kernel. We could use special routines for a few places in
>> the DMA subsystem, but there might be plenty of others.
>
> Yeah. It will just be plenty slow, as we see here, that's what the
> warning is for; but it works just fine :-)
>
> The memset() code itself could chech for the storage attributes, but
> that is probably more expensive than just assuming the happy case.
> Maybe someone could try it out though!
But is it only memset() the problem ?
dcbz instruction is also used in:
- memcpy()
- csum_partial_copy_generic()
- clear_page()
- copy_page()
- clear_user()
- copy_to_user()
- copy_from_user()
Are these functions also used on DMA coherent memory ?
Christophe
Powered by blists - more mailing lists