[erlang-questions] FreeBSD cpu topology detection

Per Hedeland per@REDACTED
Mon Oct 20 09:13:00 CEST 2014


Paul Guyot <pguyot@REDACTED> wrote:
>[I wrote:]
>> 
>> Since another poster also saw the problem, and mentioned that he was
>> running FreeBSD 10.something, it might be a FreeBSD-10-specific problem
>> - personally I haven't tried Erlang/OTP on FreeBSD-10 yet.
>
>I am amazed that the parser is written (which I authored) instead of being debugged… I don't mean it's exceptional code, and it actually needed more love and especially tests…
>
>The issue is not FreeBSD 10 but rather FreeBSD 10's default compiler (clang). There was a bug in this code with an undefined behavior. Older versions of gcc (which we use) behave as expected by the code, while clang and gcc devel (4.9) do not (only gcc 4.9 warns about it).

Ah, that explains it! I actually had 10.0 installed in a different
partition on the 2-core/4-logical box (running FreeBSD 9.1) where the
topology detection worked fine, and trying out 10.0 on that box with the
FreeBSD Erlang package (pre-compiled, presumably by clang) I also got
the 'undefined'. But kern.sched.topology_spec was identical between 9.1
and 10.0!

--Per

>I pushed a three-line fix :
>https://github.com/pguyot/otp/commit/c8ae3f2797d9c613e07b916683c51efea2da81aa
>
>This fix has the advantage of not introducing unwanted regression.
>
>Garret, could you please test it and determine if it works for you?
>I am definitely willing to debug this old code if you do provide unworking outputs of kern.sched.topology_spec.
>
>As a side note, I'm wondering why your code reads the number of cores with sysctl kern.smp.cpus. This is filled by the emulator upstream.
>
>Paul



More information about the erlang-questions mailing list