Re:A tale of an impossible bug: big.LITTLE and caching
by wyldfire on Monday September 12, 2016 @05:52PM
(#12484003)
It should converge to the right value eventually but does seem like there's definitely a chance for it to be wrong one or more times before running on the little cores.
Re:A tale of an impossible bug: big.LITTLE and caching
by hrydgard on Monday September 12, 2016 @03:47PM
(#12483035)
It's fine if core migration happens during the invalidation loop - the core migration itself surely must wipe the non-shared cache levels thoroughly, otherwise nothing would work.
EDIT: Actually if the big and little cores are used together, and not exclusively, then this might still be an issue, yeah.
Re:A tale of an impossible bug: big.LITTLE and caching
by pm215 on Monday September 12, 2016 @04:10PM
(#12483224)
No, in general Linux migrating processes between cores won't nuke the caches. The hardware's cache coherency protocols between CPUs in the cluster ensures that they are all in sync sufficiently that it's not needed.
Re:A tale of an impossible bug: big.LITTLE and caching
by hrydgard on Monday September 12, 2016 @04:23PM
(#12483308)
I understood that the configurations currently in use usually only power up either the big or little cores at the same time, and that kind of migration has to wipe the caches, right? But that might be inaccurate, and you are of course right in the general case.
Re:A tale of an impossible bug: big.LITTLE and caching
by pm215 on Monday September 12, 2016 @04:46PM
(#12483498)
The state of the art in Linux scheduler handling of big.LITTLE hardware has moved through several different models, getting steadily better at getting best performance from the hardware (wikipedia has a good brief rundown: https://en.wikipedia.org/wiki/ARM_big.LITTLE). You're thinking about the in-kernel-scheduler approach, but global task scheduling (where you just tell the scheduler about all the cores and let it move processes around to suit) has been the recommended approach for a few years now I think.
Re:A tale of an impossible bug: big.LITTLE and caching
by rodrigokumpera on Monday September 12, 2016 @03:52PM
(#12483082)
Yes and no.
Core migration don't need to reach a global synchronization point, just enough so that the 2 cores in question agree with each other. This can be done without requiring global visibility of all operations of the source core.
Re:A tale of an impossible bug: big.LITTLE and caching
by Senji on Tuesday September 13, 2016 @06:04AM
(#12486724)
Spin up N threads with single core affinities where N = total cores.
If anything, the OS should have an API to tell you this info in advance.
Re:A tale of an impossible bug: big.LITTLE and caching
by pm215 on Tuesday September 13, 2016 @06:43AM
(#12486879)
This won't work in the presence of CPU hotplug (which Android uses for power management), because some of the CPUs might not be online when you do it.
The API for "tell me this info" is "read the CTR_EL0 register"; it's a hardware bug that it doesn't do the right thing on this particular chip.
(Edit: rereading the blog post, they say they need to figure out the global minimum, but I can't see how their code actually does that, since there's nothing that guarantees that the icache flush code gets run on every cpu before it's needed in anger.)