News for hackers. Stuff that matters.
Re:A tale of an impossible bug: big.LITTLE and caching by caf on Monday September 12, 2016 @11:01PM (#12485368)
How is this safe in the multithreaded case anyway? If a process has just written a new JITted method and is flushing the i$ on the CPU it's executing on, but then gets scheduled away part-way through the flush, if you were very unlucky then couldn't another thread then get scheduled on that CPU and try to execute the just-written method, which failed to be fully flushed from that CPU's cache?
Re:A tale of an impossible bug: big.LITTLE and caching by rodrigokumpera on Tuesday September 13, 2016 @02:48AM (#12486075)
Multi-threaded safety is simply due to JIT controlling the visibility of the newly compiled code. First flush, then make it visible for execution, can't go wrong with that and scheduling won't matter.

Things get a lot more complicated when it comes to code patching, but the principle is similar.

Re:A tale of an impossible bug: big.LITTLE and caching by caf on Tuesday September 13, 2016 @03:08AM (#12486141)
I don't think that helps - the point is that the flush might not be effective if the flushing thread gets scheduled away from the core which has the stale I$ before it manages to fully issue the flush.

Or is the flush guaranteed to flush all cores caches? That would be a fairly unusual design.

Re:A tale of an impossible bug: big.LITTLE and caching by oshepherd on Tuesday September 13, 2016 @07:56AM (#12487269)
IC IVAU instructions are broadcast to all cores in the same 'inner shareable domain' (all cores running the same OS instance are in the same inner shareable domain)
Re:A tale of an impossible bug: big.LITTLE and caching by caf on Tuesday September 13, 2016 @10:04AM (#12488295)
That does seem like a good solution to let you do this kind of invalidation in userspace. Thanks.