login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
April
»
22
Re: [PATCH 1/11] Add generic helpers for arch IPI function calls
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Peter Zijlstra
Subject:
Re: [PATCH 1/11] Add generic helpers for arch IPI function calls
Date: Tuesday, April 22, 2008 - 1:17 pm
On Tue, 2008-04-22 at 20:50 +0200, Jens Axboe wrote:
quoted text
> +int smp_call_function_single(int cpu, void (*func) (void *info), void *info, > + int retry, int wait) > +{ > + unsigned long flags; > + /* prevent preemption and reschedule on another processor */ > + int me = get_cpu(); > + > + /* Can deadlock when called with interrupts disabled */ > + WARN_ON(wait && irqs_disabled());
With this fallback to wait the above condition isn't sufficient.
quoted text
> + if (cpu == me) { > + local_irq_save(flags); > + func(info); > + local_irq_restore(flags); > + } else { > + struct call_single_data *data; > + > + if (wait) { > + struct call_single_data d; > + > + data = &d; > + data->flags = CSD_FLAG_WAIT; > + } else { > + data = kmalloc(sizeof(*data), GFP_ATOMIC); > + if (data) > + data->flags = CSD_FLAG_ALLOC; > + else { > + while (test_and_set_bit_lock(0, > + &cfd_fallback_used)) > + cpu_relax(); > + > + data = &cfd_fallback.csd; > + data->flags = CSD_FLAG_FALLBACK; > + } > + } > + > + data->func = func; > + data->info = info; > + generic_exec_single(cpu, data); > + } > + > + put_cpu(); > + return 0; > +} > +EXPORT_SYMBOL(smp_call_function_single);
quoted text
> +int smp_call_function_mask(cpumask_t mask, void (*func)(void *), void *info, > + int wait) > +{ > + struct call_function_data *data; > + cpumask_t allbutself; > + unsigned long flags; > + int num_cpus; > + > + /* Can deadlock when called with interrupts disabled */ > + WARN_ON(wait && irqs_disabled());
idem
quoted text
> + allbutself = cpu_online_map; > + cpu_clear(smp_processor_id(), allbutself); > + cpus_and(mask, mask, allbutself); > + num_cpus = cpus_weight(mask); > + > + if (!num_cpus) > + return 0; > + > + if (wait) { > + struct call_function_data d; > + > + data = &d; > + data->csd.flags = CSD_FLAG_WAIT; > + } else { > + data = kmalloc(sizeof(*data), GFP_ATOMIC); > + if (data) > + data->csd.flags = CSD_FLAG_ALLOC; > + else { > + while (test_and_set_bit_lock(0, &cfd_fallback_used)) > + cpu_relax(); > + > + data = &cfd_fallback; > + data->csd.flags = CSD_FLAG_FALLBACK; > + } > + } > + > + spin_lock_init(&data->lock); > + data->csd.func = func; > + data->csd.info = info; > + data->refs = num_cpus; > + data->cpumask = mask; > + > + spin_lock_irqsave(&call_function_lock, flags); > + list_add_tail_rcu(&data->csd.list, &call_function_queue); > + spin_unlock_irqrestore(&call_function_lock, flags); > + > + /* Send a message to all CPUs in the map */ > + arch_send_call_function_ipi(mask); > + > + /* optionally wait for the CPUs to complete */ > + if (wait) > + csd_flag_wait(&data->csd); > + > + return 0; > +}
--
unsubscribe notice
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to
majordomo@vger.kernel.org
More majordomo info at
http://vger.kernel.org/majordomo-info.html
Please read the FAQ at
http://www.tux.org/lkml/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH 0/11] Generic smp_call_function() #2
, Jens Axboe
, (Tue Apr 22, 11:50 am)
[PATCH 1/11] Add generic helpers for arch IPI function calls
, Jens Axboe
, (Tue Apr 22, 11:50 am)
[PATCH 2/11] x86: convert to generic helpers for IPI funct ...
, Jens Axboe
, (Tue Apr 22, 11:50 am)
[PATCH 3/11] powerpc: convert to generic helpers for IPI f ...
, Jens Axboe
, (Tue Apr 22, 11:50 am)
[PATCH 4/11] ia64: convert to generic helpers for IPI func ...
, Jens Axboe
, (Tue Apr 22, 11:50 am)
[PATCH 5/11] alpha: convert to generic helpers for IPI fun ...
, Jens Axboe
, (Tue Apr 22, 11:50 am)
[PATCH 6/11] arm: convert to generic helpers for IPI funct ...
, Jens Axboe
, (Tue Apr 22, 11:50 am)
[PATCH 7/11] m32r: convert to generic helpers for IPI func ...
, Jens Axboe
, (Tue Apr 22, 11:50 am)
[PATCH 8/11] mips: convert to generic helpers for IPI func ...
, Jens Axboe
, (Tue Apr 22, 11:50 am)
[PATCH 9/11] parisc: convert to generic helpers for IPI fu ...
, Jens Axboe
, (Tue Apr 22, 11:50 am)
[PATCH 10/11] sh: convert to generic helpers for IPI funct ...
, Jens Axboe
, (Tue Apr 22, 11:50 am)
[PATCH 11/11] s390: convert to generic helpers for IPI fun ...
, Jens Axboe
, (Tue Apr 22, 11:50 am)
Re: [PATCH 2/11] x86: convert to generic helpers for IPI f ...
, Linus Torvalds
, (Tue Apr 22, 12:03 pm)
Re: [PATCH 2/11] x86: convert to generic helpers for IPI f ...
, Ingo Molnar
, (Tue Apr 22, 12:12 pm)
Re: [PATCH 2/11] x86: convert to generic helpers for IPI f ...
, Linus Torvalds
, (Tue Apr 22, 12:22 pm)
Re: [PATCH 2/11] x86: convert to generic helpers for IPI f ...
, Ingo Molnar
, (Tue Apr 22, 12:26 pm)
Re: [PATCH 2/11] x86: convert to generic helpers for IPI f ...
, Linus Torvalds
, (Tue Apr 22, 12:50 pm)
Re: [PATCH 1/11] Add generic helpers for arch IPI function ...
, Peter Zijlstra
, (Tue Apr 22, 1:17 pm)
Re: [PATCH 8/11] mips: convert to generic helpers for IPI ...
, Ralf Baechle
, (Tue Apr 22, 4:18 pm)
Re: [PATCH 2/11] x86: convert to generic helpers for IPI f ...
, Nick Piggin
, (Tue Apr 22, 6:11 pm)
Re: [PATCH 2/11] x86: convert to generic helpers for IPI f ...
, Linus Torvalds
, (Tue Apr 22, 6:22 pm)
Re: [PATCH 2/11] x86: convert to generic helpers for IPI f ...
, Nick Piggin
, (Tue Apr 22, 6:36 pm)
Re: [PATCH 1/11] Add generic helpers for arch IPI function ...
, Jens Axboe
, (Tue Apr 22, 11:07 pm)
Re: [PATCH 1/11] Add generic helpers for arch IPI function ...
, Peter Zijlstra
, (Tue Apr 22, 11:32 pm)
Re: [PATCH 2/11] x86: convert to generic helpers for IPI f ...
, Jens Axboe
, (Wed Apr 23, 12:08 am)
Re: [PATCH 8/11] mips: convert to generic helpers for IPI ...
, Jens Axboe
, (Wed Apr 23, 12:18 am)
Re: [PATCH 1/11] Add generic helpers for arch IPI function ...
, Jens Axboe
, (Wed Apr 23, 12:49 am)
Re: [PATCH 1/11] Add generic helpers for arch IPI function ...
, Peter Zijlstra
, (Wed Apr 23, 12:50 am)
Re: [PATCH 11/11] s390: convert to generic helpers for IPI ...
, Heiko Carstens
, (Wed Apr 23, 12:58 am)
Re: [PATCH 11/11] s390: convert to generic helpers for IPI ...
, Jens Axboe
, (Wed Apr 23, 1:11 am)
Re: [PATCH 11/11] s390: convert to generic helpers for IPI ...
, Jens Axboe
, (Wed Apr 23, 4:21 am)
Re: [PATCH 11/11] s390: convert to generic helpers for IPI ...
, Heiko Carstens
, (Wed Apr 23, 4:47 am)
Re: [PATCH 11/11] s390: convert to generic helpers for IPI ...
, Jens Axboe
, (Wed Apr 23, 4:54 am)
Re: [PATCH 11/11] s390: convert to generic helpers for IPI ...
, Martin Schwidefsky
, (Wed Apr 23, 5:42 am)
Re: [PATCH 2/11] x86: convert to generic helpers for IPI f ...
, Jens Axboe
, (Wed Apr 23, 5:54 am)
Re: [PATCH 11/11] s390: convert to generic helpers for IPI ...
, Rusty Russell
, (Wed Apr 23, 8:56 am)
Re: [PATCH 1/11] Add generic helpers for arch IPI function ...
, Russell King
, (Thu Apr 24, 3:01 pm)
Re: [PATCH 1/11] Add generic helpers for arch IPI function ...
, Jens Axboe
, (Fri Apr 25, 12:18 am)
Re: [PATCH 10/11] sh: convert to generic helpers for IPI f ...
, Paul Mundt
, (Fri Apr 25, 1:56 am)
Re: [PATCH 10/11] sh: convert to generic helpers for IPI f ...
, Jens Axboe
, (Fri Apr 25, 2:16 am)
Re: [PATCH 1/11] Add generic helpers for arch IPI function ...
, Andrew Morton
, (Fri Apr 25, 11:11 pm)
Re: [PATCH 1/11] Add generic helpers for arch IPI function ...
, Jeremy Fitzhardinge
, (Fri Apr 25, 11:28 pm)
Re: [PATCH 2/11] x86: convert to generic helpers for IPI f ...
, Jeremy Fitzhardinge
, (Fri Apr 25, 11:44 pm)
Re: [PATCH 1/11] Add generic helpers for arch IPI function ...
, James Bottomley
, (Sat Apr 26, 7:13 am)
Re: [PATCH 1/11] Add generic helpers for arch IPI function ...
, Paul E. McKenney
, (Sat Apr 26, 5:58 pm)
Re: [PATCH 2/11] x86: convert to generic helpers for IPI f ...
, Jens Axboe
, (Sun Apr 27, 3:23 am)
Re: [PATCH 1/11] Add generic helpers for arch IPI function ...
, Jens Axboe
, (Sun Apr 27, 3:30 am)
Re: [PATCH 1/11] Add generic helpers for arch IPI function ...
, Jens Axboe
, (Sun Apr 27, 3:36 am)
Re: [PATCH 2/11] x86: convert to generic helpers for IPI f ...
, Jeremy Fitzhardinge
, (Sun Apr 27, 8:18 am)
Re: [PATCH 1/11] Add generic helpers for arch IPI function ...
, Jes Sorensen
, (Mon Apr 28, 12:38 am)
Re: [PATCH 1/11] Add generic helpers for arch IPI function ...
, David Howells
, (Mon Apr 28, 7:25 am)
Re: [PATCH 1/11] Add generic helpers for arch IPI function ...
, James Bottomley
, (Mon Apr 28, 7:43 am)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
David Howells
Re: [PATCH 5/5]bluetooth:hci_bcsp Fix operation on 'bcsp->msgq_txseq' may be un...
Eberhard Moenkeberg
Re: OT: character encodings (was: Linux 2.6.20-rc4)
Andy Walls
Re: [PATCH 11/32] v4l/cx18: update workqueue usage
Thomas Gleixner
[patch -mm 19/28] x86_64: Use generic cmos update
Pierre Ossman
Re: sdio: enhance IO_RW_EXTENDED support
git
:
Mark Junker
git on MacOSX and files with decomposed utf-8 file names
Pat Thoyts
[PATCH] git-gui: use themed tk widgets with Tk 8.5
Michael Witten
Re: 'git gc --aggressive' effectively unusable
Petko Manolov
git and binary files
Dan Chokola
Re: how do you "force a pull"?
git-commits-head
:
Linux Kernel Mailing List
[ARM] unconditionally define __virt_to_phys and __phys_to_virt
Linux Kernel Mailing List
ACPICA: Fix to allow zero-length ASL field declarations
Linux Kernel Mailing List
tracing: Simplify trace_option_write()
Linux Kernel Mailing List
ARM: Add Versatile Express SMP support
Linux Kernel Mailing List
ixgbe: fix automatic LRO/RSC settings for low latency
linux-netdev
:
David Miller
Re: [PATCH 32/53] netns xfrm: finding policy in netns
Jean-Louis Dupond
Re: tg3 driver not advertising 1000mbit
Jan Engelhardt
[PATCH 1/3] net: tcp: make hybla selectable as default congestion module
David Miller
Re: [PATCH] IPv6: preferred lifetime of address not getting updated
Matt Mackall
Re: [regression] nf_iterate(), BUG: unable to handle kernel NULL pointer dereference
openbsd-misc
:
Samuel Baldwin
Re: Forum engine
Robert
disklabel - cylinder rounding
nixlists
Re: Which laptops do the developers use?
Marcin
Re: 4.6 reboots x336 ibm server(s)
L. V. Lammert
OT, .. but has anyone seen a crontab editor
Colocation donated by:
Syndicate