Page MenuHomeFreeBSD

sys/conf: add options to test for x86
AcceptedPublic

Authored by ehem_freebsd_m5p.com on Oct 20 2022, 3:25 AM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Apr 11, 2:39 PM
Unknown Object (File)
Sun, Mar 31, 1:41 PM
Unknown Object (File)
Mar 9 2024, 5:05 PM
Unknown Object (File)
Feb 8 2024, 1:35 PM
Unknown Object (File)
Jan 11 2024, 12:19 AM
Unknown Object (File)
Dec 20 2023, 8:21 AM
Unknown Object (File)
Nov 17 2023, 9:46 PM
Unknown Object (File)
Nov 17 2023, 5:27 PM
Subscribers

Details

Reviewers
kevans
Summary

All other architectures can be detected by some name for excluding
files. Add options appropriate to flag x86 machines.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 47927
Build 44814: arc lint + arc unit

Event Timeline

Updating per @kevans91 on IRC. I would prefer to have !x86, but !i386 !amd64 is good enough.

kevans added a subscriber: kevans.
kevans added inline comments.
sys/conf/options.amd64
5

This X86 option here and in options.i386 won't work, and I don't think we want to hack config(8) to make it work.

See config[0]'s option generation logic; it sets:

  • cputype as an option
  • MAXUSERS as an option
  • $MACHINE_ARCH, if said option exists
  • all of the options specified in options directives

This would need some extra logic to fake an X86 option for amd64 || i386 so that the positive sense of x86 in files* predicates works, and I'm not sure if it's worth it without more examples of !i386 !amd64 cropping up.

[0] https://cgit.freebsd.org/src/tree/usr.sbin/config/mkoptions.c#n65

This revision is now accepted and ready to land.Oct 20 2022, 4:43 AM

I'm not sure that I like it at all.
arm has armv6 and armv7 as a historical accident because we supported armv4 and armv5. It's currently useless there:

cddl/compat/opensolaris/kern/opensolaris_atomic.c: optional !armv7 !armv6 zfs | !armv7 !armv6 dtrace compile-with "${CDDL_C}"

one of armv6 or armv7 will be defined, so this line is never used.

../sys/conf/files.arm:dev/hwpmc/hwpmc_armv7.c		optional	hwpmc armv6
../sys/conf/files.arm:dev/hwpmc/hwpmc_armv7.c		optional	hwpmc armv7

So these should be spelled optional hwpmc

../sys/conf/files.arm:libkern/arm/ffs.S		optional	!armv7 !armv6
../sys/conf/files.arm:libkern/ffsl.c			optional	!armv7 !armv6
../sys/conf/files.arm:libkern/ffsll.c			optional	!armv7 !armv6
../sys/conf/files.arm:libkern/fls.c			optional	!armv7 !armv6
../sys/conf/files.arm:libkern/flsl.c			optional	!armv7 !armv6
../sys/conf/files.arm:libkern/flsll.c			optional	!armv7 !armv6

These all should just be deleted. I plan on doing that later today.

arm64 is unused.

powerpc it's used because we have 32-bit and 64-bit support in one kernel tree (which is unique in the tree). But there it's over used to mark drivers that are 64-bit only (and it doesn't tag the ones that would work on powerpc64le correctly). Most of the 'marking' ones should just be deleted and those drivers shouldn't be in GENERIC, just GENERIC64. Once you remove the 'abusers' in the list, there's very few that are required... Not sure it's worth a good scrubbing though.

It's unused on riscv.

So I'm quite cold to this proposal, even after reading on IRC where it would be used on those platforms w/o intrng... IMHO, those things should be marked as !intrng and we have an option for that instead rather than doing this. For other options, like 'new_pcib' we just toss this in the DEFAULTS file and key off of that.

This isn't a veto, but this is a strong word of warning that you are doing it wrong, imho