Disabling kernel hw-thread migration/stealing policies allows Ryzen to build lang/ghc (finally!)

Mark Millard markmi at dsl-only.net
Sat Aug 19 11:15:25 UTC 2017


On 2017-Aug-19, at 2:38 AM, Mark Millard <markmi at dsl-only.net> wrote:

> [This test was suggesetd by Don Lewis's comment 73
> for buugzilla 221029.]
> 
> I finally got a Ryzen based build of lang/ghc :
> 
> # pkg search ghc
> ghc-8.0.2_1                    Compiler for the functional language Haskell
> 
> This used as a kernel context with:
> 
> sysctl kern.sched.balance=0
> sysctl kern.sched.steal_idle=0
> 
> and a poudriere context of:
> 
> PARALLEL_JOBS=1
> ALLOW_MAKE_JOBS=no
> 
> and ALLOW_MAKE_JOBS_PACKAGES not having a match
> for lang/ghc
> 
> The Ryzen was not otherwise loaded with activity
> (beyond normal background stuff in a simple
> configuration).
> 
> (This means that kern.sched.balance=1 might
> have worked as it had nothing to do. In fact
> I have that test running now.)
> 
> By contrast for the kernel context:
> 
> sysctl kern.sched.balance=1
> sysctl kern.sched.steal_idle=1
> 
> the lang/ghc build fails quickly compared to
> the somewhat over 1.5 hours it took for a
> build to complete.
> 
> The detailed build step for the failure tends to
> vary from build attempt to build attempt. But they
> tend to involve Bus Errors for the failures.
> 
> 
> My context here is actually FreeBSD
> running as a guest in a VirtualBox
> virtual machine --that is running under
> Windows 10 Pro . The Ryzen has all 16
> threads enabled but Virtual Box is set
> to supply 8 "processors" to the virtual
> machine (in VirtualBox terminology).
> But Poudriere is set to avoid parallel
> builds.
> 
> Also: Prior build attempts had already
> built packages for lang/ghc's
> prerequisites. So the experiments here
> are just for the lang/ghc related
> build activity.


sysctl kern.sched.balance=0
sysctl kern.sched.steal_idle=0

with:

#PARALLEL_JOBS=1
ALLOW_MAKE_JOBS=yes

and ALLOW_MAKE_JOBS_PACKAGES having a match
for lang/ghc

also makes it to completion for building
lang/ghc . (Much of the time 8 hw-threads
being busy.)


Ryzen has problems with some aspect(s) of how
FreeBSD migrates work between threads.

May be some stronger form of barrier(s) or some
such would sidestep the issue(s) but be less
drastic than use of:

sysctl kern.sched.balance=0
sysctl kern.sched.steal_idle=0


===
Mark Millard
markmi at dsl-only.net




More information about the freebsd-amd64 mailing list