Re: MMIO and gcc re-ordering issue
From: Paul Mackerras <hidden>
Date: 2008-06-11 05:13:50
Also in:
linux-arch, lkml
Nick Piggin writes:
quoted
I just wish we had even one actual example of things going wrong with the current rules we have on powerpc to motivate changing to this model.~/usr/src/linux-2.6> git grep test_and_set_bit drivers/ | wc -l 506 How sure are you that none of those forms part of a cobbled-together locking scheme that hopes to constrain some IO access?
My comment was precisely about the fact that this sort of argument is actually FUD. I want one example that is demonstrably wrong, not just a "how sure are you".
But surely you have to audit the drivers anyway to ensure they are OK with the current powerpc scheme. In which case, once you have audited them and know they are safe, you can easily convert them to the even _faster_ __readl/__writel, and just add the appropriate barriers.
The trouble is that as code gets maintained, using __writel + explicit barriers is more fragile because some people will change the code, or add new code, without understanding the barriers. So whenever a driver gets converted to using __writel + barriers, we will end up having to watch every change that goes into it forever. Whereas with the current scheme there's a much smaller set of gotchas to watch out for, and the gotchas are things that already raise red flags, such as open-coded locking and any sort of "clever" lockless scheme. Paul.