[erlang-questions] FreeBSD cpu topology detection
Mon Oct 20 09:13:00 CEST 2014
Paul Guyot <pguyot@REDACTED> 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
>I pushed a three-line fix :
>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.
More information about the erlang-questions