Re: [PATCH] driver: crypto: caam: instead this_cpu_ptr with raw_cpu_ptr

From: Herbert Xu
Date: Fri Oct 29 2021 - 08:31:25 EST


On Tue, Oct 19, 2021 at 02:37:19PM +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 "), it doesn't matter whether preemption is
> disable or not. So, only instead this_cpu_ptr with raw_cpu_ptr to
> avoid above call trace.

Please put the reason why raw is safe into a comment in the code.
Readers shouldn't need to run git whatschanged to figure out why
this is safe.

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