From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org
Cc: Heiko Carstens <heiko.carstens@de.ibm.com>,
Martin Schwidefsky <schwidefsky@de.ibm.com>
Subject: [patch 10/11] smp: __smp_call_function_map vs cpu_online_map fix.
Date: Thu, 15 May 2008 16:57:15 +0200 [thread overview]
Message-ID: <20080515150009.822888309@de.ibm.com> (raw)
In-Reply-To: 20080515145705.188435204@de.ibm.com
[-- Attachment #1: 010-smp-call-lock.diff --]
[-- Type: text/plain, Size: 2754 bytes --]
From: Heiko Carstens <heiko.carstens@de.ibm.com>
Both smp_call_function() and __smp_call_function_map() access
cpu_online_map. Both functions run with preemption disabled which
protects for cpus going offline. However new cpus can be added and
therefore the cpu_online_map can change unexpectedly.
So use the call_lock to protect against changes to the cpu_online_map
in start_secondary() and all smp_call_* functions.
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
---
arch/s390/kernel/smp.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
Index: quilt-2.6/arch/s390/kernel/smp.c
===================================================================
--- quilt-2.6.orig/arch/s390/kernel/smp.c
+++ quilt-2.6/arch/s390/kernel/smp.c
@@ -139,7 +139,6 @@ static void __smp_call_function_map(void
if (wait)
data.finished = CPU_MASK_NONE;
- spin_lock(&call_lock);
call_data = &data;
for_each_cpu_mask(cpu, map)
@@ -151,7 +150,6 @@ static void __smp_call_function_map(void
if (wait)
while (!cpus_equal(map, data.finished))
cpu_relax();
- spin_unlock(&call_lock);
out:
if (local) {
local_irq_disable();
@@ -177,11 +175,11 @@ int smp_call_function(void (*func) (void
{
cpumask_t map;
- preempt_disable();
+ spin_lock(&call_lock);
map = cpu_online_map;
cpu_clear(smp_processor_id(), map);
__smp_call_function_map(func, info, nonatomic, wait, map);
- preempt_enable();
+ spin_unlock(&call_lock);
return 0;
}
EXPORT_SYMBOL(smp_call_function);
@@ -202,10 +200,10 @@ EXPORT_SYMBOL(smp_call_function);
int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
int nonatomic, int wait)
{
- preempt_disable();
+ spin_lock(&call_lock);
__smp_call_function_map(func, info, nonatomic, wait,
cpumask_of_cpu(cpu));
- preempt_enable();
+ spin_unlock(&call_lock);
return 0;
}
EXPORT_SYMBOL(smp_call_function_single);
@@ -228,10 +226,10 @@ EXPORT_SYMBOL(smp_call_function_single);
int smp_call_function_mask(cpumask_t mask, void (*func)(void *), void *info,
int wait)
{
- preempt_disable();
+ spin_lock(&call_lock);
cpu_clear(smp_processor_id(), mask);
__smp_call_function_map(func, info, 0, wait, mask);
- preempt_enable();
+ spin_unlock(&call_lock);
return 0;
}
EXPORT_SYMBOL(smp_call_function_mask);
@@ -592,7 +590,9 @@ int __cpuinit start_secondary(void *cpuv
pfault_init();
/* Mark this cpu as online */
+ spin_lock(&call_lock);
cpu_set(smp_processor_id(), cpu_online_map);
+ spin_unlock(&call_lock);
/* Switch on interrupts */
local_irq_enable();
/* Print info about this processor */
--
blue skies,
Martin.
"Reality continues to ruin my life." - Calvin.
next prev parent reply other threads:[~2008-05-15 14:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-15 14:57 [patch 00/11] s390 patches for 2.6.26-rc2 Martin Schwidefsky
2008-05-15 14:57 ` [patch 01/11] cio: Remove CCW_CMD_SUSPEND_RECONN in front of CCW_CMD_SET_PGID Martin Schwidefsky
2008-05-15 14:57 ` [patch 02/11] Remove last traces of cio_msg= Martin Schwidefsky
2008-05-15 14:57 ` [patch 03/11] sparsemem vmemmap: initialize memmap Martin Schwidefsky
2008-05-15 14:57 ` [patch 04/11] vmlogrdr: module initialization function should return negative errors Martin Schwidefsky
2008-05-15 14:57 ` [patch 05/11] blacklist.c: removed duplicated include Martin Schwidefsky
2008-05-15 14:57 ` [patch 06/11] dasd: Use const in busid functions Martin Schwidefsky
2008-05-15 14:57 ` [patch 07/11] s390dbf: Use const char * for dbf name Martin Schwidefsky
2008-05-15 14:57 ` [patch 08/11] dasd: fix timeout handling in interrupt handler Martin Schwidefsky
2008-05-15 14:57 ` [patch 09/11] tape: Use ccw_dev_id to build cdev_id Martin Schwidefsky
2008-05-15 14:57 ` Martin Schwidefsky [this message]
2008-05-15 14:57 ` [patch 11/11] show_interrupts: prevent cpu hotplug when walking cpu_online_map Martin Schwidefsky
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=20080515150009.822888309@de.ibm.com \
--to=schwidefsky@de.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@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 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.