On Fri, Dec 2, 2016 at 1:10 PM, Linus Torvalds <torva...@linux-foundation.org> wrote: > On Fri, Dec 2, 2016 at 12:41 PM, Andy Lutomirski <l...@amacapital.net> wrote: >> >> Because, if so, we should maybe serialize whenever we migrate a >> process to a different CPU. > > The intel docs are bad on this issue. > > Technically what we do could fall under the "cross-modifying code" > case, where one CPU does the write, and then we run it on another CPU. > > And no, we do *not* do a serializing instruction before returning to > user space. Sure, we might do an iret (which is serializing), but we > equally well might be doing a systret (which is not). > > Honestly, I think Intel should clean up their documentation. >
I'm not sure I follow. If a user program gets migrated, it might end up doing cross-modification when it expects self-modification. If that trips the program up, is that a user bug or a kernel bug? Admittedly, I'd be very surprised if this happened in practice. Migration is *slow*, caches tend to get blown away, lots of code gets executed, etc. Presumably any prefetched / trace cached / decoded / i-cached user code is long gone when we migrate.