linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers,crypto/cavium: Fix barrier barrier usage after atomic_set()
@ 2019-10-15 16:16 Davidlohr Bueso
  2019-10-16  1:51 ` Herbert Xu
  0 siblings, 1 reply; 2+ messages in thread
From: Davidlohr Bueso @ 2019-10-15 16:16 UTC (permalink / raw)
  To: herbert; +Cc: linux-crypto, linux-kernel, dave, Davidlohr Bueso

Because it is not a Rmw operation, atomic_set() is not serialized,
and therefore the 'upgradable' smp_mb__after_atomic() call after
the atomic_set() is completely bogus (not to mention the comment
could also use some love, but that's a different matter).

This patch replaces these with smp_mb(), which seems like the
original intent of when the code was written.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
 drivers/crypto/cavium/nitrox/nitrox_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/cavium/nitrox/nitrox_main.c b/drivers/crypto/cavium/nitrox/nitrox_main.c
index bc924980e10c..da2e0edceb50 100644
--- a/drivers/crypto/cavium/nitrox/nitrox_main.c
+++ b/drivers/crypto/cavium/nitrox/nitrox_main.c
@@ -504,7 +504,7 @@ static int nitrox_probe(struct pci_dev *pdev,
 
 	atomic_set(&ndev->state, __NDEV_READY);
 	/* barrier to sync with other cpus */
-	smp_mb__after_atomic();
+	smp_mb();
 
 	err = nitrox_crypto_register();
 	if (err)
@@ -551,7 +551,7 @@ static void nitrox_remove(struct pci_dev *pdev)
 
 	atomic_set(&ndev->state, __NDEV_NOT_READY);
 	/* barrier to sync with other cpus */
-	smp_mb__after_atomic();
+	smp_mb();
 
 	nitrox_remove_from_devlist(ndev);
 
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] drivers,crypto/cavium: Fix barrier barrier usage after atomic_set()
  2019-10-15 16:16 [PATCH] drivers,crypto/cavium: Fix barrier barrier usage after atomic_set() Davidlohr Bueso
@ 2019-10-16  1:51 ` Herbert Xu
  0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2019-10-16  1:51 UTC (permalink / raw)
  To: Davidlohr Bueso; +Cc: linux-crypto, linux-kernel, Davidlohr Bueso

On Tue, Oct 15, 2019 at 09:16:57AM -0700, Davidlohr Bueso wrote:
> Because it is not a Rmw operation, atomic_set() is not serialized,
> and therefore the 'upgradable' smp_mb__after_atomic() call after
> the atomic_set() is completely bogus (not to mention the comment
> could also use some love, but that's a different matter).
> 
> This patch replaces these with smp_mb(), which seems like the
> original intent of when the code was written.
> 
> Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
> ---
>  drivers/crypto/cavium/nitrox/nitrox_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

So what does this actually synchronise against?

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-16  1:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-15 16:16 [PATCH] drivers,crypto/cavium: Fix barrier barrier usage after atomic_set() Davidlohr Bueso
2019-10-16  1:51 ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).