-
Notifications
You must be signed in to change notification settings - Fork 266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for FreeBSD on x86 #163
Conversation
To submit when we have continuous integration for FreeBSD via Vagrant. |
if (fd >= 0) { | ||
StackLineReader reader; | ||
StackLineReader_Initialize(&reader, fd); | ||
for (;;) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Out of curiosity, is there any difference with using while (true) {
?
EDIT: you're using for (;;)
also just below so for consistency, we should at least use the same semantic in both cases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No difference between for(;;)
and while(true)
. We could use either one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two comments...
#elif defined(CPU_FEATURES_OS_FREEBSD) | ||
auto& fs = GetEmptyFilesystem(); | ||
fs.CreateFile("/var/run/dmesg.boot", R"( | ||
---<<BOOT>>--- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though this will be moot when the branch goes EOL at the end of September, FreeBSD 11 does not have this line in dmesg.boot
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack. It was present in a dump of a FreeBSD 12.2-RELEASE r366954 GENERIC amd64
---<<BOOT>>---
Copyright (c) 1992-2020 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.2-RELEASE r366954 GENERIC amd64
FreeBSD clang version 10.0.1 (git@github.com:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611aa2)
VT(vga): text 80x25
module vtnet already present!
CPU: Intel(R) Core(TM) i7-10710U CPU @ 1.10GHz (1607.96-MHz K8-class CPU)
Origin="GenuineIntel" Id=0xa0660 Family=0x6 Model=0xa6 Stepping=0
Features=0x1783fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR,SSE,SSE2,HTT>
Features2=0x5eda2203<SSE3,PCLMULQDQ,SSSE3,CX16,PCID,SSE4.1,SSE4.2,MOVBE,POPCNT,AESNI,XSAVE,OSXSAVE,AVX,RDRAND>
AMD Features=0x28100800<SYSCALL,NX,RDTSCP,LM>
AMD Features2=0x121<LAHF,ABM,Prefetch>
Structured Extended Features=0x842421<FSGSBASE,AVX2,INVPCID,NFPUSG,RDSEED,CLFLUSHOPT>
Structured Extended Features3=0x30000400<MD_CLEAR,L1DFL,ARCH_CAP>
TSC: P-state invariant
real memory = 2147418112 (2047 MB)
avail memory = 2044313600 (1949 MB)
FWIW we don't use this line but it's a representative input.
Already failing on 14-CURRENT:
|
edit: @vishwin beat me to it. |
Thx @mldulaney and @vishwin ! We're waiting to have at least one FreeBSD CI before moving on with this patch. |
@gchatelet FYI: default: /usr/home/vagrant/project/test/cpuinfo_x86_test.cc
default: :
default: 762:3: error: use of undeclared identifier 'fs'
default: fs.CreateFile("/var/run/dmesg.boot", R"(
default: ^
default: /usr/home/vagrant/project/test/cpuinfo_x86_test.cc:837:3: error: use of undeclared identifier 'fs'
default: fs.CreateFile("/var/run/dmesg.boot", R"(
default: ^
default: 2 errors generated.
default: *** Error code 1
default:
default: Stop.
default: make[2]: stopped in /usr/home/vagrant/project/build
default: *** Error code 1
default:
default: Stop.
default: make[1]: stopped in /usr/home/vagrant/project/build
default: *** Error code 1
default:
default: Stop.
default: make: stopped in /usr/home/vagrant/project/build ref: https://github.com/google/cpu_features/runs/2954585917?check_suite_focus=true#step:5:902 |
-- Looking for getauxval - not found -- Configuring incomplete, errors occurred! |
Not familiar with this lib but you should never parse dmesg.boot or use some sysctl to obtain this info. |
Thx a lot @evadot. This is exactly what I was looking for. From the documentation: |
FreeBSD 11 will be EOL in september so I wouldn't bother. |
1 similar comment
FreeBSD 11 will be EOL in september so I wouldn't bother. |
@evadot let me know if I understand this correctly. Now |
That's for the linuxulator. |
Thx for your answer @evadot. This project already uses the An interesting sidenote, for Darwin - which is FreeBSD based - the OS disables AVX512 registers save/restore by default and enables them right after the first fault. Thus querying the CPU for AVX512 OS support fails even though it works (source). |
As discussed, let's submit this as-is to repair the build. I'll address the TODO in a subsequent PR. |
Thanks! |
This is replacing #159 and fixes #158