Bug 264819 - panic: pci_get_bus failed for pcib0 on bus legacy0, error = 2 at mptable_pci_host_res_init
Summary: panic: pci_get_bus failed for pcib0 on bus legacy0, error = 2 at mptable_pci_...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: John Baldwin
URL: https://reviews.freebsd.org/D35548
Keywords: crash, needs-qa
Depends on:
Blocks:
 
Reported: 2022-06-22 01:35 UTC by Dennis Clarke
Modified: 2022-07-13 18:22 UTC (History)
1 user (show)

See Also:
jhb: mfc-stable13+
jhb: mfc-stable12+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Clarke 2022-06-22 01:35:51 UTC
To be fair this is an old old machine and I was merely testing but
here is what I see from the serial console : 

Loading kernel...
/boot/kernel/kernel text=0xfe834 text=0xb1fc10 text=0x5feb24 data=0xb0 data=0x10e214+0x31f794 0x4+0xf02c0+0x4+0x188333|
Loading configured modules...
can't find '/etc/hostid'
can't find '/boot/entropy'
GDB: no debug ports present
KDB: debugger backends: ddb
KDB: current backend: ddb
---<<BOOT>>---
MP Configuration Table version 1.4 found at 0x49f160
Firmware Error (ACPI): A valid RSDP was not found (20220331/tbxfroot-369)
APIC: Using the MPTable enumerator.
Copyright (c) 1992-2022 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 14.0-CURRENT #0 main-n256174-c692ea40265: Fri Jun 17 07:59:39 UTC 2022
    root@releng1.nyi.freebsd.org:/usr/obj/usr/src/i386.i386/sys/GENERIC i386
FreeBSD clang version 14.0.5 (https://github.com/llvm/llvm-project.git llvmorg-14.0.5-0-gc12386ae247c)
WARNING: WITNESS option enabled, expect reduced performance.
VT(vga): resolution 640x480
Preloaded elf kernel "/boot/kernel/kernel" at 0x22cb000.
Preloaded TSLOG data "TSLOG" at 0x22d3af4.
Early TSC frequency 399019910Hz calibrated from 8254 PIT
CPU: Pentium II/Pentium II Xeon/Celeron (399.02-MHz 686-class CPU)
  Origin="GenuineIntel"  Id=0x652  Family=0x6  Model=0x5  Stepping=2
  Features=0x183fbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,MMX,FXSR>
Instruction TLB: 4 KB pages, 4-way set associative, 32 entries
Instruction TLB: 4 MB pages, fully associative, 2 entries
Data TLB: 4 KB pages, 4-way set associative, 64 entries
2nd-level cache: 512 KB, 4-way set associative, 32 byte line size
1st-level instruction cache: 16 KB, 4-way set associative, 32 byte line size
Data TLB: 4 MB Pages, 4-way set associative, 8 entries
1st-level data cache: 16 KB, 4-way set associative, 32 byte line size
real memory  = 805306368 (768 MB)
Physical memory chunk(s):
0x0000000000001000 - 0x000000000009dfff, 643072 bytes (157 pages)
0x0000000000100000 - 0x00000000007fffff, 7340032 bytes (1792 pages)
0x0000000002500000 - 0x000000002f0e4fff, 750669824 bytes (183269 pages)
avail memory = 756310016 (721 MB)
MPTable: <SMP: Added CPU 1 (BSP)
SMP: Added CPU 0 (AP)
HP       XU/XW       >
Event timer "LAPIC" quality 100
LAPIC: ipi_wait() us multiplier 9 (r 4000105 tsc 399019910)
Package ID shift: 0
L2 cache ID shift: 0
L1 cache ID shift: 0
INTR: Adding local APIC 0 as a target
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
FreeBSD/SMP: 2 package(s) x 1 core(s)
Package HW ID = 1
                CPU0 (BSP): APIC ID: 1
Package HW ID = 0
                CPU1 (AP): APIC ID: 0
Pentium Pro MTRR support enabled
bios32: Found BIOS32 Service Directory header at 0x4f70b0
bios32: Entry = 0xfd7ac (4fd7ac)  Rev = 0  Len = 1
pcibios: PCI BIOS entry at 0xfd720+0x291
pnpbios: Found PnP BIOS data at 0x4f7110
pnpbios: Entry = f0000:ada2  Rev = 1.0
Other BIOS signatures found:
random: no preloaded entropy cache
random: no platform bootloader entropy
arc4random: WARNING: initial seeding bypassed the cryptographic random device because it was not yet seeded and the knob 'bypass_before_seeding' was enabled.
VIMAGE (virtualized network stack) enabled
hostuuid: using 00000000-0000-0000-0000-000000000000
ULE: setup cpu 0
ULE: setup cpu 1
ioapic0: Assuming intbase of 0
ioapic0: ver 0x11 maxredir 0x17
ioapic0: Routing external 8259A's -> intpin 0
ioapic0: Routing IRQ 0 -> intpin 2
lapic: Routing ExtINT -> LINT0
lapic: LINT0 trigger: edge
lapic: LINT0 polarity: high
lapic: Routing NMI -> LINT1
lapic: LINT1 trigger: edge
lapic: LINT1 polarity: high
ioapic0 <Version 1.1> irqs 0-23
cpu0 BSP:
     ID: 0x01000000   VER: 0x00040011 LDR: 0x00000000 DFR: 0xffffffff
  lint0: 0x00010700 lint1: 0x00000400 TPR: 0x00000000 SVR: 0x000001ff
  timer: 0x000100ef therm: 0x00000000 err: 0x000000f0 pmc: 0x00010400
CPU0: local APIC error 0x80
SMP: AP CPU #1 Launched!
cpu1 AP:
     ID: 0x00000000   VER: 0x00040011 LDR: 0x00000000 DFR: 0xffffffff
  lint0: 0x00010700 lint1: 0x00000400 TPR: 0x00000000 SVR: 0x000001ff
  timer: 0x000100ef therm: 0x00000000 err: 0x000000f0 pmc: 0x00010400
TSC timecounter disables C2 and C3.
CPU1: local APIC error 0x80
snd_unit_init() u=0x00ff8000 [512] d=0x00007c00 [32] c=0x000003ff [1024]
feeder_register: snd_unit=-1 snd_maxautovchans=16 latency=2 feeder_rate_min=1 feeder_rate_max=2016000 feeder_rate_round=25
wlan: <802.11 Link Layer>
random: entropy device external interface
kbd: new array size 4
kbd1 at kbdmux0
crypto: <crypto core>
mem: <memory>
null: <full device, null device, zero device>
io: <I/O>
[ath_hal] loaded
Firmware Error (ACPI): A valid RSDP was not found (20220331/tbxfroot-369)
ACPI: Table initialisation failed: AE_NOT_FOUND
ACPI: Try disabling either ACPI or apic support.
vtvga0: <VT VGA driver>
crypto: assign cryptosoft0 driver id 0, flags 0x6000000
aesni0: No AES or SHA support.
pci_open(1):    mode 1 addr port (0x0cf8) is 0x80003b90
pci_open(1a):   mode1res=0x80000000 (0x80000000)
pci_cfgcheck:   device 0 [class=060000] [hdr=00] is there (id=71908086)
pcibios: BIOS version 2.10
pcib0: <MPTable Host-PCI bridge> pcibus 0
panic: pci_get_bus failed for pcib0 on bus legacy0, error = 2
cpuid = 0
time = 1
KDB: stack backtrace:
db_trace_self_wrapper(2,1d83720,2,e042a80,e044ed0,...) at db_trace_self_wrapper+0x28/frame 0x24f9b3c
vpanic(154f803,24f9b78,24f9b78,24f9bbc,141582b,...) at vpanic+0xf4/frame 0x24f9b58
panic(154f803,146e415,e044ed0,e030c60,2,...) at panic+0x14/frame 0x24f9b6c
mptable_pci_host_res_init(e042a80) at mptable_pci_host_res_init+0x2eb/frame 0x24f9bbc
mptable_hostb_attach(e042a80) at mptable_hostb_attach+0xd/frame 0x24f9bcc
device_attach(e042a80) at device_attach+0x301/frame 0x24f9bf4
device_probe_and_attach(e042a80) at device_probe_and_attach+0x5f/frame 0x24f9c0c
bus_generic_attach(e042b00) at bus_generic_attach+0x16/frame 0x24f9c1c
legacy_attach(e042b00) at legacy_attach+0xe6/frame 0x24f9c30
device_attach(e042b00) at device_attach+0x301/frame 0x24f9c58
device_probe_and_attach(e042b00) at device_probe_and_attach+0x5f/frame 0x24f9c70
bus_generic_attach(e042e00) at bus_generic_attach+0x16/frame 0x24f9c80
nexus_attach(e042e00) at nexus_attach+0x5c/frame 0x24f9c90
device_attach(e042e00) at device_attach+0x301/frame 0x24f9cb8
device_probe_and_attach(e042e00,7fffffff,e02ff80,e043000,24f9d00,...) at device_probe_and_attach+0x5f/frame 0x24f9cd0
bus_generic_new_pass(e043000) at bus_generic_new_pass+0xcb/frame 0x24f9ce8
bus_set_pass(7fffffff) at bus_set_pass+0x24/frame 0x24f9d00
root_bus_configure(24f9d38,f8c444,0,1b10280,0,...) at root_bus_configure+0xd/frame 0x24f9d0c
configure(0) at configure+0x8/frame 0x24f9d14
mi_startup() at mi_startup+0x214/frame 0x24f9d38
btext() at btext+0x5f
KDB: enter: panic
[ thread pid 0 tid 100000 ]
Stopped at      kdb_enter+0x34: movl    $0,kdb_why
db> 

So this is a real genuine Intel Pentium II machine with dual sockets.

I will try FreeBSD 13.1 and see what happens on the same hardware. 

Dennis Clarke
Comment 1 Andriy Gapon freebsd_committer freebsd_triage 2022-06-22 11:34:50 UTC
It seems that mptable_pci_host_res_init() should not use pci_get_bus().
At minimum, it should use pcib_get_bus (note 'b') but it looks that the most proper method would be legacy_get_picbus.

The same is true for mptable_hostb_probe().
pcib_get_bus works there because PCIB_IVAR_BUS happens (or is designed) to have the same value as LEGACY_IVAR_PCIBUS.
Comment 2 Dennis Clarke 2022-06-22 13:11:55 UTC
I reverted ( or made the safe leap ) over to 13.1 RELEASE in order to
just get the machine working. Which it is. However I can always swap
around SCSI disks to check on this bug in the near future. The machine
has an external old Sun Microsystems SCSI disk pack as storage. So that
makes a swap around to CURRENT pretty trivial.

Dennis Clarke
Comment 3 John Baldwin freebsd_committer freebsd_triage 2022-06-22 15:50:53 UTC
Andriy is correct, both places should be using legacy_get_pcibus().
Comment 4 John Baldwin freebsd_committer freebsd_triage 2022-06-22 15:58:21 UTC
Patch at https://reviews.freebsd.org/D35548
Comment 5 Kubilay Kocak freebsd_committer freebsd_triage 2022-06-23 00:43:35 UTC
^Triage: Assign to committer resolving
Comment 6 commit-hook freebsd_committer freebsd_triage 2022-06-23 17:52:43 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=b076d8d54c2fd91a35aad6931d0bfa2aa0122036

commit b076d8d54c2fd91a35aad6931d0bfa2aa0122036
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-06-23 17:49:09 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-06-23 17:49:09 +0000

    mptable_hostb: Use legacy_get_pcibus() to fetch PCI bus number.

    The mptable_hostb driver is a child of legacy0 and has legacy bus
    ivars, not PCI or PCI bridge ivars.

    PR:             264819
    Reported by:    Dennis Clarke <dclarke@blastwave.org>
    Diagnosed by:   avg
    Reviewed by:    avg
    MFC after:      1 week
    Differential Revision:  https://reviews.freebsd.org/D35548

 sys/x86/x86/mptable.c     | 2 +-
 sys/x86/x86/mptable_pci.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Comment 7 Dennis Clarke 2022-06-25 03:34:51 UTC
I will test this on the problem hardware but not until I see a snapshot
released. That makes the process trivial to test. Otherwise a whole
buildworld + buildkernel would be painful on an old i686 machine.

Dennis
Comment 8 commit-hook freebsd_committer freebsd_triage 2022-07-13 16:48:41 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=516846b256483cbce82933e1cb9ba0cf7b5279ec

commit 516846b256483cbce82933e1cb9ba0cf7b5279ec
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-06-23 17:49:09 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-07-13 16:21:10 +0000

    mptable_hostb: Use legacy_get_pcibus() to fetch PCI bus number.

    The mptable_hostb driver is a child of legacy0 and has legacy bus
    ivars, not PCI or PCI bridge ivars.

    PR:             264819
    Reported by:    Dennis Clarke <dclarke@blastwave.org>
    Diagnosed by:   avg
    Reviewed by:    avg
    Differential Revision:  https://reviews.freebsd.org/D35548

    (cherry picked from commit b076d8d54c2fd91a35aad6931d0bfa2aa0122036)

 sys/x86/x86/mptable.c     | 2 +-
 sys/x86/x86/mptable_pci.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Comment 9 commit-hook freebsd_committer freebsd_triage 2022-07-13 17:53:53 UTC
A commit in branch stable/12 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=ece27cdfb33cc5dc2420653d7f86bff4f5aa344a

commit ece27cdfb33cc5dc2420653d7f86bff4f5aa344a
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-06-23 17:49:09 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-07-13 16:52:58 +0000

    mptable_hostb: Use legacy_get_pcibus() to fetch PCI bus number.

    The mptable_hostb driver is a child of legacy0 and has legacy bus
    ivars, not PCI or PCI bridge ivars.

    PR:             264819
    Reported by:    Dennis Clarke <dclarke@blastwave.org>
    Diagnosed by:   avg
    Reviewed by:    avg
    Differential Revision:  https://reviews.freebsd.org/D35548

    (cherry picked from commit b076d8d54c2fd91a35aad6931d0bfa2aa0122036)

 sys/x86/x86/mptable.c     | 2 +-
 sys/x86/x86/mptable_pci.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)