linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* set_cpus_allowed_ptr() usage in FREESCALE CAAM
@ 2018-10-05 12:54 Sebastian Andrzej Siewior
  2018-10-08 11:09 ` [PATCH] crypto: caam/qi - simplify CGR allocation, freeing Horia Geantă
  0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Andrzej Siewior @ 2018-10-05 12:54 UTC (permalink / raw)
  To: Horia Geantă
  Cc: Aymen Sghaier, linux-crypto, linux-kernel, Peter Zijlstra,
	Thomas Gleixner

Hi,

this block:
|int caam_qi_shutdown(struct device *qidev)
| {
|         struct cpumask old_cpumask = current->cpus_allowed;
…
|         /*
|          * QMan driver requires CGRs to be deleted from same CPU from where they
|          * were instantiated. Hence we get the module removal execute from the
|          * same CPU from where it was originally inserted.
|          */
|         set_cpus_allowed_ptr(current, get_cpu_mask(mod_init_cpu));
…
|          /* Now that we're done with the CGRs, restore the cpus allowed mask */
|         set_cpus_allowed_ptr(current, &old_cpumask);

in drivers/crypto/caam/qi.c needs to go. I saw it twice in the driver.
set_cpus_allowed_ptr() is not intended for this kind of thing.

What you want is to use work_on_cpu_safe() instead. It takes also a CPU
as an argument. You need to check the error code of the function if it
worked because the CPU may have gone offline. This functions also
ensures that the CPU does not vanish in the middle of the work. 
Also please check the error code in both cases of the function because
it may fail if the CPU is not online.

Sebastian

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

end of thread, other threads:[~2018-10-29 17:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-05 12:54 set_cpus_allowed_ptr() usage in FREESCALE CAAM Sebastian Andrzej Siewior
2018-10-08 11:09 ` [PATCH] crypto: caam/qi - simplify CGR allocation, freeing Horia Geantă
2018-10-09 17:11   ` Sebastian Andrzej Siewior
2018-10-25 14:05     ` Horia Geanta
2018-10-29  8:56       ` Sebastian Andrzej Siewior
2018-10-17  6:21   ` Herbert Xu

This is a public inbox, see mirroring instructions
on how to clone and mirror all data and code used for this inbox