[erlang-questions] FreeBSD cpu topology detection

Paul Guyot pguyot@REDACTED
Sun Oct 19 17:37:11 CEST 2014


>>> No one reported that topology detection worked.
> 
> Well, you didn't ask for that information.:-) Nor did you mention either
> the FreeBSD or the OTP version where you were seeing the problem...
> FWIW, it seems to work just fine for me on the 2-core/4-logical and
> 4-core/8-logical FreeBSD systems I use regularly, with a variety of
> FreeBSD and OTP versions. I'm also pretty sure Raimo would have
> mentioned if it was broken on any of his machines.
> 
> 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).

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
-- 
Semiocast            https://urldefense.proofpoint.com/v1/url?u=http://semiocast.com/&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=%2BeQ4KDUqB%2Ba5p47eZISTJX4bLLnoLmTlWbkSNWD9lg0%3D%0A&m=FRskHluaRj5g5CmdMtt2fpqEsXrw5uG3NvKr4zemG8s%3D%0A&s=3880a517df1d49a49e236d21eee7604d24d5c084ca49a6a7736a13700d489ea4
+33.183627948 - 20 rue Lacaze, 75014 Paris

_______________________________________________
erlang-questions mailing list
erlang-questions@REDACTED
https://urldefense.proofpoint.com/v1/url?u=http://erlang.org/mailman/listinfo/erlang-questions&k=ZVNjlDMF0FElm4dQtryO4A%3D%3D%0A&r=%2BeQ4KDUqB%2Ba5p47eZISTJX4bLLnoLmTlWbkSNWD9lg0%3D%0A&m=FRskHluaRj5g5CmdMtt2fpqEsXrw5uG3NvKr4zemG8s%3D%0A&s=09705ed8a6bbfa927099cb2f5604972e6ac2e14f37a389bb32e67f90afd1b390


More information about the erlang-questions mailing list