mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ashok Raj <ashok.raj@intel.com>
To: Andrew Morton <akpm@osdl.org>, linux-kernel@vger.kernel.org
Cc: Zwane Mwaikambo <zwane@arm.linux.org.uk>,
	Srivattsa Vaddagiri <vatsa@in.ibm.com>,
	Shaohua Li <shaohua.li@intel.com>,
	Rusty Russell <rusty@rustycorp.com.au>,
	Ashok Raj <ashok.raj@intel.com>
Subject: [patch 2/2] i386: hold call_lock when updating cpu_online_map
Date: Tue, 07 Jun 2005 20:09:03 -0700	[thread overview]
Message-ID: <20050608031217.498798000@araj-em64t> (raw)
In-Reply-To: <20050608030901.001736000@araj-em64t>

[-- Attachment #1: i386-hold-call-lock-when-adding-to-onlinemap.patch --]
[-- Type: text/plain, Size: 2351 bytes --]

We need to hold call-lock when updating cpu-online-map to ensure
the newly upcoming cpu is excluded in an ongoing smp_call_function.

Signed-off-by: Ashok Raj <ashok.raj@intel.com>
Acked-by: Shaohua Li <shaohua.li@intel.com>
-------------------------------------------------
 arch/i386/kernel/smp.c     |   10 ++++++++++
 arch/i386/kernel/smpboot.c |   10 ++++++++++
 include/asm-i386/smp.h     |    2 ++
 3 files changed, 22 insertions(+)

Index: linux-2.6.12-rc6-mm1/arch/i386/kernel/smp.c
===================================================================
--- linux-2.6.12-rc6-mm1.orig/arch/i386/kernel/smp.c
+++ linux-2.6.12-rc6-mm1/arch/i386/kernel/smp.c
@@ -506,6 +506,16 @@ struct call_data_struct {
 	int wait;
 };
 
+void lock_ipi_call_lock(void)
+{
+	spin_lock_irq(&call_lock);
+}
+
+void unlock_ipi_call_lock(void)
+{
+	spin_unlock_irq(&call_lock);
+}
+
 static struct call_data_struct * call_data;
 
 /*
Index: linux-2.6.12-rc6-mm1/include/asm-i386/smp.h
===================================================================
--- linux-2.6.12-rc6-mm1.orig/include/asm-i386/smp.h
+++ linux-2.6.12-rc6-mm1/include/asm-i386/smp.h
@@ -42,6 +42,8 @@ extern void smp_message_irq(int cpl, voi
 extern void smp_invalidate_rcv(void);		/* Process an NMI */
 extern void (*mtrr_hook) (void);
 extern void zap_low_mappings (void);
+extern void lock_ipi_call_lock(void);
+extern void unlock_ipi_call_lock(void);
 
 #define MAX_APICID 256
 extern u8 x86_cpu_to_apicid[];
Index: linux-2.6.12-rc6-mm1/arch/i386/kernel/smpboot.c
===================================================================
--- linux-2.6.12-rc6-mm1.orig/arch/i386/kernel/smpboot.c
+++ linux-2.6.12-rc6-mm1/arch/i386/kernel/smpboot.c
@@ -503,7 +503,17 @@ static void __devinit start_secondary(vo
 	set_cpu_sibling_map(raw_smp_processor_id());
 	wmb();
 
+	/*
+	 * We need to hold call_lock, so there is no inconsistency
+	 * between the time smp_call_function() determines number of
+	 * IPI receipients, and the time when the determination is made
+	 * for which cpus receive the IPI. Holding this
+	 * lock helps us to not include this cpu in a currently in progress
+	 * smp_call_function().
+	 */
+	lock_ipi_call_lock();
 	cpu_set(smp_processor_id(), cpu_online_map);
+	unlock_ipi_call_lock();
 
 	/* We can take interrupts now: we're officially "up". */
 	local_irq_enable();

--


      parent reply	other threads:[~2005-06-08  3:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-08  3:09 [patch 0/2] i386: CPU hotplug related patch series Ashok Raj
2005-06-08  3:09 ` [patch 1/2] i386: Dont use IPI broadcast when using cpu hotplug Ashok Raj
2005-06-08  3:09 ` Ashok Raj [this message]

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=20050608031217.498798000@araj-em64t \
    --to=ashok.raj@intel.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rusty@rustycorp.com.au \
    --cc=shaohua.li@intel.com \
    --cc=vatsa@in.ibm.com \
    --cc=zwane@arm.linux.org.uk \
    /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®