[Bug 219399] System panics after several hours of 14-threads-compilation orgies using poudriere on AMD Ryzen...

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Jul 25 23:10:45 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=219399

--- Comment #134 from Don Lewis <truckman at FreeBSD.org> ---
(In reply to Don Lewis from comment #124)
The AMD documentation that I've found is pretty much silent about
cross-modifying code.  My interpretation of the pseudo-code that I found in the
Intel documentation is that nothing other than the lock followed by CPUID is
necessary.  They don't mention anything about the need for fence instructions.

Is this a Ryzen bug?  Yes, it looks like one to me.  Do I care, probably not. 
I don't need to run contrived cross-modifying code.  I don't think this affects
FreeBSD.  I suspect that anyplace that we do something like this there is
likely be some code that changes the page permissions to remove write access
and adds execute access between where the code is written and where it is
executed.  That is probably sufficient distance to flush out the inconsistent
state from the CPU before it tries to execute the code.  If this was not the
case, I would expect that FreeBSD would hardly run at all on Ryzen.

In any case, I think there is a software workaround.  Just do a read access of
the newly written instructions before the CPUID.  Maybe a fence instruction is
needed as well.

I'm surprised that this problem seems to be worse with SMT.  I would think that
cross-modifying between threads on the same core would be the best case and
running on cores belonging to different CCXes would be the worst case ...

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list