Re: [PATCH 6/7] powerpc/uaccess: Add unsafe_clear_user()

From: Christophe Leroy
Date: Tue Jun 15 2021 - 03:11:10 EST




Le 15/06/2021 à 08:53, Christoph Hellwig a écrit :
On Tue, Jun 15, 2021 at 06:41:02AM +0000, Christophe Leroy wrote:
Implement unsafe_clear_user() for powerpc.
It's a copy/paste of unsafe_copy_to_user() with value 0 as source.

It may be improved in a later patch by using 'dcbz' instruction
to zeroize full cache lines at once.

Please add this to common code insted of making it powerpc specific.


A common version is added in previous patch.

Just like unsafe_copy_to_user(), unsafe_clear_user() needs to be arch defined.

unsafe_copy_to_user() has both an x86 implementation and a powerpc implementation, why do different ?

I can't see how it could be not powerpc specific. At the end we want to use 'dcbz' to zeroize full cachelines at once, even if at the time being that's a simple write of 0.