Skip to contentSkip to conversation

drivers,crypto/cavium: Fix barrier barrier usage after atomic_set()

PATCH In review Davidlohr Bueso 2 participants 2 messages Oct 15, 2019 – Oct 16, 2019 Crypto API

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers,crypto/cavium: Fix barrier barrier usage after atomic_set()

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.

---
 drivers/crypto/cavium/nitrox/nitrox_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/crypto/cavium/nitrox/nitrox_main.c +2 -2
index bc924980e10c..da2e0edceb50 100644
@@ -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);
 
Signature · 1 line
2.16.4
maintainer
#1 lore raw
Quoted 5 lines · 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).

Quoted 7 lines

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

---
 drivers/crypto/cavium/nitrox/nitrox_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

So what does this actually synchronise against?

Cheers,

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt