* [PATCH v2] driver: crypto: caam: replace this_cpu_ptr with raw_cpu_ptr
@ 2021-11-01 3:13 Meng Li
2021-11-15 2:54 ` Li, Meng
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Meng Li @ 2021-11-01 3:13 UTC (permalink / raw)
To: horia.geanta, pankaj.gupta, herbert, davem
Cc: linux-crypto, linux-kernel, meng.li
When enable the kernel debug config, there is below calltrace detected:
BUG: using smp_processor_id() in preemptible [00000000] code: cryptomgr_test/339
caller is debug_smp_processor_id+0x20/0x30
CPU: 9 PID: 339 Comm: cryptomgr_test Not tainted 5.10.63-yocto-standard #1
Hardware name: NXP Layerscape LX2160ARDB (DT)
Call trace:
dump_backtrace+0x0/0x1a0
show_stack+0x24/0x30
dump_stack+0xf0/0x13c
check_preemption_disabled+0x100/0x110
debug_smp_processor_id+0x20/0x30
dpaa2_caam_enqueue+0x10c/0x25c
......
cryptomgr_test+0x38/0x60
kthread+0x158/0x164
ret_from_fork+0x10/0x38
According to the comment in commit ac5d15b4519f("crypto: caam/qi2
- use affine DPIOs "), because preemption is no longer disabled
while trying to enqueue an FQID, it might be possible to run the
enqueue on a different CPU(due to migration, when in process context),
however this wouldn't be a functionality issue. But there will be
above calltrace when enable kernel debug config. So, replace this_cpu_ptr
with raw_cpu_ptr to avoid above call trace.
Fixes: ac5d15b4519f ("crypto: caam/qi2 - use affine DPIOs")
Cc: stable@vger.kernel.org
Signed-off-by: Meng Li <Meng.Li@windriver.com>
---
v2:
Add comment to describe why the raw_cpu_ptr is safe.
drivers/crypto/caam/caamalg_qi2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/crypto/caam/caamalg_qi2.c b/drivers/crypto/caam/caamalg_qi2.c
index 8b8ed77d8715..6753f0e6e55d 100644
--- a/drivers/crypto/caam/caamalg_qi2.c
+++ b/drivers/crypto/caam/caamalg_qi2.c
@@ -5470,7 +5470,7 @@ int dpaa2_caam_enqueue(struct device *dev, struct caam_request *req)
dpaa2_fd_set_len(&fd, dpaa2_fl_get_len(&req->fd_flt[1]));
dpaa2_fd_set_flc(&fd, req->flc_dma);
- ppriv = this_cpu_ptr(priv->ppriv);
+ ppriv = raw_cpu_ptr(priv->ppriv);
for (i = 0; i < (priv->dpseci_attr.num_tx_queues << 1); i++) {
err = dpaa2_io_service_enqueue_fq(ppriv->dpio, ppriv->req_fqid,
&fd);
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH v2] driver: crypto: caam: replace this_cpu_ptr with raw_cpu_ptr
2021-11-01 3:13 [PATCH v2] driver: crypto: caam: replace this_cpu_ptr with raw_cpu_ptr Meng Li
@ 2021-11-15 2:54 ` Li, Meng
2021-11-18 8:21 ` Horia Geantă
2021-11-20 4:27 ` Herbert Xu
2 siblings, 0 replies; 4+ messages in thread
From: Li, Meng @ 2021-11-15 2:54 UTC (permalink / raw)
To: horia.geanta, pankaj.gupta, herbert, davem; +Cc: linux-crypto, linux-kernel
Is there any comments about this patch?
Thanks,
Limeng
> -----Original Message-----
> From: Li, Meng <Meng.Li@windriver.com>
> Sent: Monday, November 1, 2021 11:14 AM
> To: horia.geanta@nxp.com; pankaj.gupta@nxp.com;
> herbert@gondor.apana.org.au; davem@davemloft.net
> Cc: linux-crypto@vger.kernel.org; linux-kernel@vger.kernel.org; Li, Meng
> <Meng.Li@windriver.com>
> Subject: [PATCH v2] driver: crypto: caam: replace this_cpu_ptr with
> raw_cpu_ptr
>
> When enable the kernel debug config, there is below calltrace detected:
> BUG: using smp_processor_id() in preemptible [00000000] code:
> cryptomgr_test/339 caller is debug_smp_processor_id+0x20/0x30
> CPU: 9 PID: 339 Comm: cryptomgr_test Not tainted 5.10.63-yocto-standard
> #1 Hardware name: NXP Layerscape LX2160ARDB (DT) Call trace:
> dump_backtrace+0x0/0x1a0
> show_stack+0x24/0x30
> dump_stack+0xf0/0x13c
> check_preemption_disabled+0x100/0x110
> debug_smp_processor_id+0x20/0x30
> dpaa2_caam_enqueue+0x10c/0x25c
> ......
> cryptomgr_test+0x38/0x60
> kthread+0x158/0x164
> ret_from_fork+0x10/0x38
> According to the comment in commit ac5d15b4519f("crypto: caam/qi2
> - use affine DPIOs "), because preemption is no longer disabled while trying
> to enqueue an FQID, it might be possible to run the enqueue on a different
> CPU(due to migration, when in process context), however this wouldn't be a
> functionality issue. But there will be above calltrace when enable kernel
> debug config. So, replace this_cpu_ptr with raw_cpu_ptr to avoid above call
> trace.
>
> Fixes: ac5d15b4519f ("crypto: caam/qi2 - use affine DPIOs")
> Cc: stable@vger.kernel.org
> Signed-off-by: Meng Li <Meng.Li@windriver.com>
> ---
> v2:
>
> Add comment to describe why the raw_cpu_ptr is safe.
> drivers/crypto/caam/caamalg_qi2.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/caam/caamalg_qi2.c
> b/drivers/crypto/caam/caamalg_qi2.c
> index 8b8ed77d8715..6753f0e6e55d 100644
> --- a/drivers/crypto/caam/caamalg_qi2.c
> +++ b/drivers/crypto/caam/caamalg_qi2.c
> @@ -5470,7 +5470,7 @@ int dpaa2_caam_enqueue(struct device *dev,
> struct caam_request *req)
> dpaa2_fd_set_len(&fd, dpaa2_fl_get_len(&req->fd_flt[1]));
> dpaa2_fd_set_flc(&fd, req->flc_dma);
>
> - ppriv = this_cpu_ptr(priv->ppriv);
> + ppriv = raw_cpu_ptr(priv->ppriv);
> for (i = 0; i < (priv->dpseci_attr.num_tx_queues << 1); i++) {
> err = dpaa2_io_service_enqueue_fq(ppriv->dpio, ppriv-
> >req_fqid,
> &fd);
> --
> 2.17.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] driver: crypto: caam: replace this_cpu_ptr with raw_cpu_ptr
2021-11-01 3:13 [PATCH v2] driver: crypto: caam: replace this_cpu_ptr with raw_cpu_ptr Meng Li
2021-11-15 2:54 ` Li, Meng
@ 2021-11-18 8:21 ` Horia Geantă
2021-11-20 4:27 ` Herbert Xu
2 siblings, 0 replies; 4+ messages in thread
From: Horia Geantă @ 2021-11-18 8:21 UTC (permalink / raw)
To: Meng Li, Pankaj Gupta, herbert, davem; +Cc: linux-crypto, linux-kernel
On 11/1/2021 5:14 AM, Meng Li wrote:
> When enable the kernel debug config, there is below calltrace detected:
> BUG: using smp_processor_id() in preemptible [00000000] code: cryptomgr_test/339
> caller is debug_smp_processor_id+0x20/0x30
> CPU: 9 PID: 339 Comm: cryptomgr_test Not tainted 5.10.63-yocto-standard #1
> Hardware name: NXP Layerscape LX2160ARDB (DT)
> Call trace:
> dump_backtrace+0x0/0x1a0
> show_stack+0x24/0x30
> dump_stack+0xf0/0x13c
> check_preemption_disabled+0x100/0x110
> debug_smp_processor_id+0x20/0x30
> dpaa2_caam_enqueue+0x10c/0x25c
> ......
> cryptomgr_test+0x38/0x60
> kthread+0x158/0x164
> ret_from_fork+0x10/0x38
> According to the comment in commit ac5d15b4519f("crypto: caam/qi2
> - use affine DPIOs "), because preemption is no longer disabled
> while trying to enqueue an FQID, it might be possible to run the
> enqueue on a different CPU(due to migration, when in process context),
> however this wouldn't be a functionality issue. But there will be
> above calltrace when enable kernel debug config. So, replace this_cpu_ptr
> with raw_cpu_ptr to avoid above call trace.
>
> Fixes: ac5d15b4519f ("crypto: caam/qi2 - use affine DPIOs")
> Cc: stable@vger.kernel.org
> Signed-off-by: Meng Li <Meng.Li@windriver.com>
Reviewed-by: Horia Geantă <horia.geanta@nxp.com>
Thanks,
Horia
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] driver: crypto: caam: replace this_cpu_ptr with raw_cpu_ptr
2021-11-01 3:13 [PATCH v2] driver: crypto: caam: replace this_cpu_ptr with raw_cpu_ptr Meng Li
2021-11-15 2:54 ` Li, Meng
2021-11-18 8:21 ` Horia Geantă
@ 2021-11-20 4:27 ` Herbert Xu
2 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2021-11-20 4:27 UTC (permalink / raw)
To: Meng Li; +Cc: horia.geanta, pankaj.gupta, davem, linux-crypto, linux-kernel
On Mon, Nov 01, 2021 at 11:13:53AM +0800, Meng Li wrote:
> When enable the kernel debug config, there is below calltrace detected:
> BUG: using smp_processor_id() in preemptible [00000000] code: cryptomgr_test/339
> caller is debug_smp_processor_id+0x20/0x30
> CPU: 9 PID: 339 Comm: cryptomgr_test Not tainted 5.10.63-yocto-standard #1
> Hardware name: NXP Layerscape LX2160ARDB (DT)
> Call trace:
> dump_backtrace+0x0/0x1a0
> show_stack+0x24/0x30
> dump_stack+0xf0/0x13c
> check_preemption_disabled+0x100/0x110
> debug_smp_processor_id+0x20/0x30
> dpaa2_caam_enqueue+0x10c/0x25c
> ......
> cryptomgr_test+0x38/0x60
> kthread+0x158/0x164
> ret_from_fork+0x10/0x38
> According to the comment in commit ac5d15b4519f("crypto: caam/qi2
> - use affine DPIOs "), because preemption is no longer disabled
> while trying to enqueue an FQID, it might be possible to run the
> enqueue on a different CPU(due to migration, when in process context),
> however this wouldn't be a functionality issue. But there will be
> above calltrace when enable kernel debug config. So, replace this_cpu_ptr
> with raw_cpu_ptr to avoid above call trace.
>
> Fixes: ac5d15b4519f ("crypto: caam/qi2 - use affine DPIOs")
> Cc: stable@vger.kernel.org
> Signed-off-by: Meng Li <Meng.Li@windriver.com>
> ---
> v2:
>
> Add comment to describe why the raw_cpu_ptr is safe.
> drivers/crypto/caam/caamalg_qi2.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Patch applied. Thanks.
--
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] 4+ messages in thread
end of thread, other threads:[~2021-11-20 4:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-01 3:13 [PATCH v2] driver: crypto: caam: replace this_cpu_ptr with raw_cpu_ptr Meng Li
2021-11-15 2:54 ` Li, Meng
2021-11-18 8:21 ` Horia Geantă
2021-11-20 4:27 ` 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).