Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 04 Sep 2024 18:06:00 -0700
From:      Cy Schubert <Cy.Schubert@cschubert.com>
To:        Konstantin Belousov <kostikbel@gmail.com>
Cc:        Cy Schubert <Cy.Schubert@cschubert.com>, src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: 65b133e5d292 - main - x86: allow to have more than one kind of IOMMU
Message-ID:  <20240905010600.B9D292A@slippy.cwsent.com>
In-Reply-To: <Ztj9XU2ETM9gKP7r@kib.kiev.ua>
References:  <202409042150.484LoeAq031493@gitrepo.freebsd.org> <20240904235204.1FCD9C5@slippy.cwsent.com> <Ztj9XU2ETM9gKP7r@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
In message <Ztj9XU2ETM9gKP7r@kib.kiev.ua>, Konstantin Belousov writes:
> On Wed, Sep 04, 2024 at 04:52:04PM -0700, Cy Schubert wrote:
> > I suspect this commit but could be one of the others that caused this panic
>  
> > during intialization. From a serial console log:
> > 
> > Hit [Enter] to boot immediately, or any other key for command prompt.
> > Booting [/boot/kernel/kernel] in 10 seconds... ^MBooting 
> > [/boot/kernel/kernel] in 9 seconds... ^MBooting [/boot/kernel/kernel]...   
>  
> >            ^M
> > \^HGDB: no debug ports present
> > KDB: debugger backends: ddb
> > KDB: current backend: ddb
> > ---<<BOOT>>---
> > Copyright (c) 1992-2024 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 15.0-CURRENT #60 komquats-n272059-e28ee29d2d13: Wed Sep  4 15:07:36
>  
> > PDT 2024
> >     root@cwsys:/export/obj/opt/src/git-src/amd64.amd64/sys/BREAK amd64
> > FreeBSD clang version 18.1.6 (https://github.com/llvm/llvm-project.git 
> > llvmorg-18.1.6-0-g1118c2e05e67)
> > VT(vga): text 80x25
> > CPU: AMD Processor model unknown (3000.06-MHz K8-class CPU)
> >   Origin="AuthenticAMD"  Id=0x100f43  Family=0x10  Model=0x4  Stepping=3
> >   Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,
> M
> > CA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
> >   Features2=0x802009<SSE3,MON,CX16,POPCNT>
> >   AMD Features=0xee500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM,3DNow!+,3
> D
> > Now!>
> >   AMD Features2=0x37ff<LAHF,CMP,SVM,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,OSVW
> ,
> > IBS,SKINIT,WDT>
> >   SVM: NP,NRIP,NAsids=64
> >   TSC: P-state invariant
> > real memory  = 8589934592 (8192 MB)
> > avail memory = 8145883136 (7768 MB)
> > Event timer "LAPIC" quality 100
> > ACPI APIC Table: <ATI    ASUSACPI>
> > FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
> > FreeBSD/SMP: 1 package(s) x 4 core(s)
> > random: unblocking device.
> > Firmware Warning (ACPI): 32/64X length mismatch in FADT/Pm1aEventBlock: 
> > 32/8 (20230628/tbfadt-748)
> > Firmware Warning (ACPI): 32/64X length mismatch in FADT/Pm1aControlBlock: 
> > 16/8 (20230628/tbfadt-748)
> > Firmware Warning (ACPI): 32/64X length mismatch in FADT/PmTimerBlock: 32/8 
> > (20230628/tbfadt-748)
> > Firmware Warning (ACPI): 32/64X length mismatch in FADT/Gpe0Block: 64/8 
> > (20230628/tbfadt-748)
> > Firmware Warning (ACPI): Invalid length for FADT/Pm1aEventBlock: 8, using 
> > default 32 (20230628/tbfadt-850)
> > Firmware Warning (ACPI): Invalid length for FADT/Pm1aControlBlock: 8, using
>  
> > default 16 (20230628/tbfadt-850)
> > Firmware Warning (ACPI): Invalid length for FADT/PmTimerBlock: 8, using 
> > default 32 (20230628/tbfadt-850)
> > ioapic0: MADT APIC ID 4 != hw id 0
> > kernel trap 12 with interrupts disabled
> > 
> > 
> > Fatal trap 12: page fault while in kernel mode
> > cpuid = 0; apic id = 00
> > fault virtual address   = 0x78
> > fault code              = supervisor read data, page not present
> > instruction pointer     = 0x20:0xffffffff80a2c48b
> > stack pointer           = 0x28:0xffffffff81f05e90
> > frame pointer           = 0x28:0xffffffff81f05e90
> > code segment            = base 0x0, limit 0xfffff, type 0x1b
> >                         = DPL 0, pres 1, long 1, def32 0, gran 1
> > processor eflags        = resume, IOPL = 0
> > current process         = 0 (swapper)
> > rdi: 0000000000000004 rsi: 0000000000000000 rdx: 0000000000000000
> > rcx: 0000000000000001  r8: 0000000000000001  r9: 00000000ffffffff
> > rax: 0000000000000000 rbx: fffff800fec00000 rbp: ffffffff81f05e90
> > r10: 0000000000000000 r11: 00000000fff5cfdf r12: 0000000000000010
> > r13: fffff800033aa8ec r14: fffff800033aa8e4 r15: 0000000000000000
> > trap number             = 12
> > panic: page fault
> > cpuid = 0
> > time = 1
> > KDB: stack backtrace:
> > db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 
> > 0xffffffff81f05b80
> > vpanic() at vpanic+0x13f/frame 0xffffffff81f05cb0
> > panic() at panic+0x43/frame 0xffffffff81f05d10
> > trap_fatal() at trap_fatal+0x40b/frame 0xffffffff81f05d70
> > trap_pfault() at trap_pfault+0x46/frame 0xffffffff81f05dc0
> > calltrap() at calltrap+0x8/frame 0xffffffff81f05dc0
> > --- trap 0xc, rip = 0xffffffff80a2c48b, rsp = 0xffffffff81f05e90, rbp = 
> > 0xffffffff81f05e90 ---
> > iommu_map_ioapic_intr() at iommu_map_ioapic_intr+0xb/frame 
> > 0xffffffff81f05e90
> > ioapic_create() at ioapic_create+0x460/frame 0xffffffff81f05f20
> > madt_parse_apics() at madt_parse_apics+0x51/frame 0xffffffff81f05f40
> > acpi_walk_subtables() at acpi_walk_subtables+0x31/frame 0xffffffff81f05f70
> > madt_setup_io() at madt_setup_io+0x62/frame 0xffffffff81f05f90
> > apic_setup_io() at apic_setup_io+0x24/frame 0xffffffff81f05fa0
> > mi_startup() at mi_startup+0x1c8/frame 0xffffffff81f05ff0
> > Uptime: 1s
> > Automatic reboot in 15 seconds - press a key on the console to abort
> > --> Press a key on the console to reboot,
> > --> or switch off the system now.
> > Rebooting...
>
> Try this
>
> commit 27647f0593a0e7c1cdacb8531dd944aa568dbdb5
> Author: Konstantin Belousov <kib@FreeBSD.org>
> Date:   Thu Sep 5 03:33:34 2024 +0300
>
>     x86: always provide dummy x86_iommu virtual methods
>     
>     to make configurations where vendor-specific IOMMU not yet implemented
>     but IOMMU is enabled in config, work when calling into MSI/IOAPIC
>     interrupt remapping.
>     
>     Reported by:    cy
>     Sponsored by:   Advanced Micro Devices (AMD)
>     Sponsored by:   The FreeBSD Foundation
>     MFC after:      1 week
>
> diff --git a/sys/x86/iommu/iommu_utils.c b/sys/x86/iommu/iommu_utils.c
> index 2c647fd21c67..ebfcb94c7e97 100644
> --- a/sys/x86/iommu/iommu_utils.c
> +++ b/sys/x86/iommu/iommu_utils.c
> @@ -190,12 +190,53 @@ SYSCTL_INT(_hw_iommu, OID_AUTO, batch_coalesce, CTLFLAG
> _RWTUN,
>      &iommu_qi_batch_coalesce, 0,
>      "Number of qi batches between interrupt");
>  
> -static struct x86_iommu *x86_iommu;
> +static int
> +x86_no_iommu_alloc_msi_intr(device_t src, u_int *cookies, u_int count)
> +{
> +	return (EOPNOTSUPP);
> +}
> +
> +static int
> +x86_no_iommu_map_msi_intr(device_t src, u_int cpu, u_int vector,
> +    u_int cookie, uint64_t *addr, uint32_t *data)
> +{
> +	return (EOPNOTSUPP);
> +}
> +
> +static int
> +x86_no_iommu_unmap_msi_intr(device_t src, u_int cookie)
> +{
> +	return (0);
> +}
> +
> +static int
> +x86_no_iommu_map_ioapic_intr(u_int ioapic_id, u_int cpu, u_int vector,
> +    bool edge, bool activehi, int irq, u_int *cookie, uint32_t *hi,
> +    uint32_t *lo)
> +{
> +	return (EOPNOTSUPP);
> +}
> +
> +static int
> +x86_no_iommu_unmap_ioapic_intr(u_int ioapic_id, u_int *cookie)
> +{
> +	return (0);
> +}
> +
> +static struct x86_iommu x86_no_iommu = {
> +	.alloc_msi_intr = x86_no_iommu_alloc_msi_intr,
> +	.map_msi_intr = x86_no_iommu_map_msi_intr,
> +	.unmap_msi_intr = x86_no_iommu_unmap_msi_intr,
> +	.map_ioapic_intr = x86_no_iommu_map_ioapic_intr,
> +	.unmap_ioapic_intr = x86_no_iommu_unmap_ioapic_intr,
> +};
> +
> +static struct x86_iommu *x86_iommu = &x86_no_iommu;
>  
>  void
>  set_x86_iommu(struct x86_iommu *x)
>  {
> -	MPASS(x86_iommu == NULL);
> +	MPASS(x86_iommu == &x86_no_iommu);
>  	x86_iommu = x;
>  }
>  

It still panics, differently though.

---<<BOOT>>---
Copyright (c) 1992-2024 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 15.0-CURRENT #61 komquats-n272062-79eba754bec3: Wed Sep  4 17:46:55 PDT 2024
    root@slippy:/export/obj/opt/src/git-src/amd64.amd64/sys/BREAK amd64
FreeBSD clang version 18.1.6 (https://github.com/llvm/llvm-project.git llvmorg-18.1.6-0-g1118c2e05e67)
VT(vga): text 80x25
CPU: AMD Processor model unknown (3000.00-MHz K8-class CPU)
  Origin="AuthenticAMD"  Id=0x100f43  Family=0x10  Model=0x4  Stepping=3
  Features=0x178bfbff<FPU,VME,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CLFLUSH,MMX,FXSR,SSE,SSE2,HTT>
  Features2=0x802009<SSE3,MON,CX16,POPCNT>
  AMD Features=0xee500800<SYSCALL,NX,MMX+,FFXSR,Page1GB,RDTSCP,LM,3DNow!+,3DNow!>
  AMD Features2=0x37ff<LAHF,CMP,SVM,ExtAPIC,CR8,ABM,SSE4A,MAS,Prefetch,OSVW,IBS,SKINIT,WDT>
  SVM: NP,NRIP,NAsids=64
  TSC: P-state invariant
real memory  = 8589934592 (8192 MB)
avail memory = 8145883136 (7768 MB)
Event timer "LAPIC" quality 100
ACPI APIC Table: <ATI    ASUSACPI>
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
FreeBSD/SMP: 1 package(s) x 4 core(s)
random: unblocking device.
Firmware Warning (ACPI): 32/64X length mismatch in FADT/Pm1aEventBlock: 32/8 (20230628/tbfadt-748)
Firmware Warning (ACPI): 32/64X length mismatch in FADT/Pm1aControlBlock: 16/8 (20230628/tbfadt-748)
Firmware Warning (ACPI): 32/64X length mismatch in FADT/PmTimerBlock: 32/8 (20230628/tbfadt-748)
Firmware Warning (ACPI): 32/64X length mismatch in FADT/Gpe0Block: 64/8 (20230628/tbfadt-748)
Firmware Warning (ACPI): Invalid length for FADT/Pm1aEventBlock: 8, using default 32 (20230628/tbfadt-850)
Firmware Warning (ACPI): Invalid length for FADT/Pm1aControlBlock: 8, using default 16 (20230628/tbfadt-850)
Firmware Warning (ACPI): Invalid length for FADT/PmTimerBlock: 8, using default 32 (20230628/tbfadt-850)
ioapic0: MADT APIC ID 4 != hw id 0
ioapic0 <Version 2.1> irqs 0-23
Launching APs: 1 3 2
random: entropy device external interface
vtvga0: <VT VGA driver>
aesni0: No AES or SHA support.
acpi0: <ATI ASUSACPI>
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKC (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKD (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKA (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKB (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKD (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKA (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKB (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKC (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKA (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKB (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKC (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKD (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKB (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKC (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKD (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKA (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKC (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKD (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKA (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKB (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKD (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKA (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKB (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKC (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKA (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKB (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKC (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - LNKD (20230628/dspkginit-605)
ACPI Error: AE_NOT_FOUND, While resolving a named reference package element - \_PR_.CPU0 (20230628/dspkginit-605)
acpi0: Power Button (fixed)
cpu0: <ACPI CPU> on acpi0
attimer0: <AT timer> port 0x40-0x43 on acpi0
Timecounter "i8254" frequency 1193182 Hz quality 0
Event timer "i8254" frequency 1193182 Hz quality 100
hpet0: <High Precision Event Timer> iomem 0xfed00000-0xfed003ff irq 0,8 on acpi0
device_attach: hpet0 attach returned 12
atrtc0: <AT realtime clock> port 0x70-0x73 on acpi0
atrtc0: registered as a time-of-day clock, resolution 1.000000s
Event timer "RTC" frequency 32768 Hz quality 0
Timecounter "ACPI-fast" frequency 3579545 Hz quality 900
acpi_timer0: <32-bit timer at 3.579545MHz> port 0x4008-0x400b on acpi0
acpi_button0: <Power Button> on acpi0
pcib0: <ACPI Host-PCI bridge> port 0xcf8-0xcff on acpi0
pci0: <ACPI PCI bus> on pcib0
pcib1: <ACPI PCI-PCI bridge> at device 1.0 on pci0
pci1: <ACPI PCI bus> on pcib1
vgapci0: <VGA-compatible display> port 0xcc00-0xccff mem 0xf0000000-0xf7ffffff,0xfdbf0000-0xfdbfffff,0xfda00000-0xfdafffff irq 18 at device 5.0 on pci1
vgapci0: Boot video device
pcib2: <ACPI PCI-PCI bridge> at device 7.0 on pci0
pci2: <ACPI PCI bus> on pcib2
re0: <RealTek 8168/8111 B/C/CP/D/DP/E/F/G PCIe Gigabit Ethernet> port 0xdc00-0xdcff mem 0xfdfff000-0xfdffffff irq 19 at device 0.0 on pci2
re0: Using 1 MSI message
re0: Chip rev. 0x38000000
re0: MAC rev. 0x00000000


Fatal trap 12: page fault while in kernel mode
cpuid = 2; apic id = 02
fault virtual address   = 0x0
fault code              = supervisor read instruction, page not present
instruction pointer     = 0x20:0x0
stack pointer           = 0x28:0xffffffff81f058c8
frame pointer           = 0x28:0xffffffff81f058e0
code segment            = base 0x0, limit 0xfffff, type 0x1b
                        = DPL 0, pres 1, long 1, def32 0, gran 1
processor eflags        = interrupt enabled, resume, IOPL = 0
current process         = 0 (swapper)
rdi: fffff800057d4d00 rsi: 0000000000000000 rdx: 000000000000004a
rcx: fffff80005704000  r8: 00000015bf17440a  r9: ffffffff810f5ce0
rax: 0000000000000000 rbx: fffff800057d4d00 rbp: ffffffff81f058e0
r10: ffffffff81f05860 r11: fffffffffffffff5 r12: 0000000038000000
r13: ffffffffffffffff r14: fffff800057d4e00 r15: 0000000000000100
trap number             = 12
panic: page fault
cpuid = 2
time = 1
KDB: stack backtrace:
db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xffffffff81f055b0
vpanic() at vpanic+0x13f/frame 0xffffffff81f056e0
panic() at panic+0x43/frame 0xffffffff81f05740
trap_fatal() at trap_fatal+0x40b/frame 0xffffffff81f057a0
trap_pfault() at trap_pfault+0x46/frame 0xffffffff81f057f0
calltrap() at calltrap+0x8/frame 0xffffffff81f057f0
--- trap 0xc, rip = 0, rsp = 0xffffffff81f058c8, rbp = 0xffffffff81f058e0 ---
??() at 0/frame 0xffffffff81f058e0
acpi_pci_get_dma_tag() at acpi_pci_get_dma_tag+0x34/frame 0xffffffff81f05900
re_attach() at re_attach+0x100b/frame 0xffffffff81f05990
device_attach() at device_attach+0x3ac/frame 0xffffffff81f059e0
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f05a10
pci_attach() at pci_attach+0xc7/frame 0xffffffff81f05a40
acpi_pci_attach() at acpi_pci_attach+0x15/frame 0xffffffff81f05a80
device_attach() at device_attach+0x3ac/frame 0xffffffff81f05ad0
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f05b00
acpi_pcib_pci_attach() at acpi_pcib_pci_attach+0x95/frame 0xffffffff81f05b30
device_attach() at device_attach+0x3ac/frame 0xffffffff81f05b80
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f05bb0
pci_attach() at pci_attach+0xc7/frame 0xffffffff81f05be0
acpi_pci_attach() at acpi_pci_attach+0x15/frame 0xffffffff81f05c20
device_attach() at device_attach+0x3ac/frame 0xffffffff81f05c70
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f05ca0
acpi_pcib_acpi_attach() at acpi_pcib_acpi_attach+0x424/frame 0xffffffff81f05d00
device_attach() at device_attach+0x3ac/frame 0xffffffff81f05d50
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f05d80
acpi_probe_children() at acpi_probe_children+0x6f/frame 0xffffffff81f05de0
acpi_attach() at acpi_attach+0x9dc/frame 0xffffffff81f05e70
device_attach() at device_attach+0x3ac/frame 0xffffffff81f05ec0
bus_generic_attach() at bus_generic_attach+0x4b/frame 0xffffffff81f05ef0
device_attach() at device_attach+0x3ac/frame 0xffffffff81f05f40
bus_generic_new_pass() at bus_generic_new_pass+0x127/frame 0xffffffff81f05f70
root_bus_configure() at root_bus_configure+0x26/frame 0xffffffff81f05f90
configure() at configure+0x9/frame 0xffffffff81f05fa0
mi_startup() at mi_startup+0x1c8/frame 0xffffffff81f05ff0
Uptime: 1s
Automatic reboot in 15 seconds - press a key on the console to abort
Rebooting...
cpu_reset: Restarting BSP
cpu_reset_proxy: Stopped CPU 2



-- 
Cheers,
Cy Schubert <Cy.Schubert@cschubert.com>
FreeBSD UNIX:  <cy@FreeBSD.org>   Web:  https://FreeBSD.org
NTP:           <cy@nwtime.org>    Web:  https://nwtime.org

			e^(i*pi)+1=0




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20240905010600.B9D292A>