linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: qat - Silence smp_processor_id() warning
@ 2019-07-23  7:24 Sverdlin, Alexander (Nokia - DE/Ulm)
  2019-07-25 13:26 ` Giovanni Cabiddu
  2019-08-02  4:54 ` Herbert Xu
  0 siblings, 2 replies; 5+ messages in thread
From: Sverdlin, Alexander (Nokia - DE/Ulm) @ 2019-07-23  7:24 UTC (permalink / raw)
  To: qat-linux, linux-crypto
  Cc: Sverdlin, Alexander (Nokia - DE/Ulm),
	Giovanni Cabiddu, Herbert Xu, David S. Miller, stable

From: Alexander Sverdlin <alexander.sverdlin@nokia.com>

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 <alexander.sverdlin@nokia.com>
---
 drivers/crypto/qat/qat_common/adf_common_drv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/qat/qat_common/adf_common_drv.h b/drivers/crypto/qat/qat_common/adf_common_drv.h
index 5c4c0a2..d78f8d5 100644
--- a/drivers/crypto/qat/qat_common/adf_common_drv.h
+++ b/drivers/crypto/qat/qat_common/adf_common_drv.h
@@ -95,7 +95,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.4.6


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto: qat - Silence smp_processor_id() warning
  2019-07-23  7:24 [PATCH] crypto: qat - Silence smp_processor_id() warning Sverdlin, Alexander (Nokia - DE/Ulm)
@ 2019-07-25 13:26 ` Giovanni Cabiddu
  2019-07-25 14:22   ` Sverdlin, Alexander (Nokia - DE/Ulm)
  2019-07-25 14:25   ` Sverdlin, Alexander (Nokia - DE/Ulm)
  2019-08-02  4:54 ` Herbert Xu
  1 sibling, 2 replies; 5+ messages in thread
From: Giovanni Cabiddu @ 2019-07-25 13:26 UTC (permalink / raw)
  To: Sverdlin, Alexander (Nokia - DE/Ulm)
  Cc: qat-linux, linux-crypto, Herbert Xu, David S. Miller, stable

Hi Alexander,

Thanks for you patch.

On Tue, Jul 23, 2019 at 07:24:01AM +0000, Sverdlin, Alexander (Nokia - DE/Ulm) wrote:
> 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
How did you reproduce this problem?

Thanks,

-- 
Giovanni

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto: qat - Silence smp_processor_id() warning
  2019-07-25 13:26 ` Giovanni Cabiddu
@ 2019-07-25 14:22   ` Sverdlin, Alexander (Nokia - DE/Ulm)
  2019-07-25 14:25   ` Sverdlin, Alexander (Nokia - DE/Ulm)
  1 sibling, 0 replies; 5+ messages in thread
From: Sverdlin, Alexander (Nokia - DE/Ulm) @ 2019-07-25 14:22 UTC (permalink / raw)
  To: Giovanni Cabiddu
  Cc: qat-linux, linux-crypto, Herbert Xu, David S. Miller, stable

Hi!

On 25/07/2019 15:26, Giovanni Cabiddu wrote:
>> 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
> How did you reproduce this problem?

Isn't just CONFIG_DEBUG_ATOMIC_SLEEP enough in your setup?

-- 
Best regards,
Alexander Sverdlin.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto: qat - Silence smp_processor_id() warning
  2019-07-25 13:26 ` Giovanni Cabiddu
  2019-07-25 14:22   ` Sverdlin, Alexander (Nokia - DE/Ulm)
@ 2019-07-25 14:25   ` Sverdlin, Alexander (Nokia - DE/Ulm)
  1 sibling, 0 replies; 5+ messages in thread
From: Sverdlin, Alexander (Nokia - DE/Ulm) @ 2019-07-25 14:25 UTC (permalink / raw)
  To: Giovanni Cabiddu
  Cc: qat-linux, linux-crypto, Herbert Xu, David S. Miller, stable

Hi!

On 25/07/2019 15:26, Giovanni Cabiddu wrote:
>> 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
> How did you reproduce this problem?

Sorry, the previous message should have contained "CONFIG_DEBUG_PREEMPT"...

-- 
Best regards,
Alexander Sverdlin.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] crypto: qat - Silence smp_processor_id() warning
  2019-07-23  7:24 [PATCH] crypto: qat - Silence smp_processor_id() warning Sverdlin, Alexander (Nokia - DE/Ulm)
  2019-07-25 13:26 ` Giovanni Cabiddu
@ 2019-08-02  4:54 ` Herbert Xu
  1 sibling, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2019-08-02  4:54 UTC (permalink / raw)
  To: Sverdlin, Alexander (Nokia - DE/Ulm)
  Cc: qat-linux, linux-crypto, Giovanni Cabiddu, David S. Miller, stable

On Tue, Jul 23, 2019 at 07:24:01AM +0000, Sverdlin, Alexander (Nokia - DE/Ulm) wrote:
> From: Alexander Sverdlin <alexander.sverdlin@nokia.com>
> 
> 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 <alexander.sverdlin@nokia.com>
> ---
>  drivers/crypto/qat/qat_common/adf_common_drv.h | 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] 5+ messages in thread

end of thread, other threads:[~2019-08-02  4:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-23  7:24 [PATCH] crypto: qat - Silence smp_processor_id() warning Sverdlin, Alexander (Nokia - DE/Ulm)
2019-07-25 13:26 ` Giovanni Cabiddu
2019-07-25 14:22   ` Sverdlin, Alexander (Nokia - DE/Ulm)
2019-07-25 14:25   ` Sverdlin, Alexander (Nokia - DE/Ulm)
2019-08-02  4:54 ` 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).