[Bug 263124] sys/x86/isa/clock.c: lapic_calibrate_timer() in cpu_initclocks() breaks compiling for non-SMP

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 07 Apr 2022 16:52:08 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=263124

            Bug ID: 263124
           Summary: sys/x86/isa/clock.c: lapic_calibrate_timer() in
                    cpu_initclocks() breaks compiling for non-SMP
           Product: Base System
           Version: 13.1-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: d8zNeCFG@aon.at

Created attachment 233034
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=233034&action=edit
config file for non-SMP build

Scenario:
- FreeBSD 13.0 latest
- Checking out releng/13.1 (= RC1) into /usr/src
- Building a non-SMP kernel with a custom config previously used for 13.0
("XYZZY")

Result:
- The build fails when linking the kernel with

linking kernel.full
ld: error: undefined symbol: apic_ops
>>> referenced by apicvar.h:386 (/net/hal/z/SRC/FreeBSD/src/MBi/releng/13.1/sys/x86/include/apicvar.h:386)
>>>               clock.o:(cpu_initclocks)
*** Error code 1

Expected result:
- The build should succeed even without "options SMP" and "device apic" being
defined in the kernel configuration file

Note: Diffing sys/x86/isa/clock.c between 13.0 and 13.1 yields:

68a69
> #include <x86/apicvar.h>
413a415,417
> 
>       tsc_calibrate();
>       lapic_calibrate_timer();
427a432,433
>       tsc_calibrate();
>       lapic_calibrate_timer();
457c463
<     CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_NEEDGIANT,
---
>     CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE,

It seems the calls to lapic_calibrate_timer() should be made conditional on the
SMP case.

The config file is attached.

-- Martin

-- 
You are receiving this mail because:
You are the assignee for the bug.