linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* padata: Fixes for 3.4
@ 2012-03-28  6:41 Steffen Klassert
  2012-03-28  6:42 ` [PATCH 1/3] padata: Add a reference to the api documentation Steffen Klassert
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Steffen Klassert @ 2012-03-28  6:41 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Peter Zijlstra, linux-kernel, linux-crypto

This patchset contains the following changes:

1) Add a reference to the padata api documentation to the code.
   Suggested by Peter Zijlstra.

2) We use the active cpumask to determine the superset of cpus
   to use for parallelization. The active cpumask is not the appropriate
   cpumask for these purposes. Replace the cpu active usage by cpu online.
   Reported by Peter Zijlstra.

3)  On cpu hotplug, we don't remove the cpu that went offline from our cpumasks.
    Fix this by removing this cpu from the padata cpumasks.

Please pull or apply.

The patchset is based on the crypto-2.6 tree and is available via git:

The following changes since commit ff0a70fe053614e763eb3ac88bfea9c5615fce3b:
  Jussi Kivilinna (1):
        crypto: twofish-x86_64-3way - module init/exit functions should be static

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/klassert/linux-stk padata-fixes

Steffen Klassert (3):
      padata: Add a reference to the api documentation
      padata: Use the online cpumask as the default
      padata: Fix cpu hotplug

 kernel/padata.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

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

* [PATCH 1/3] padata: Add a reference to the api documentation
  2012-03-28  6:41 padata: Fixes for 3.4 Steffen Klassert
@ 2012-03-28  6:42 ` Steffen Klassert
  2012-03-28  6:43 ` [PATCH 2/3] padata: Use the online cpumask as the default Steffen Klassert
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Steffen Klassert @ 2012-03-28  6:42 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Peter Zijlstra, linux-kernel, linux-crypto

Add a reference to the padata api documentation at Documentation/padata.txt

Suggested-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 kernel/padata.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/kernel/padata.c b/kernel/padata.c
index 6f10eb2..7875088 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -1,6 +1,8 @@
 /*
  * padata.c - generic interface to process data streams in parallel
  *
+ * See Documentation/padata.txt for an api documentation.
+ *
  * Copyright (C) 2008, 2009 secunet Security Networks AG
  * Copyright (C) 2008, 2009 Steffen Klassert <steffen.klassert@secunet.com>
  *
-- 
1.7.0.4

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

* [PATCH 2/3] padata: Use the online cpumask as the default
  2012-03-28  6:41 padata: Fixes for 3.4 Steffen Klassert
  2012-03-28  6:42 ` [PATCH 1/3] padata: Add a reference to the api documentation Steffen Klassert
@ 2012-03-28  6:43 ` Steffen Klassert
  2012-03-28  6:44 ` [PATCH 3/3] padata: Fix cpu hotplug Steffen Klassert
  2012-03-30  9:20 ` padata: Fixes for 3.4 Herbert Xu
  3 siblings, 0 replies; 5+ messages in thread
From: Steffen Klassert @ 2012-03-28  6:43 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Peter Zijlstra, linux-kernel, linux-crypto

We use the active cpumask to determine the superset of cpus
to use for parallelization. However, the active cpumask is
for internal usage of the scheduler and therefore not the
appropriate cpumask for these purposes. So use the online
cpumask instead.

Reported-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 kernel/padata.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/kernel/padata.c b/kernel/padata.c
index 7875088..de3d0d9 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -356,13 +356,13 @@ static int padata_setup_cpumasks(struct parallel_data *pd,
 	if (!alloc_cpumask_var(&pd->cpumask.pcpu, GFP_KERNEL))
 		return -ENOMEM;
 
-	cpumask_and(pd->cpumask.pcpu, pcpumask, cpu_active_mask);
+	cpumask_and(pd->cpumask.pcpu, pcpumask, cpu_online_mask);
 	if (!alloc_cpumask_var(&pd->cpumask.cbcpu, GFP_KERNEL)) {
 		free_cpumask_var(pd->cpumask.cbcpu);
 		return -ENOMEM;
 	}
 
-	cpumask_and(pd->cpumask.cbcpu, cbcpumask, cpu_active_mask);
+	cpumask_and(pd->cpumask.cbcpu, cbcpumask, cpu_online_mask);
 	return 0;
 }
 
@@ -566,7 +566,7 @@ EXPORT_SYMBOL(padata_unregister_cpumask_notifier);
 static bool padata_validate_cpumask(struct padata_instance *pinst,
 				    const struct cpumask *cpumask)
 {
-	if (!cpumask_intersects(cpumask, cpu_active_mask)) {
+	if (!cpumask_intersects(cpumask, cpu_online_mask)) {
 		pinst->flags |= PADATA_INVALID;
 		return false;
 	}
@@ -680,7 +680,7 @@ static int __padata_add_cpu(struct padata_instance *pinst, int cpu)
 {
 	struct parallel_data *pd;
 
-	if (cpumask_test_cpu(cpu, cpu_active_mask)) {
+	if (cpumask_test_cpu(cpu, cpu_online_mask)) {
 		pd = padata_alloc_pd(pinst, pinst->cpumask.pcpu,
 				     pinst->cpumask.cbcpu);
 		if (!pd)
-- 
1.7.0.4

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

* [PATCH 3/3] padata: Fix cpu hotplug
  2012-03-28  6:41 padata: Fixes for 3.4 Steffen Klassert
  2012-03-28  6:42 ` [PATCH 1/3] padata: Add a reference to the api documentation Steffen Klassert
  2012-03-28  6:43 ` [PATCH 2/3] padata: Use the online cpumask as the default Steffen Klassert
@ 2012-03-28  6:44 ` Steffen Klassert
  2012-03-30  9:20 ` padata: Fixes for 3.4 Herbert Xu
  3 siblings, 0 replies; 5+ messages in thread
From: Steffen Klassert @ 2012-03-28  6:44 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Peter Zijlstra, linux-kernel, linux-crypto

We don't remove the cpu that went offline from our cpumasks
on cpu hotplug. This got lost somewhere along the line, so
restore it. This fixes a hang of the padata instance on cpu
hotplug.

Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
---
 kernel/padata.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/kernel/padata.c b/kernel/padata.c
index de3d0d9..89fe3d1 100644
--- a/kernel/padata.c
+++ b/kernel/padata.c
@@ -748,6 +748,9 @@ static int __padata_remove_cpu(struct padata_instance *pinst, int cpu)
 			return -ENOMEM;
 
 		padata_replace(pinst, pd);
+
+		cpumask_clear_cpu(cpu, pd->cpumask.cbcpu);
+		cpumask_clear_cpu(cpu, pd->cpumask.pcpu);
 	}
 
 	return 0;
-- 
1.7.0.4

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

* Re: padata: Fixes for 3.4
  2012-03-28  6:41 padata: Fixes for 3.4 Steffen Klassert
                   ` (2 preceding siblings ...)
  2012-03-28  6:44 ` [PATCH 3/3] padata: Fix cpu hotplug Steffen Klassert
@ 2012-03-30  9:20 ` Herbert Xu
  3 siblings, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2012-03-30  9:20 UTC (permalink / raw)
  To: Steffen Klassert; +Cc: Peter Zijlstra, linux-kernel, linux-crypto

On Wed, Mar 28, 2012 at 08:41:57AM +0200, Steffen Klassert wrote:
> This patchset contains the following changes:

All applied to crypto.

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:[~2012-03-30  9:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-28  6:41 padata: Fixes for 3.4 Steffen Klassert
2012-03-28  6:42 ` [PATCH 1/3] padata: Add a reference to the api documentation Steffen Klassert
2012-03-28  6:43 ` [PATCH 2/3] padata: Use the online cpumask as the default Steffen Klassert
2012-03-28  6:44 ` [PATCH 3/3] padata: Fix cpu hotplug Steffen Klassert
2012-03-30  9:20 ` padata: Fixes for 3.4 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).