[PATCH] KEYS: Invert FINAL_PUT bit

2025-05-03 Thread Herbert Xu
On Sun, May 04, 2025 at 08:35:57AM +0800, Herbert Xu wrote: > > Or even better, reverse the FINAL_PUT bit and call it ALIVE, so > that you can use test_bit_acquire and clear_bit_unlock. Something like: ---8<--- Invert the FINAL_PUT bit so that test_bit_acquire and clear_bit_unlock can be used in

Re: [PATCH] KEYS: Reduce smp_mb() calls in key_put()

2025-05-03 Thread Herbert Xu
On Sat, May 03, 2025 at 11:19:21PM +0100, David Howells wrote: > > Possibly we only need smp_mb() in the IN_QUOTA branch in key_put(). Just change the smp_mb to smp_mb__before_atomic, at least on x86 it just disappears because set_bit is already a serialising operation. Or even better, reverse th

Re: [PATCH] KEYS: Reduce smp_mb() calls in key_put()

2025-05-03 Thread David Howells
Jarkko Sakkinen wrote: > Oops, my bad (order swap), sorry. Should have been: > > spin_unlock_irqrestore(&key->user->lock, flags); > } else { > smp_mb(); /* key->user before FINAL_PUT set. */ >

[PATCH 1/2] crypto: hisilicon/qm - remove sizeof(char)

2025-05-03 Thread Ethan Carter Edwards
`sizeof(char)` evaluates to 1. Remove the churn. Signed-off-by: Ethan Carter Edwards --- drivers/crypto/hisilicon/qm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/hisilicon/qm.c b/drivers/crypto/hisilicon/qm.c index d3f5d108b898bb5fa6ef901070e9e97b02afb29a

[PATCH 0/2] crypto: hisilicon/qm - memory allocation cleanups

2025-05-03 Thread Ethan Carter Edwards
: hisilicon/qm - remove sizeof(char) crypto: hisilicon/qm - replace devm_kzalloc with devm_kcalloc drivers/crypto/hisilicon/qm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- base-commit: 37ff6e9a2ce321b7932d3987701757fb4d87b0e6 change-id: 20250503-hisilicon_qm-7b581a9b3799 Best

[PATCH 2/2] crypto: hisilicon/qm - replace devm_kzalloc with devm_kcalloc

2025-05-03 Thread Ethan Carter Edwards
Replace devm_kzalloc that has an internal multiplication with devm_kcalloc to improve code readability and safety from overflows. Signed-off-by: Ethan Carter Edwards --- drivers/crypto/hisilicon/qm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/crypto/hisilicon/qm.

Re: [PATCH] KEYS: Reduce smp_mb() calls in key_put()

2025-05-03 Thread Herbert Xu
On Sat, May 03, 2025 at 05:39:16PM +0300, Jarkko Sakkinen wrote: > On Wed, Apr 30, 2025 at 06:25:53PM +0300, Jarkko Sakkinen wrote: > > Rely only on the memory ordering of spin_unlock() when setting > > KEY_FLAG_FINAL_PUT under key->user->lock in key_put(). > > > > Signed-off-by: Jarkko Sakkinen

Re: [PATCH] KEYS: Reduce smp_mb() calls in key_put()

2025-05-03 Thread Jarkko Sakkinen
On Wed, Apr 30, 2025 at 06:25:53PM +0300, Jarkko Sakkinen wrote: > Rely only on the memory ordering of spin_unlock() when setting > KEY_FLAG_FINAL_PUT under key->user->lock in key_put(). > > Signed-off-by: Jarkko Sakkinen > --- > security/keys/key.c | 6 -- > 1 file changed, 4 insertions(+),