From: Steffen Klassert <steffen.klassert@secunet.com>
To: Herbert Xu <herbert@gondor.hengli.com.au>
Cc: Dan Kruchinin <dkruchinin@acm.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 5/7] crypto: pcrypt - Update pcrypt cpumask according to the padata cpumask notifier
Date: Tue, 27 Jul 2010 07:18:46 +0200 [thread overview]
Message-ID: <20100727051846.GN11081@secunet.com> (raw)
In-Reply-To: <20100727051347.GI11081@secunet.com>
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>
---
crypto/pcrypt.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/crypto/pcrypt.c b/crypto/pcrypt.c
index 7742553..de30782 100644
--- a/crypto/pcrypt.c
+++ b/crypto/pcrypt.c
@@ -26,6 +26,7 @@
#include <linux/slab.h>
#include <linux/notifier.h>
#include <linux/kobject.h>
+#include <linux/cpu.h>
#include <crypto/pcrypt.h>
struct padata_pcrypt {
@@ -409,6 +410,7 @@ static int pcrypt_cpumask_change_notify(struct notifier_block *self,
{
struct padata_pcrypt *pcrypt;
struct pcrypt_cpumask *new_mask, *old_mask;
+ struct padata_cpumask *cpumask = (struct padata_cpumask *)data;
if (!(val & PADATA_CPU_SERIAL))
return 0;
@@ -424,7 +426,7 @@ static int pcrypt_cpumask_change_notify(struct notifier_block *self,
old_mask = pcrypt->cb_cpumask;
- padata_get_cpumask(pcrypt->pinst, PADATA_CPU_SERIAL, new_mask->mask);
+ cpumask_copy(new_mask->mask, cpumask->cbcpu);
rcu_assign_pointer(pcrypt->cb_cpumask, new_mask);
synchronize_rcu_bh();
@@ -451,6 +453,8 @@ static int pcrypt_init_padata(struct padata_pcrypt *pcrypt,
int ret = -ENOMEM;
struct pcrypt_cpumask *mask;
+ get_online_cpus();
+
pcrypt->wq = create_workqueue(name);
if (!pcrypt->wq)
goto err;
@@ -467,7 +471,7 @@ static int pcrypt_init_padata(struct padata_pcrypt *pcrypt,
goto err_free_padata;
}
- padata_get_cpumask(pcrypt->pinst, PADATA_CPU_SERIAL, mask->mask);
+ cpumask_and(mask->mask, cpu_possible_mask, cpu_active_mask);
rcu_assign_pointer(pcrypt->cb_cpumask, mask);
pcrypt->nblock.notifier_call = pcrypt_cpumask_change_notify;
@@ -479,7 +483,10 @@ static int pcrypt_init_padata(struct padata_pcrypt *pcrypt,
if (ret)
goto err_unregister_notifier;
+ put_online_cpus();
+
return ret;
+
err_unregister_notifier:
padata_unregister_cpumask_notifier(pcrypt->pinst, &pcrypt->nblock);
err_free_cpumask:
@@ -490,6 +497,8 @@ err_free_padata:
err_destroy_workqueue:
destroy_workqueue(pcrypt->wq);
err:
+ put_online_cpus();
+
return ret;
}
--
1.5.6.5
next prev parent reply other threads:[~2010-07-27 5:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-27 5:13 [PATCH 0/7] padata/pcrypt: cleanups Steffen Klassert
2010-07-27 5:14 ` [PATCH 1/7] padata: Rename padata_alloc functions Steffen Klassert
2010-07-27 5:15 ` [PATCH 2/7] padata: Rearrange set_cpumask functions Steffen Klassert
2010-07-27 5:15 ` [PATCH 3/7] padata: Pass the padata cpumasks to the cpumask_change_notifier chain Steffen Klassert
2010-07-27 5:16 ` [PATCH 4/7] crypto: pcrypt - Rename pcrypt_instance Steffen Klassert
2010-07-27 5:18 ` Steffen Klassert [this message]
2010-07-27 5:19 ` [PATCH 6/7] padata: Remove padata_get_cpumask Steffen Klassert
2010-07-27 5:20 ` [PATCH 7/7] padata: update API documentation Steffen Klassert
2010-08-03 17:53 ` Randy Dunlap
2010-07-31 11:56 ` [PATCH 0/7] padata/pcrypt: cleanups Herbert Xu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100727051846.GN11081@secunet.com \
--to=steffen.klassert@secunet.com \
--cc=akpm@linux-foundation.org \
--cc=dkruchinin@acm.org \
--cc=herbert@gondor.hengli.com.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox