Commit d3f64e46aa21dd86a239274d218ec286461bfa68
Committed by
Herbert Xu
1 parent
c57e842eff
crypto: pcrypt - Update pcrypt cpumask according to the padata cpumask notifier
The padata cpumask change notifier passes a padata_cpumask to the notifier chain. So we use this cpumask instead of asking padata for the cpumask. Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Showing 1 changed file with 11 additions and 2 deletions Side-by-side Diff
crypto/pcrypt.c
... | ... | @@ -26,6 +26,7 @@ |
26 | 26 | #include <linux/slab.h> |
27 | 27 | #include <linux/notifier.h> |
28 | 28 | #include <linux/kobject.h> |
29 | +#include <linux/cpu.h> | |
29 | 30 | #include <crypto/pcrypt.h> |
30 | 31 | |
31 | 32 | struct padata_pcrypt { |
... | ... | @@ -409,6 +410,7 @@ |
409 | 410 | { |
410 | 411 | struct padata_pcrypt *pcrypt; |
411 | 412 | struct pcrypt_cpumask *new_mask, *old_mask; |
413 | + struct padata_cpumask *cpumask = (struct padata_cpumask *)data; | |
412 | 414 | |
413 | 415 | if (!(val & PADATA_CPU_SERIAL)) |
414 | 416 | return 0; |
... | ... | @@ -424,7 +426,7 @@ |
424 | 426 | |
425 | 427 | old_mask = pcrypt->cb_cpumask; |
426 | 428 | |
427 | - padata_get_cpumask(pcrypt->pinst, PADATA_CPU_SERIAL, new_mask->mask); | |
429 | + cpumask_copy(new_mask->mask, cpumask->cbcpu); | |
428 | 430 | rcu_assign_pointer(pcrypt->cb_cpumask, new_mask); |
429 | 431 | synchronize_rcu_bh(); |
430 | 432 | |
... | ... | @@ -451,6 +453,8 @@ |
451 | 453 | int ret = -ENOMEM; |
452 | 454 | struct pcrypt_cpumask *mask; |
453 | 455 | |
456 | + get_online_cpus(); | |
457 | + | |
454 | 458 | pcrypt->wq = create_workqueue(name); |
455 | 459 | if (!pcrypt->wq) |
456 | 460 | goto err; |
... | ... | @@ -467,7 +471,7 @@ |
467 | 471 | goto err_free_padata; |
468 | 472 | } |
469 | 473 | |
470 | - padata_get_cpumask(pcrypt->pinst, PADATA_CPU_SERIAL, mask->mask); | |
474 | + cpumask_and(mask->mask, cpu_possible_mask, cpu_active_mask); | |
471 | 475 | rcu_assign_pointer(pcrypt->cb_cpumask, mask); |
472 | 476 | |
473 | 477 | pcrypt->nblock.notifier_call = pcrypt_cpumask_change_notify; |
474 | 478 | |
... | ... | @@ -479,7 +483,10 @@ |
479 | 483 | if (ret) |
480 | 484 | goto err_unregister_notifier; |
481 | 485 | |
486 | + put_online_cpus(); | |
487 | + | |
482 | 488 | return ret; |
489 | + | |
483 | 490 | err_unregister_notifier: |
484 | 491 | padata_unregister_cpumask_notifier(pcrypt->pinst, &pcrypt->nblock); |
485 | 492 | err_free_cpumask: |
... | ... | @@ -490,6 +497,8 @@ |
490 | 497 | err_destroy_workqueue: |
491 | 498 | destroy_workqueue(pcrypt->wq); |
492 | 499 | err: |
500 | + put_online_cpus(); | |
501 | + | |
493 | 502 | return ret; |
494 | 503 | } |
495 | 504 |