lkml.org 
[lkml]   [2010]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/5] kgdb: Use atomic operators which use barriers


On Mon, 5 Apr 2010, Pavel Machek wrote:
>
> And this is valid (but ugly and not optimal) kernel code:
>
> kernel/sched.c- while (task_is_waking(p))
> kernel/sched.c: asm volatile("" :: "memory");

No. We would consider such code buggy.

That said, you're right that such code would exist. But if it were to
exist and cause lock-ups, at least I would consider it a simple and
outright bug, and that the proper fix would be to just replace the asm
with cpu_relax().

> ...so I don't think inserting smp_mb() into cpu_relax() and udelay()
> and similar can ever fix the problem fully.

See above.

> Run smp_mb() from periodic interrupt?

Doesn't help - it's quite valid to do things like this in irq-disabled
code, although it is hopefully very very rare.

In particular, I suspect the kgdb use _is_ interrupts disabled, and is why
the ARM people even noticed (the normal cases would break out of the loop
exactly because an interrupt occurred, and an interrupt is probably
already enough to make the issue go away).

And please do not confuse this with smp_mb() - this is not about the Linux
notion of a memory barrier, this is about whatever per-arch oddity that
makes changes not be noticed (ie caches may be _coherent_, but they are
not "timely").

Linus


\
 
 \ /
  Last update: 2010-04-05 17:03    [W:0.069 / U:1.172 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site