All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1 1/1] crypto/pcrypt: Do not use isolated CPUs for callback
@ 2022-10-04  6:25 Leonardo Bras
  2022-10-05 12:57 ` Marcelo Tosatti
  0 siblings, 1 reply; 6+ messages in thread
From: Leonardo Bras @ 2022-10-04  6:25 UTC (permalink / raw)
  To: Steffen Klassert, Herbert Xu, David S. Miller, mtosatti
  Cc: Leonardo Bras, linux-crypto, linux-kernel

Currently pcrypt_aead_init_tfm() will pick callback cpus (ctx->cb_cpu)
from any online cpus. Later padata_reorder() will queue_work_on() the
chosen cb_cpu.

This is undesired if the chosen cb_cpu is listed as isolated (i.e. using
isolcpus=... kernel parameter), since the work queued will interfere with
the workload on the isolated cpu.

Make sure isolated cpus are not used for pcrypt.

Signed-off-by: Leonardo Bras <leobras@redhat.com>
---
 crypto/pcrypt.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
index 9d10b846ccf73..9017d08c91a8d 100644
--- a/crypto/pcrypt.c
+++ b/crypto/pcrypt.c
@@ -16,6 +16,7 @@
 #include <linux/kobject.h>
 #include <linux/cpu.h>
 #include <crypto/pcrypt.h>
+#include <linux/sched/isolation.h>
 
 static struct padata_instance *pencrypt;
 static struct padata_instance *pdecrypt;
@@ -175,13 +176,16 @@ static int pcrypt_aead_init_tfm(struct crypto_aead *tfm)
 	struct pcrypt_instance_ctx *ictx = aead_instance_ctx(inst);
 	struct pcrypt_aead_ctx *ctx = crypto_aead_ctx(tfm);
 	struct crypto_aead *cipher;
+	struct cpumask non_isolated;
+
+	cpumask_and(&non_isolated, cpu_online_mask, housekeeping_cpumask(HK_TYPE_DOMAIN));
 
 	cpu_index = (unsigned int)atomic_inc_return(&ictx->tfm_count) %
-		    cpumask_weight(cpu_online_mask);
+		    cpumask_weight(&non_isolated);
 
-	ctx->cb_cpu = cpumask_first(cpu_online_mask);
+	ctx->cb_cpu = cpumask_first(&non_isolated);
 	for (cpu = 0; cpu < cpu_index; cpu++)
-		ctx->cb_cpu = cpumask_next(ctx->cb_cpu, cpu_online_mask);
+		ctx->cb_cpu = cpumask_next(ctx->cb_cpu, &non_isolated);
 
 	cipher = crypto_spawn_aead(&ictx->spawn);
 
-- 
2.37.3


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

end of thread, other threads:[~2022-11-02  2:11 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-04  6:25 [PATCH v1 1/1] crypto/pcrypt: Do not use isolated CPUs for callback Leonardo Bras
2022-10-05 12:57 ` Marcelo Tosatti
2022-10-07 21:42   ` Leonardo Brás
2022-10-11 18:20     ` Leonardo Brás
2022-11-01 17:35       ` Marcelo Tosatti
2022-11-02  2:09         ` Leonardo Bras Soares Passos

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.