> Date: Tue, 15 Dec 2020 21:21:37 +0100
> From: Alexander Bluhm <alexander.bl...@gmx.net>
> 
> On Tue, Dec 15, 2020 at 06:57:03PM +0100, Mark Kettenis wrote:
> > Does the diff below fix this?
> 
> I can reproduce the panic and your diff fixes it.
> 
> Usually my regress machines do not trigger it as I do not install
> firmware.  fw_update and reboot makes it crash.
> 
> bluhm

Thanks.  This is committed now.  However, there may be other case
where we use uvm_km_valloc() early on that will trip over the kernel
lock assertion that mpi@ added in uvm_km_pgremove().  Ideally we
should get rid of all the uvm_km_free() calls in the kernel.

> OpenBSD 6.8-current (GENERIC.MP) #0: Tue Dec 15 20:18:20 CET 2020
>     r...@ot2.obsd-lab.genua.de:/usr/src/sys/arch/i386/compile/GENERIC.MP
> real mem  = 2146910208 (2047MB)
> avail mem = 2091409408 (1994MB)
> panic: kernel diagnostic assertion "_kernel_lock_held()" failed: file 
> "/usr/src/sys/uvm/uvm_km.c", line 246
> Stopped at      db_enter+0x4:   popl    %ebp
>     TID    PID    UID     PRFLAGS     PFLAGS  CPU  COMMAND
> db_enter(d0e47604,d110ae68,d0e46ec4,d0e47fec,d0e47fec) at db_enter+0x4
> panic(d0bc79e5,d0c2da24,d0c3a8c4,d0c522a9,f6) at panic+0xd3
> __assert(d0c2da24,d0c522a9,f6,d0c3a8c4,d0e46ec4) at __assert+0x19
> uvm_km_pgremove(d0e2da74,2552c000,2552e000) at uvm_km_pgremove+0x119
> uvm_unmap_kill_entry(d0e47fec,d0e46ec4) at uvm_unmap_kill_entry+0x92
> uvm_unmap_remove(d0e47fec,f552c000,f552e000,d110af10,0,1) at 
> uvm_unmap_remove+0
> x1cb
> uvm_unmap(d0e47fec,f552c000,f552e000) at uvm_unmap+0x53
> uvm_km_free(d0e47fec,f552c000,2000,2000) at uvm_km_free+0x25
> cpu_ucode_setup(f092c000,f0800000,efff9000,150a416,1108000) at 
> cpu_ucode_setup+
> 0xeb
> cpu_startup(150a416,1108000,1117000,110b000,0) at cpu_startup+0x14a
> main(0,0,0,0,0) at main+0x6b
> https://www.openbsd.org/ddb.html describes the minimum info required in bug
> reports.  Insufficient info makes it difficult to find and fix bugs.
> ddb{0}> boot reboot
> rebooting...
> 
> OpenBSD 6.8-current (GENERIC.MP) #1: Tue Dec 15 20:34:36 CET 2020
>     r...@ot2.obsd-lab.genua.de:/usr/src/sys/arch/i386/compile/GENERIC.MP
> real mem  = 2146910208 (2047MB)
> avail mem = 2091417600 (1994MB)
> random: good seed from bootblocks
> mpath0 at root
> scsibus0 at mpath0: 256 targets
> mainbus0 at root
> bios0 at mainbus0: date 10/20/04, BIOS32 rev. 0 @ 0xfdb30, SMBIOS rev. 2.3 @ 
> 0xf0640 (63 entries)
> bios0: vendor American Megatrends Inc. version "0700xx" date 10/20/2004
> bios0: Supermicro                                        . X5DL8
> acpi0 at bios0: ACPI 1.0
> acpi0: sleep states S0 S1 S4 S5
> acpi0: tables DSDT FACP APIC
> acpi0: wakeup devices SLPB(S1) NRTH(S5) PS2M(S1) PS2K(S1) UAR1(S1) UAR2(S1) 
> USB_(S1) PCI1(S5) PCI2(S5) PCI3(S5) PCI4(S5)
> acpitimer0 at acpi0: 3579545 Hz, 32 bits
> acpimadt0 at acpi0 addr 0xfee00000: PC-AT compat
> cpu0 at mainbus0: apid 0 (boot processor)
> cpu0: Intel(R) Xeon(TM) CPU 3.06GHz ("GenuineIntel" 686-class) 3.07 GHz, 
> 0f-02-05
> cpu0: 
> FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,CNXT-ID,xTPR,PERF,MELTDOWN
> mtrr: Pentium Pro MTRR support, 8 var ranges, 88 fixed ranges
> cpu0: apic clock running at 133MHz
> cpu1 at mainbus0: apid 6 (application processor)
> cpu1: Intel(R) Xeon(TM) CPU 3.06GHz ("GenuineIntel" 686-class) 3.07 GHz, 
> 0f-02-05
> cpu1: 
> FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,CNXT-ID,xTPR,PERF,MELTDOWN
> cpu2 at mainbus0: apid 1 (application processor)
> cpu2: Intel(R) Xeon(TM) CPU 3.06GHz ("GenuineIntel" 686-class) 3.07 GHz, 
> 0f-02-05
> cpu2: 
> FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,CNXT-ID,xTPR,PERF,MELTDOWN
> cpu3 at mainbus0: apid 7 (application processor)
> cpu3: Intel(R) Xeon(TM) CPU 3.06GHz ("GenuineIntel" 686-class) 3.07 GHz, 
> 0f-02-05
> cpu3: 
> FPU,V86,DE,PSE,TSC,MSR,PAE,MCE,CX8,APIC,SEP,MTRR,PGE,MCA,CMOV,PAT,PSE36,CFLUSH,DS,ACPI,MMX,FXSR,SSE,SSE2,SS,HTT,TM,PBE,CNXT-ID,xTPR,PERF,MELTDOWN
> ioapic0 at mainbus0: apid 8 pa 0xfec00000, version 11, 16 pins
> ioapic1 at mainbus0: apid 9 pa 0xfec01000, version 11, 16 pins
> ioapic2 at mainbus0: apid 10 pa 0xfec02000, version 11, 16 pins
> acpiprt0 at acpi0: bus 0 (NRTH)
> acpiprt1 at acpi0: bus 1 (PCI1)
> acpiprt2 at acpi0: bus 2 (PCI2)
> acpiprt3 at acpi0: bus 4 (PCI3)
> acpiprt4 at acpi0: bus 5 (PCI4)
> acpibtn0 at acpi0: SLPB
> "PNP0A03" at acpi0 not configured
> acpicmos0 at acpi0
> "PNP0A03" at acpi0 not configured
> "PNP0A03" at acpi0 not configured
> "PNP0A03" at acpi0 not configured
> "PNP0A03" at acpi0 not configured
> acpicpu0 at acpi0: C1(@1 halt!)
> acpicpu1 at acpi0: C1(@1 halt!)
> acpicpu2 at acpi0: C1(@1 halt!)
> acpicpu3 at acpi0: C1(@1 halt!)
> bios0: ROM list: 0xc0000/0x8000 0xc8000/0x1000 0xc9000/0x1800 0xca800/0x1800
> pci0 at mainbus0 bus 0: configuration mode 1 (bios)
> pchb0 at pci0 dev 0 function 0 "ServerWorks CNB20-HE Host" rev 0x33
> pchb1 at pci0 dev 0 function 1 "ServerWorks CNB20-HE Host" rev 0x00
> pci1 at pchb1 bus 1
> em0 at pci1 dev 2 function 0 "Intel 82546GB" rev 0x03: apic 9 int 10, address 
> 00:1b:21:55:eb:f4
> em1 at pci1 dev 2 function 1 "Intel 82546GB" rev 0x03: apic 9 int 11, address 
> 00:1b:21:55:eb:f5
> bge0 at pci1 dev 3 function 0 "Broadcom BCM5703X" rev 0x02, BCM5702/5703 A2 
> (0x1002): apic 9 int 15, address 00:30:48:53:90:95
> brgphy0 at bge0 phy 1: BCM5703 10/100/1000baseT PHY, rev. 2
> pchb2 at pci0 dev 0 function 2 "ServerWorks CNB20-HE Host" rev 0x00
> pci2 at pchb2 bus 4
> vga1 at pci0 dev 2 function 0 "ATI Rage XL" rev 0x27
> wsdisplay0 at vga1 mux 1: console (80x25, vt100 emulation)
> wsdisplay0: screen 1-5 added (80x25, vt100 emulation)
> em2 at pci0 dev 4 function 0 "Intel 82540EM" rev 0x02: apic 9 int 14, address 
> 00:30:48:53:90:94
> piixpm0 at pci0 dev 15 function 0 "ServerWorks CSB5" rev 0x93: polling
> iic0 at piixpm0
> admtemp0 at iic0 addr 0x18: Xeon
> admtemp1 at iic0 addr 0x29: Xeon
> lmenv0 at iic0 addr 0x2d: lm87 rev 6
> lmenv1 at iic0 addr 0x2e: lm87 rev 6
> pciide0 at pci0 dev 15 function 1 "ServerWorks CSB5 IDE" rev 0x93: DMA
> atapiscsi0 at pciide0 channel 0 drive 0
> scsibus1 at atapiscsi0: 2 targets
> cd0 at scsibus1 targ 0 lun 0: <TEAC, CD-224E-N, 1.AA> removable
> cd0(pciide0:0:0): using PIO mode 4, DMA mode 2, Ultra-DMA mode 2
> ohci0 at pci0 dev 15 function 2 "ServerWorks OSB4/CSB5 USB" rev 0x05: apic 8 
> int 10, version 1.0, legacy support
> pchb3 at pci0 dev 15 function 3 "ServerWorks CSB5 LPC" rev 0x00
> pchb4 at pci0 dev 16 function 0 "ServerWorks CIOB-X2 PCIX" rev 0x05
> pchb5 at pci0 dev 16 function 2 "ServerWorks CIOB-X2 PCIX" rev 0x05
> pci3 at pchb5 bus 2
> ppb0 at pci3 dev 3 function 0 "Intel IOP331 PCIX-PCIX" rev 0x0a
> pci4 at ppb0 bus 3
> arc0 at pci4 dev 14 function 0 "Areca ARC-1110" rev 0x00: apic 9 int 10
> arc0: 4 ports, 256MB SDRAM, firmware V1.43 2007-4-17
> scsibus2 at arc0: 16 targets
> sd0 at scsibus2 targ 0 lun 0: <Areca, ARC-1110-VOL#00, R001> 
> eui.0004d927fffff800
> sd0: 238418MB, 512 bytes/sector, 488281088 sectors
> pchb6 at pci0 dev 17 function 0 "ServerWorks CIOB-X2 PCIX" rev 0x05
> pchb7 at pci0 dev 17 function 2 "ServerWorks CIOB-X2 PCIX" rev 0x05
> pci5 at pchb7 bus 5
> usb0 at ohci0: USB revision 1.0
> uhub0 at usb0 configuration 1 interface 0 "ServerWorks OHCI root hub" rev 
> 1.00/1.00 addr 1
> isa0 at mainbus0
> isadma0 at isa0
> fdc0 at isa0 port 0x3f0/6 irq 6 drq 2
> com0 at isa0 port 0x3f8/8 irq 4: ns16550a, 16 byte fifo
> com0: console
> com1 at isa0 port 0x2f8/8 irq 3: ns16550a, 16 byte fifo
> pckbc0 at isa0 port 0x60/5 irq 1 irq 12
> pckbd0 at pckbc0 (kbd slot)
> wskbd0 at pckbd0: console keyboard, using wsdisplay0
> pcppi0 at isa0 port 0x61
> spkr0 at pcppi0
> lpt0 at isa0 port 0x378/4 irq 7
> npx0 at isa0 port 0xf0/16: reported by CPUID; using exception 16
> uhidev0 at uhub0 port 2 configuration 1 interface 0 "Logitech USB Optical 
> Mouse" rev 2.00/54.00 addr 2
> uhidev0: iclass 3/1
> ums0 at uhidev0: 8 buttons, Z and W dir
> wsmouse0 at ums0 mux 0
> vscsi0 at root
> scsibus3 at vscsi0: 256 targets
> softraid0 at root
> scsibus4 at softraid0: 256 targets
> root on sd0a (15b98e11c3d59574.a) swap on sd0b dump on sd0b
> fd0 at fdc0 drive 0: 1.44MB 80 cyl, 2 head, 18 sec
> 
> -rw-r--r--  1 root  bin  8192 Nov 17 11:26 /etc/firmware/intel/0f-02-05
> 
> > Index: arch/i386/i386/ucode.c
> > ===================================================================
> > RCS file: /cvs/src/sys/arch/i386/i386/ucode.c,v
> > retrieving revision 1.2
> > diff -u -p -r1.2 ucode.c
> > --- arch/i386/i386/ucode.c  28 Jun 2019 21:54:05 -0000      1.2
> > +++ arch/i386/i386/ucode.c  15 Dec 2020 17:54:37 -0000
> > @@ -102,7 +102,7 @@ cpu_ucode_setup(void)
> >     size = round_page(bios_ucode->uc_size);
> >     npages = size / PAGE_SIZE;
> >
> > -   va = uvm_km_valloc(kernel_map, size);
> > +   va = (vaddr_t)km_alloc(size, &kv_any, &kp_none, &kd_nowait);
> >     if (va == 0)
> >             return;
> >     for (i = 0; i < npages; i++) {
> > @@ -119,7 +119,7 @@ cpu_ucode_setup(void)
> >
> >     pmap_remove(pmap_kernel(), va, va + size);
> >     pmap_update(pmap_kernel());
> > -   uvm_km_free(kernel_map, va, size);
> > +   km_free((void *)va, size, &kv_any, &kp_none);
> >  }
> >
> >  /*
> 
> 

Reply via email to