From: Li Shaohua <shaohua.li@intel.com>
To: lkml <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@osdl.org>, Andi Kleen <ak@suse.de>,
Zwane Mwaikambo <zwane@linuxpower.ca>
Subject: [PATCH]broadcast IPI race condition on CPU hotplug
Date: Tue, 26 Apr 2005 10:20:44 +0800 [thread overview]
Message-ID: <1114482044.7068.17.camel@sli10-desk.sh.intel.com> (raw)
Hi,
After a CPU is booted but before it's officially up (set online map, and
enable interrupt), the CPU possibly will receive a broadcast IPI. After
it's up, it will handle the stale interrupt soon and maybe cause oops if
it's a smp-call-function-interrupt. This is quite possible in CPU
hotplug case, but nearly can't occur at boot time. Below patch replaces
broadcast IPI with send_ipi_mask just like the cluster mode.
Thanks,
Shaohua
Signed-off-by: Li Shaohua<shaohua.li@intel.com>
--- a/include/asm-i386/mach-default/mach_ipi.h 2005-04-26 09:07:51.695390216 +0800
+++ b/include/asm-i386/mach-default/mach_ipi.h 2005-04-26 09:26:59.235937536 +0800
@@ -11,20 +11,16 @@ static inline void send_IPI_mask(cpumask
static inline void send_IPI_allbutself(int vector)
{
- /*
- * if there are no other CPUs in the system then we get an APIC send
- * error if we try to broadcast, thus avoid sending IPIs in this case.
- */
- if (!(num_online_cpus() > 1))
- return;
+ cpumask_t mask = cpu_online_map;
+ cpu_clear(smp_processor_id(), mask);
- __send_IPI_shortcut(APIC_DEST_ALLBUT, vector);
- return;
+ if (likely(!cpus_empty(mask)))
+ send_IPI_mask(mask, vector);
}
static inline void send_IPI_all(int vector)
{
- __send_IPI_shortcut(APIC_DEST_ALLINC, vector);
+ send_IPI_mask(cpu_online_map, vector);
}
#endif /* __ASM_MACH_IPI_H */
--- a/arch/x86_64/kernel/genapic_flat.c 2005-03-02 15:38:09.000000000 +0800
+++ b/arch/x86_64/kernel/genapic_flat.c 2005-04-26 09:26:09.298529176 +0800
@@ -45,20 +45,19 @@ static void flat_init_apic_ldr(void)
apic_write_around(APIC_LDR, val);
}
+static void flat_send_IPI_mask(cpumask_t cpumask, int vector);
static void flat_send_IPI_allbutself(int vector)
{
- /*
- * if there are no other CPUs in the system then
- * we get an APIC send error if we try to broadcast.
- * thus we have to avoid sending IPIs in this case.
- */
- if (num_online_cpus() > 1)
- __send_IPI_shortcut(APIC_DEST_ALLBUT, vector, APIC_DEST_LOGICAL);
+ cpumask_t mask = cpu_online_map;
+ cpu_clear(smp_processor_id(), mask);
+
+ if (likely(!cpus_empty(mask)))
+ flat_send_IPI_mask(mask, vector);
}
static void flat_send_IPI_all(int vector)
{
- __send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL);
+ flat_send_IPI_mask(cpu_online_map, vector);
}
static void flat_send_IPI_mask(cpumask_t cpumask, int vector)
next reply other threads:[~2005-04-26 2:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-26 2:20 Li Shaohua [this message]
2005-04-26 4:25 ` Zwane Mwaikambo
2005-04-26 4:24 ` Li Shaohua
2005-04-26 4:47 ` Zwane Mwaikambo
2005-04-26 5:17 ` Li Shaohua
2005-04-26 13:21 ` Andi Kleen
2005-04-27 1:00 ` Zwane Mwaikambo
2005-04-27 1:11 ` Li Shaohua
2005-04-27 12:56 ` Andi Kleen
2005-04-28 3:15 ` Li Shaohua
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=1114482044.7068.17.camel@sli10-desk.sh.intel.com \
--to=shaohua.li@intel.com \
--cc=ak@suse.de \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zwane@linuxpower.ca \
/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
all inboxes | Powered by JetHome®