crypto: completion should be ran with BH disabled
Subsystems (7)
Corentin Labbe
maintainercover crypto: completion should be ran with BH disabled
Hello
This is the follow up of https://lore.kernel.org/lkml/Yd1SIHUNdLIvKhzz@Red/
and https://patchwork.kernel.org/project/linux-crypto/patch/[email protected]/
This serie fix all drivers which do not call completion with BH disabled
and add the check in crypto/engine asked by Herbert.
I have verified that this check does not generate warnings on all other crypto
hardware I got (omap, ccree, rockchip)
Regards
Corentin Labbe (5):
crypto: sun8i-ss: call finalize with bh disabled
crypto: sun8i-ce: call finalize with bh disabled
crypto: amlogic: call finalize with bh disabled
crypto: gemini: call finalize with bh disabled
crypto: engine: check if BH is disabled during completion
crypto/crypto_engine.c | 1 + drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c | 3 +++ drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c | 3 +++ drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 3 +++ drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c | 3 +++ drivers/crypto/amlogic/amlogic-gxl-cipher.c | 2 ++ drivers/crypto/gemini/sl3516-ce-cipher.c | 2 ++ 7 files changed, 17 insertions(+)
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH 1/5 crypto: sun8i-ss: call finalize with bh disabled
Doing ipsec produces a spinlock recursion warning.
This is due to not disabling BH during crypto completion function.
--- drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 3 +++ drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c +3 -0
@@ -11,6 +11,7 @@* You could find a link for the datasheet in Documentation/arm/sunxi.rst */ +#include <linux/bottom_half.h> #include <linux/crypto.h> #include <linux/dma-mapping.h> #include <linux/io.h>
@@ -274,7 +275,9 @@ static int sun8i_ss_handle_cipher_request(struct crypto_engine *engine, void *ar struct skcipher_request *breq = container_of(areq, struct skcipher_request, base); err =sun8i_ss_cipher (breq); +local_bh_disable ();crypto_finalize_skcipher_request (engine, breq, err); +local_bh_enable ();return 0 ; }
drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c +3 -0
@@ -9,6 +9,7 @@* * You could find the datasheet in Documentation/arm/sunxi.rst */ +#include <linux/bottom_half.h> #include <linux/dma-mapping.h> #include <linux/pm_runtime.h> #include <linux/scatterlist.h>
@@ -633,6 +634,8 @@ int sun8i_ss_hash_run(struct crypto_engine *engine, void *breq)memcpy (areq->result, result, algt->alg.hash.halg.digestsize); theend: +local_bh_disable ();crypto_finalize_hash_request (engine, breq, err); +local_bh_enable ();return 0 ; }
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH 2/5 crypto: sun8i-ce: call finalize with bh disabled
In reply to Corentin LabbeDoing ipsec produces a spinlock recursion warning.
This is due to not disabling BH during crypto completion function.
--- drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c | 3 +++ drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c +3 -0
@@ -11,6 +11,7 @@* You could find a link for the datasheet in Documentation/arm/sunxi.rst */ +#include <linux/bottom_half.h> #include <linux/crypto.h> #include <linux/dma-mapping.h> #include <linux/io.h>
@@ -272,7 +273,9 @@ static int sun8i_ce_cipher_run(struct crypto_engine *engine, void *areq) flow = rctx->flow; err =sun8i_ce_run_task (ce, flow,crypto_tfm_alg_name (breq->base.tfm)); +local_bh_disable ();crypto_finalize_skcipher_request (engine, breq, err); +local_bh_enable ();return 0 ; }
drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c +3 -0
@@ -9,6 +9,7 @@* * You could find the datasheet in Documentation/arm/sunxi.rst */ +#include <linux/bottom_half.h> #include <linux/dma-mapping.h> #include <linux/pm_runtime.h> #include <linux/scatterlist.h>
@@ -472,6 +473,8 @@ int sun8i_ce_hash_run(struct crypto_engine *engine, void *breq) theend:kfree (buf);kfree (result); +local_bh_disable ();crypto_finalize_hash_request (engine, breq, err); +local_bh_enable ();return 0 ; }
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH 3/5 crypto: amlogic: call finalize with bh disabled
In reply to Corentin LabbeDoing ipsec produces a spinlock recursion warning.
This is due to not disabling BH during crypto completion function.
--- drivers/crypto/amlogic/amlogic-gxl-cipher.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/crypto/amlogic/amlogic-gxl-cipher.c +2 -0
@@ -265,7 +265,9 @@ static int meson_handle_cipher_request(struct crypto_engine *engine, struct skcipher_request *breq = container_of(areq, struct skcipher_request, base); err =meson_cipher (breq); +local_bh_disable ();crypto_finalize_skcipher_request (engine, breq, err); +local_bh_enable ();return 0 ; }
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH 4/5 crypto: gemini: call finalize with bh disabled
In reply to Corentin LabbeDoing ipsec produces a spinlock recursion warning.
This is due to not disabling BH during crypto completion function.
--- drivers/crypto/gemini/sl3516-ce-cipher.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/crypto/gemini/sl3516-ce-cipher.c +2 -0
@@ -264,7 +264,9 @@ static int sl3516_ce_handle_cipher_request(struct crypto_engine *engine, void *a struct skcipher_request *breq = container_of(areq, struct skcipher_request, base); err =sl3516_ce_cipher (breq); +local_bh_disable ();crypto_finalize_skcipher_request (engine, breq, err); +local_bh_enable ();return 0 ; }
Signature · 1 line
2.34.1
Corentin Labbe
maintainerPATCH 5/5 crypto: engine: check if BH is disabled during completion
In reply to Corentin LabbeWhen doing iperf over ipsec with crypto hardware sun8i-ce, I hit some spinlock recursion bug.
This is due to completion function called with enabled BH.
Add check a to detect this.
--- crypto/crypto_engine.c | 1 + 1 file changed, 1 insertion(+)
crypto/crypto_engine.c +1 -0
@@ -53,6 +53,7 @@ static void crypto_finalize_request(struct crypto_engine *engine,dev_err (engine->dev,"failed to unprepare request\n" ); } } +lockdep_assert_in_softirq (); req->complete (req, err);kthread_queue_work (engine->kworker, &engine->pump_requests);
Signature · 1 line
2.34.1
Herbert Xu
maintainerQuoted 18 lines · Corentin Labbe
Hello
This is the follow up of https://lore.kernel.org/lkml/Yd1SIHUNdLIvKhzz@Red/
and https://patchwork.kernel.org/project/linux-crypto/patch/[email protected]/
This serie fix all drivers which do not call completion with BH disabled
and add the check incrypto/engineasked by Herbert.
I have verified that this check does not generate warnings on all other crypto
hardware I got (omap, ccree, rockchip)Regards
Corentin Labbe (5):
crypto: sun8i-ss: call finalize with bh disabled
crypto: sun8i-ce: call finalize with bh disabled
crypto: amlogic: call finalize with bh disabled
crypto: gemini: call finalize with bh disabled
crypto: engine: check if BH is disabled during completion
Quoted 8 lines
crypto/crypto_engine.c | 1 + drivers/crypto/allwinner/sun8i-ce/sun8i-ce-cipher.c | 3 +++ drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c | 3 +++ drivers/crypto/allwinner/sun8i-ss/sun8i-ss-cipher.c | 3 +++ drivers/crypto/allwinner/sun8i-ss/sun8i-ss-hash.c | 3 +++ drivers/crypto/amlogic/amlogic-gxl-cipher.c | 2 ++ drivers/crypto/gemini/sl3516-ce-cipher.c | 2 ++ 7 files changed, 17 insertions(+)
All applied. Thanks.
Signature · 8 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt _______________________________________________ linux-amlogic mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-amlogic