From 5ddfed134623a0d7dc7fb15d68c0ae9b5a977b44 Mon Sep 17 00:00:00 2001 From: Yongxin Liu Date: Mon, 7 Dec 2020 14:32:08 +0800 Subject: qat17: silence smp_processor_id() warning Fix the following call trace by backporting patch from mainline kernel. BUG: using smp_processor_id() in preemptible [00000000] code: modprobe/956 caller is debug_smp_processor_id+0x17/0x20 CPU: 19 PID: 956 Comm: modprobe Tainted: G IO 5.10.0-rc4-yoctodev-standard #1 Hardware name: Intel Corporation S2600WFS/S2600WFS, BIOS SE5C620.86B.01.00.0694.120620170818 12/06/2017 Call Trace: dump_stack+0x60/0x76 check_preemption_disabled+0xc4/0xd0 debug_smp_processor_id+0x17/0x20 qat_rsa_init_tfm+0x1b/0x60 [intel_qat] crypto_akcipher_init_tfm+0x2c/0x30 crypto_create_tfm_node+0x5f/0x110 crypto_spawn_tfm2+0x34/0x60 pkcs1pad_init_tfm+0x1d/0x40 crypto_akcipher_init_tfm+0x2c/0x30 crypto_create_tfm_node+0x5f/0x110 crypto_alloc_tfm_node+0x6c/0xd0 crypto_alloc_akcipher+0x1f/0x30 public_key_verify_signature+0x7b/0x3e0 ? sha256_update+0x65/0xe0 ? sha256_final+0x65/0xb0 ? crypto_shash_finup+0x2c/0x90 ? __kmalloc+0x5c/0x550 x509_check_for_self_signed+0xad/0x100 x509_cert_parse+0x1aa/0x200 x509_key_preparse+0x26/0x1f0 asymmetric_key_preparse+0x50/0x80 key_create_or_update+0x1d0/0x520 regulatory_init+0x17d/0x265 [cfg80211] cfg80211_init+0x6b/0xd4 [cfg80211] ? 0xffffffffc131b000 do_one_initcall+0x51/0x210 ? kmem_cache_alloc_trace+0x32/0x500 do_init_module+0x62/0x270 load_module+0x268e/0x2850 __do_sys_finit_module+0xb1/0xf0 __x64_sys_finit_module+0x1a/0x20 do_syscall_64+0x38/0x50 entry_SYSCALL_64_after_hwframe+0x44/0xa9 Signed-off-by: Yongxin Liu Signed-off-by: Anuj Mittal --- ...ypto-qat-Silence-smp_processor_id-warning.patch | 72 ++++++++++++++++++++++ recipes-extended/qat/qat17_4.7.0-00006.bb | 1 + 2 files changed, 73 insertions(+) create mode 100644 recipes-extended/qat/files/qat17_4.7.0-00006-crypto-qat-Silence-smp_processor_id-warning.patch diff --git a/recipes-extended/qat/files/qat17_4.7.0-00006-crypto-qat-Silence-smp_processor_id-warning.patch b/recipes-extended/qat/files/qat17_4.7.0-00006-crypto-qat-Silence-smp_processor_id-warning.patch new file mode 100644 index 0000000..262651f --- /dev/null +++ b/recipes-extended/qat/files/qat17_4.7.0-00006-crypto-qat-Silence-smp_processor_id-warning.patch @@ -0,0 +1,72 @@ +From 21b67ec634271aafd73cffb3e73c0ba494dce3cd Mon Sep 17 00:00:00 2001 +From: Alexander Sverdlin +Date: Tue, 23 Jul 2019 07:24:01 +0000 +Subject: [PATCH] crypto: qat - Silence smp_processor_id() warning + +It seems that smp_processor_id() is only used for a best-effort +load-balancing, refer to qat_crypto_get_instance_node(). It's not feasible +to disable preemption for the duration of the crypto requests. Therefore, +just silence the warning. This commit is similar to e7a9b05ca4 +("crypto: cavium - Fix smp_processor_id() warnings"). + +Silences the following splat: +BUG: using smp_processor_id() in preemptible [00000000] code: cryptomgr_test/2904 +caller is qat_alg_ablkcipher_setkey+0x300/0x4a0 [intel_qat] +CPU: 1 PID: 2904 Comm: cryptomgr_test Tainted: P O 4.14.69 #1 +... +Call Trace: + dump_stack+0x5f/0x86 + check_preemption_disabled+0xd3/0xe0 + qat_alg_ablkcipher_setkey+0x300/0x4a0 [intel_qat] + skcipher_setkey_ablkcipher+0x2b/0x40 + __test_skcipher+0x1f3/0xb20 + ? cpumask_next_and+0x26/0x40 + ? find_busiest_group+0x10e/0x9d0 + ? preempt_count_add+0x49/0xa0 + ? try_module_get+0x61/0xf0 + ? crypto_mod_get+0x15/0x30 + ? __kmalloc+0x1df/0x1f0 + ? __crypto_alloc_tfm+0x116/0x180 + ? crypto_skcipher_init_tfm+0xa6/0x180 + ? crypto_create_tfm+0x4b/0xf0 + test_skcipher+0x21/0xa0 + alg_test_skcipher+0x3f/0xa0 + alg_test.part.6+0x126/0x2a0 + ? finish_task_switch+0x21b/0x260 + ? __schedule+0x1e9/0x800 + ? __wake_up_common+0x8d/0x140 + cryptomgr_test+0x40/0x50 + kthread+0xff/0x130 + ? cryptomgr_notify+0x540/0x540 + ? kthread_create_on_node+0x70/0x70 + ret_from_fork+0x24/0x50 + +Fixes: ed8ccaef52 ("crypto: qat - Add support for SRIOV") +Cc: stable@vger.kernel.org +Signed-off-by: Alexander Sverdlin +Signed-off-by: Herbert Xu + +Upstream-Status: Backport +[https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1b82feb6c5e1996513d0fb0bbb475417088b4954] + +Signed-off-by: Yongxin Liu +--- + quickassist/qat/drivers/crypto/qat/qat_common/adf_common_drv.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/quickassist/qat/drivers/crypto/qat/qat_common/adf_common_drv.h b/quickassist/qat/drivers/crypto/qat/qat_common/adf_common_drv.h +index 08e3519..87dd5f1 100644 +--- a/quickassist/qat/drivers/crypto/qat/qat_common/adf_common_drv.h ++++ b/quickassist/qat/drivers/crypto/qat/qat_common/adf_common_drv.h +@@ -100,7 +100,7 @@ struct service_hndl { + + static inline int get_current_node(void) + { +- return topology_physical_package_id(smp_processor_id()); ++ return topology_physical_package_id(raw_smp_processor_id()); + } + + int adf_service_register(struct service_hndl *service); +-- +2.14.4 + diff --git a/recipes-extended/qat/qat17_4.7.0-00006.bb b/recipes-extended/qat/qat17_4.7.0-00006.bb index af292cf..e1c619d 100644 --- a/recipes-extended/qat/qat17_4.7.0-00006.bb +++ b/recipes-extended/qat/qat17_4.7.0-00006.bb @@ -26,6 +26,7 @@ SRC_URI = "https://01.org/sites/default/files/downloads/qat1.7.l.4.7.0-00006.tar file://qat17_4.7.0-00006-crypto-qat-adf_aer-Remove-pci_cleanup_aer_uncorrect_.patch \ file://qat17_4.7.0-00006-qat-replace-linux-cryptohash.h-with-crypto-sha.h-for.patch \ file://qat17_4.7.0-00006-overwrite-KBUILD_BUILTIN-in-kernel-s-Makefile.patch \ + file://qat17_4.7.0-00006-crypto-qat-Silence-smp_processor_id-warning.patch \ " do_fetch[depends] += "virtual/kernel:do_shared_workdir" -- cgit v1.2.3-54-g00ecf