* [PATCH] xen: disable interrupts before saving in percpu
@ 2009-02-04 0:01 Jeremy Fitzhardinge
2009-02-04 1:23 ` H. Peter Anvin
0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-04 0:01 UTC (permalink / raw)
To: Ingo Molnar
Cc: the arch/x86 maintainers, Linux Kernel Mailing List, Xen-devel,
Stable Kernel
xen_mc_batch has a small preempt race where it takes the address of a
percpu variable immediately before disabling interrupts, thereby
leaving a small window in which we may migrate to another cpu and save
the flags in the wrong percpu variable. Disable interrupts before
saving the old flags in a percpu.
Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@citrix.com>
---
arch/x86/xen/multicalls.h | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
===================================================================
--- a/arch/x86/xen/multicalls.h
+++ b/arch/x86/xen/multicalls.h
@@ -19,8 +19,10 @@
paired with xen_mc_issue() */
static inline void xen_mc_batch(void)
{
+ unsigned long flags;
/* need to disable interrupts until this entry is complete */
- local_irq_save(__get_cpu_var(xen_mc_irq_flags));
+ local_irq_save(flags);
+ __get_cpu_var(xen_mc_irq_flags) = flags;
}
static inline struct multicall_space xen_mc_entry(size_t args)
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] xen: disable interrupts before saving in percpu
2009-02-04 0:01 [PATCH] xen: disable interrupts before saving in percpu Jeremy Fitzhardinge
@ 2009-02-04 1:23 ` H. Peter Anvin
2009-02-04 2:15 ` Jeremy Fitzhardinge
0 siblings, 1 reply; 4+ messages in thread
From: H. Peter Anvin @ 2009-02-04 1:23 UTC (permalink / raw)
To: Jeremy Fitzhardinge
Cc: Ingo Molnar, the arch/x86 maintainers, Linux Kernel Mailing List,
Xen-devel, Stable Kernel
Jeremy Fitzhardinge wrote:
> xen_mc_batch has a small preempt race where it takes the address of a
> percpu variable immediately before disabling interrupts, thereby
> leaving a small window in which we may migrate to another cpu and save
> the flags in the wrong percpu variable. Disable interrupts before
> saving the old flags in a percpu.
Applied to tip:core/xen, thanks!
-hpa
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] xen: disable interrupts before saving in percpu
2009-02-04 1:23 ` H. Peter Anvin
@ 2009-02-04 2:15 ` Jeremy Fitzhardinge
2009-02-04 2:21 ` H. Peter Anvin
0 siblings, 1 reply; 4+ messages in thread
From: Jeremy Fitzhardinge @ 2009-02-04 2:15 UTC (permalink / raw)
To: H. Peter Anvin
Cc: Ingo Molnar, the arch/x86 maintainers, Linux Kernel Mailing List,
Xen-devel, Stable Kernel
H. Peter Anvin wrote:
> Jeremy Fitzhardinge wrote:
>
>> xen_mc_batch has a small preempt race where it takes the address of a
>> percpu variable immediately before disabling interrupts, thereby
>> leaving a small window in which we may migrate to another cpu and save
>> the flags in the wrong percpu variable. Disable interrupts before
>> saving the old flags in a percpu.
>>
>
> Applied to tip:core/xen, thanks!
Can you push this Linusward too?
Thanks,
J
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH] xen: disable interrupts before saving in percpu
2009-02-04 2:15 ` Jeremy Fitzhardinge
@ 2009-02-04 2:21 ` H. Peter Anvin
0 siblings, 0 replies; 4+ messages in thread
From: H. Peter Anvin @ 2009-02-04 2:21 UTC (permalink / raw)
To: Jeremy Fitzhardinge
Cc: Ingo Molnar, the arch/x86 maintainers, Linux Kernel Mailing List,
Xen-devel, Stable Kernel
Jeremy Fitzhardinge wrote:
> H. Peter Anvin wrote:
>> Jeremy Fitzhardinge wrote:
>>
>>> xen_mc_batch has a small preempt race where it takes the address of a
>>> percpu variable immediately before disabling interrupts, thereby
>>> leaving a small window in which we may migrate to another cpu and save
>>> the flags in the wrong percpu variable. Disable interrupts before
>>> saving the old flags in a percpu.
>>>
>>
>> Applied to tip:core/xen, thanks!
>
> Can you push this Linusward too?
>
Just merged into tip:core/urgent, so it should end up in the next set of
pull requests.
-hpa
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-02-04 2:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-04 0:01 [PATCH] xen: disable interrupts before saving in percpu Jeremy Fitzhardinge
2009-02-04 1:23 ` H. Peter Anvin
2009-02-04 2:15 ` Jeremy Fitzhardinge
2009-02-04 2:21 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox