From: Jens Axboe <jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> To: linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org, npiggin-l3A5Bk7waGM@public.gmane.org, linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, jeremy-TSDbQ3PG+2Y@public.gmane.org, mingo-X9Un+BFzKDI@public.gmane.org, paulmck-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org, Jens Axboe <jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>, Paul Mundt <lethal-M7jkjyW5wf5g9hUCZPvPmw@public.gmane.org> Subject: [PATCH 10/10] sh: convert to generic helpers for IPI function calls Date: Tue, 29 Apr 2008 09:26:30 +0200 [thread overview] Message-ID: <1209453990-7735-11-git-send-email-jens.axboe@oracle.com> (raw) In-Reply-To: <1209453990-7735-1-git-send-email-jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> This converts sh to use the new helpers for smp_call_function() and friends, and adds support for smp_call_function_single(). Not tested, but it compiles. Cc: Paul Mundt <lethal-M7jkjyW5wf5g9hUCZPvPmw@public.gmane.org> Signed-off-by: Jens Axboe <jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> --- arch/sh/Kconfig | 1 + arch/sh/kernel/smp.c | 48 ++++++++---------------------------------------- include/asm-sh/smp.h | 12 ++---------- 3 files changed, 11 insertions(+), 50 deletions(-) diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 6a679c3..60cfdf5 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -698,6 +698,7 @@ config CRASH_DUMP config SMP bool "Symmetric multi-processing support" depends on SYS_SUPPORTS_SMP + select USE_GENERIC_SMP_HELPERS ---help--- This enables support for systems with more than one CPU. If you have a system with only one CPU, like most personal computers, say N. If diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c index 5d039d1..2ed8dce 100644 --- a/arch/sh/kernel/smp.c +++ b/arch/sh/kernel/smp.c @@ -36,13 +36,6 @@ EXPORT_SYMBOL(cpu_possible_map); cpumask_t cpu_online_map; EXPORT_SYMBOL(cpu_online_map); -static atomic_t cpus_booted = ATOMIC_INIT(0); - -/* - * Run specified function on a particular processor. - */ -void __smp_call_function(unsigned int cpu); - static inline void __init smp_store_cpu_info(unsigned int cpu) { struct sh_cpuinfo *c = cpu_data + cpu; @@ -178,42 +171,17 @@ void smp_send_stop(void) smp_call_function(stop_this_cpu, 0, 1, 0); } -struct smp_fn_call_struct smp_fn_call = { - .lock = __SPIN_LOCK_UNLOCKED(smp_fn_call.lock), - .finished = ATOMIC_INIT(0), -}; - -/* - * The caller of this wants the passed function to run on every cpu. If wait - * is set, wait until all cpus have finished the function before returning. - * The lock is here to protect the call structure. - * You must not call this function with disabled interrupts or from a - * hardware interrupt handler or from a bottom half handler. - */ -int smp_call_function(void (*func)(void *info), void *info, int retry, int wait) +void arch_send_call_function_ipi(cpumask_t mask) { - unsigned int nr_cpus = atomic_read(&cpus_booted); - int i; - - /* Can deadlock when called with interrupts disabled */ - WARN_ON(irqs_disabled()); - - spin_lock(&smp_fn_call.lock); - - atomic_set(&smp_fn_call.finished, 0); - smp_fn_call.fn = func; - smp_fn_call.data = info; - - for (i = 0; i < nr_cpus; i++) - if (i != smp_processor_id()) - plat_send_ipi(i, SMP_MSG_FUNCTION); - - if (wait) - while (atomic_read(&smp_fn_call.finished) != (nr_cpus - 1)); + int cpu; - spin_unlock(&smp_fn_call.lock); + for_each_cpu_mask(cpu, mask) + plat_send_ipi(cpu, SMP_MSG_FUNCTION); +} - return 0; +void arch_send_call_function_single_ipi(int cpu) +{ + plat_send_ipi(cpu, SMP_MSG_FUNCTION_SINGLE); } /* Not really SMP stuff ... */ diff --git a/include/asm-sh/smp.h b/include/asm-sh/smp.h index 9c8d34b..7982516 100644 --- a/include/asm-sh/smp.h +++ b/include/asm-sh/smp.h @@ -26,18 +26,10 @@ extern int __cpu_logical_map[NR_CPUS]; #define NO_PROC_ID (-1) -struct smp_fn_call_struct { - spinlock_t lock; - atomic_t finished; - void (*fn)(void *); - void *data; -}; - -extern struct smp_fn_call_struct smp_fn_call; - #define SMP_MSG_FUNCTION 0 #define SMP_MSG_RESCHEDULE 1 -#define SMP_MSG_NR 2 +#define SMP_MSG_FUNCTION_SINGLE 2 +#define SMP_MSG_NR 3 void plat_smp_setup(void); void plat_prepare_cpus(unsigned int max_cpus); -- 1.5.5.1.57.g5909c
WARNING: multiple messages have this Message-ID (diff)
From: Jens Axboe <jens.axboe@oracle.com> To: linux-kernel@vger.kernel.org Cc: peterz@infradead.org, npiggin@suse.de, linux-arch@vger.kernel.org, jeremy@goop.org, mingo@elte.hu, paulmck@linux.vnet.ibm.com, Jens Axboe <jens.axboe@oracle.com>, Paul Mundt <lethal@linux-sh.org> Subject: [PATCH 10/10] sh: convert to generic helpers for IPI function calls Date: Tue, 29 Apr 2008 09:26:30 +0200 [thread overview] Message-ID: <1209453990-7735-11-git-send-email-jens.axboe@oracle.com> (raw) Message-ID: <20080429072630.GjZVMvoBufcNYqZvmMvVyglko2GL0wq7-4fBizK1Grs@z> (raw) In-Reply-To: <1209453990-7735-1-git-send-email-jens.axboe@oracle.com> This converts sh to use the new helpers for smp_call_function() and friends, and adds support for smp_call_function_single(). Not tested, but it compiles. Cc: Paul Mundt <lethal@linux-sh.org> Signed-off-by: Jens Axboe <jens.axboe@oracle.com> --- arch/sh/Kconfig | 1 + arch/sh/kernel/smp.c | 48 ++++++++---------------------------------------- include/asm-sh/smp.h | 12 ++---------- 3 files changed, 11 insertions(+), 50 deletions(-) diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index 6a679c3..60cfdf5 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig @@ -698,6 +698,7 @@ config CRASH_DUMP config SMP bool "Symmetric multi-processing support" depends on SYS_SUPPORTS_SMP + select USE_GENERIC_SMP_HELPERS ---help--- This enables support for systems with more than one CPU. If you have a system with only one CPU, like most personal computers, say N. If diff --git a/arch/sh/kernel/smp.c b/arch/sh/kernel/smp.c index 5d039d1..2ed8dce 100644 --- a/arch/sh/kernel/smp.c +++ b/arch/sh/kernel/smp.c @@ -36,13 +36,6 @@ EXPORT_SYMBOL(cpu_possible_map); cpumask_t cpu_online_map; EXPORT_SYMBOL(cpu_online_map); -static atomic_t cpus_booted = ATOMIC_INIT(0); - -/* - * Run specified function on a particular processor. - */ -void __smp_call_function(unsigned int cpu); - static inline void __init smp_store_cpu_info(unsigned int cpu) { struct sh_cpuinfo *c = cpu_data + cpu; @@ -178,42 +171,17 @@ void smp_send_stop(void) smp_call_function(stop_this_cpu, 0, 1, 0); } -struct smp_fn_call_struct smp_fn_call = { - .lock = __SPIN_LOCK_UNLOCKED(smp_fn_call.lock), - .finished = ATOMIC_INIT(0), -}; - -/* - * The caller of this wants the passed function to run on every cpu. If wait - * is set, wait until all cpus have finished the function before returning. - * The lock is here to protect the call structure. - * You must not call this function with disabled interrupts or from a - * hardware interrupt handler or from a bottom half handler. - */ -int smp_call_function(void (*func)(void *info), void *info, int retry, int wait) +void arch_send_call_function_ipi(cpumask_t mask) { - unsigned int nr_cpus = atomic_read(&cpus_booted); - int i; - - /* Can deadlock when called with interrupts disabled */ - WARN_ON(irqs_disabled()); - - spin_lock(&smp_fn_call.lock); - - atomic_set(&smp_fn_call.finished, 0); - smp_fn_call.fn = func; - smp_fn_call.data = info; - - for (i = 0; i < nr_cpus; i++) - if (i != smp_processor_id()) - plat_send_ipi(i, SMP_MSG_FUNCTION); - - if (wait) - while (atomic_read(&smp_fn_call.finished) != (nr_cpus - 1)); + int cpu; - spin_unlock(&smp_fn_call.lock); + for_each_cpu_mask(cpu, mask) + plat_send_ipi(cpu, SMP_MSG_FUNCTION); +} - return 0; +void arch_send_call_function_single_ipi(int cpu) +{ + plat_send_ipi(cpu, SMP_MSG_FUNCTION_SINGLE); } /* Not really SMP stuff ... */ diff --git a/include/asm-sh/smp.h b/include/asm-sh/smp.h index 9c8d34b..7982516 100644 --- a/include/asm-sh/smp.h +++ b/include/asm-sh/smp.h @@ -26,18 +26,10 @@ extern int __cpu_logical_map[NR_CPUS]; #define NO_PROC_ID (-1) -struct smp_fn_call_struct { - spinlock_t lock; - atomic_t finished; - void (*fn)(void *); - void *data; -}; - -extern struct smp_fn_call_struct smp_fn_call; - #define SMP_MSG_FUNCTION 0 #define SMP_MSG_RESCHEDULE 1 -#define SMP_MSG_NR 2 +#define SMP_MSG_FUNCTION_SINGLE 2 +#define SMP_MSG_NR 3 void plat_smp_setup(void); void plat_prepare_cpus(unsigned int max_cpus); -- 1.5.5.1.57.g5909c
next prev parent reply other threads:[~2008-04-29 7:26 UTC|newest] Thread overview: 68+ messages / expand[flat|nested] mbox.gz Atom feed top 2008-04-29 7:26 [PATCH 0/10] Add generic helpers for arch IPI function calls #3 Jens Axboe 2008-04-29 7:26 ` Jens Axboe [not found] ` <1209453990-7735-1-git-send-email-jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 2008-04-29 7:26 ` [PATCH 1/10] Add generic helpers for arch IPI function calls Jens Axboe 2008-04-29 7:26 ` Jens Axboe [not found] ` <1209453990-7735-2-git-send-email-jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 2008-04-29 13:59 ` Paul E. McKenney 2008-04-29 13:59 ` Paul E. McKenney [not found] ` <20080429135936.GC12390-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org> 2008-04-30 11:29 ` Paul E. McKenney 2008-04-30 11:29 ` Paul E. McKenney [not found] ` <20080430112934.GA23203-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org> 2008-04-30 11:34 ` Jens Axboe 2008-04-30 11:34 ` Jens Axboe [not found] ` <20080430113456.GY12774-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org> 2008-04-30 12:17 ` Paul E. McKenney 2008-04-30 12:17 ` Paul E. McKenney [not found] ` <20080430121712.GR11126-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org> 2008-04-30 12:37 ` Jens Axboe 2008-04-30 12:37 ` Jens Axboe [not found] ` <20080430123717.GC12774-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org> 2008-05-01 2:44 ` Paul E. McKenney 2008-05-01 2:44 ` Paul E. McKenney 2008-05-02 2:02 ` Paul E. McKenney 2008-05-02 2:12 ` Nick Piggin 2008-05-02 12:29 ` Paul E. McKenney 2008-05-02 12:42 ` Paul E. McKenney 2008-05-02 12:59 ` Peter Zijlstra 2008-05-02 12:59 ` Peter Zijlstra 2008-05-02 14:21 ` Paul E. McKenney 2008-05-02 14:21 ` Paul E. McKenney 2008-05-03 2:30 ` Paul E. McKenney 2008-05-03 5:49 ` Nick Piggin 2008-05-03 18:11 ` Paul E. McKenney 2008-05-04 22:04 ` Paul E. McKenney 2008-05-05 4:15 ` Nick Piggin 2008-05-05 4:15 ` Nick Piggin 2008-05-05 17:43 ` Paul E. McKenney 2008-05-07 20:42 ` Jens Axboe 2008-05-08 4:36 ` Paul E. McKenney 2008-05-02 12:50 ` Keith Owens 2008-05-02 13:09 ` Paul E. McKenney 2008-04-30 22:56 ` Jeremy Fitzhardinge 2008-04-30 22:56 ` Jeremy Fitzhardinge 2008-04-29 7:26 ` [PATCH 2/10] x86: convert to generic helpers for " Jens Axboe 2008-04-29 7:26 ` Jens Axboe [not found] ` <1209453990-7735-3-git-send-email-jens.axboe-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> 2008-04-29 20:35 ` Jeremy Fitzhardinge 2008-04-29 20:35 ` Jeremy Fitzhardinge [not found] ` <481786A5.7010604-TSDbQ3PG+2Y@public.gmane.org> 2008-04-30 11:35 ` Jens Axboe 2008-04-30 11:35 ` Jens Axboe [not found] ` <20080430113542.GZ12774-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org> 2008-04-30 12:20 ` Paul E. McKenney 2008-04-30 12:20 ` Paul E. McKenney [not found] ` <20080430122001.GS11126-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org> 2008-04-30 12:31 ` Jens Axboe 2008-04-30 12:31 ` Jens Axboe [not found] ` <20080430123136.GB12774-tSWWG44O7X1aa/9Udqfwiw@public.gmane.org> 2008-04-30 14:51 ` Jeremy Fitzhardinge 2008-04-30 14:51 ` Jeremy Fitzhardinge 2008-04-30 21:39 ` Jeremy Fitzhardinge 2008-04-30 21:39 ` Jeremy Fitzhardinge 2008-04-29 7:26 ` [PATCH 3/10] powerpc: " Jens Axboe 2008-04-29 7:26 ` Jens Axboe 2008-04-29 7:26 ` [PATCH 4/10] ia64: " Jens Axboe 2008-04-29 7:26 ` Jens Axboe 2008-04-29 7:26 ` [PATCH 5/10] alpha: " Jens Axboe 2008-04-29 7:26 ` Jens Axboe 2008-04-29 7:26 ` [PATCH 6/10] arm: " Jens Axboe 2008-04-29 7:26 ` Jens Axboe 2008-04-29 7:26 ` [PATCH 7/10] m32r: " Jens Axboe 2008-04-29 7:26 ` Jens Axboe 2008-04-29 7:26 ` [PATCH 8/10] mips: " Jens Axboe 2008-04-29 7:26 ` Jens Axboe 2008-04-29 7:26 ` [PATCH 9/10] parisc: " Jens Axboe 2008-04-29 7:26 ` Jens Axboe 2008-04-29 7:26 ` Jens Axboe [this message] 2008-04-29 7:26 ` [PATCH 10/10] sh: " Jens Axboe -- strict thread matches above, loose matches on Subject: below -- 2008-05-29 8:58 [PATCH 0/10] Add generic helpers for arch IPI function calls #4 Jens Axboe 2008-05-29 8:58 ` [PATCH 10/10] sh: convert to generic helpers for IPI function calls Jens Axboe
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=1209453990-7735-11-git-send-email-jens.axboe@oracle.com \ --to=jens.axboe-qhclzuegtsvqt0dzr+alfa@public.gmane.org \ --cc=jeremy-TSDbQ3PG+2Y@public.gmane.org \ --cc=lethal-M7jkjyW5wf5g9hUCZPvPmw@public.gmane.org \ --cc=linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=mingo-X9Un+BFzKDI@public.gmane.org \ --cc=npiggin-l3A5Bk7waGM@public.gmane.org \ --cc=paulmck-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org \ --cc=peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.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: linkBe 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; as well as URLs for NNTP newsgroup(s).