Re: [PATCH 4/5] kgdb: Use atomic operators which use barriers
From: Linus Torvalds
Date: Mon Apr 05 2010 - 11:01:43 EST
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
> ...so I don't think inserting smp_mb() into cpu_relax() and udelay()
> and similar can ever fix the problem fully.
> 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
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/