Re: Kernel panic with i386 on latest snapshot

2020-12-15 Thread jungle Boogie
On Tue, 15 Dec 2020 at 15:03, Mark Kettenis  wrote:
>

>
> 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.
>

Thank you and mpi@ for the fix.

I wasn't able to test your diff, since my machine doesn't have the src
checked out, so thank you to bluhm and Hrvoje for testing it out.



Re: Kernel panic with i386 on latest snapshot

2020-12-15 Thread Mark Kettenis
> Date: Tue, 15 Dec 2020 21:21:37 +0100
> From: Alexander Bluhm 
> 
> 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
> TIDPIDUID 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,f080,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 0xfee0: 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 0xfec0, 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: 0xc/0x8000 0xc8000/0x1000 0xc9000/0x1800 0xca800/0x1800
> pci0 at mainbus0 bus 0: configuration mode 1 (bios)

Re: Kernel panic with i386 on latest snapshot

2020-12-15 Thread Alexander Bluhm
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

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
TIDPIDUID 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,f080,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 0xfee0: 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 0xfec0, 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: 0xc/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, 

Re: Kernel panic with i386 on latest snapshot

2020-12-15 Thread Hrvoje Popovski
On 15.12.2020. 18:57, Mark Kettenis wrote:
>> From: jungle Boogie 
>> Date: Tue, 15 Dec 2020 08:07:04 -0800
>>
>> Hi All,
>>
>> On my i386 Toshiba netbook machine, I am getting a kernel panic with
>> the latest i386 snapshot.
>>
>> I hope this information helps someone with the issue.
>>
>>> show panic
>> kernel diagnostic assertion "_kernel_lock_held()" failed:
>> "/usr/src/sys/uvm/uvm_km.c", line 246
>>
>>> bt
>> db_enter(d0bc6fab,d0c2da31,d0c3a6bb,d0e36b7c,d0e36b7c) at db_enter+0x4
>> panic(d0bc6fab, d0c2da31, d0c3a6bb, d0c51f06, f6) at panic+0xd3
>> _assert(d0c2da31,d0c51f06,f6,d0c3a6bb,d0e71330) at _assert+0x19
>> uvm_km_pgremove(d0e578ec,2552c000,2553000) at uvm_km_pgremove+0x119
>> uvm_umap_kill_entry(d0e36b7c,d0e71330) at uvm_unmap_kill_entry+0x92
>> uvm_unmap(d0e36b7c,f552c000,f553) at uvm_unmap+0x53
>> uvm_km_free(d0e36b7c,f552c000,4000,4000) at uvm_km_free+0x25
>> cpu_ucode_setup(f092c000,f080,efff9000,8d565328,1107000) at
>> cpu_ucode_setup+0xeb
>> cpu_startup(8d565328,1107000,1116000,110a000,0) at cpu_startup+0x14a
>> main(0,0,0,0) at main+0x6b
> 
> Does the diff below fix this?
> 


Yes, it fixes panic.. tnx ..


OpenBSD 6.8-current (GENERIC.MP) #18: Tue Dec 15 19:36:39 CET 2020
hrv...@r620-2.srce.hr:/sys/arch/i386/compile/GENERIC.MP
real mem  = 3441889280 (3282MB)
avail mem = 3362791424 (3207MB)
random: good seed from bootblocks
mpath0 at root
scsibus0 at mpath0: 256 targets
mainbus0 at root
bios0 at mainbus0: date 12/06/19, BIOS32 rev. 0 @ 0xf14a0, SMBIOS rev.
2.7 @ 0xcf42c000 (99 entries)
bios0: vendor Dell Inc. version "2.9.0" date 12/06/2019
bios0: Dell Inc. PowerEdge R620
acpi0 at bios0: ACPI 3.0
acpi0: sleep states S0 S4 S5
acpi0: tables DSDT FACP APIC SPCR HPET DMAR MCFG WDAT SLIC ERST HEST
BERT EINJ TCPA PC__ SRAT SSDT
acpi0: wakeup devices PCI0(S5)
acpitimer0 at acpi0: 3579545 Hz, 24 bits
acpimadt0 at acpi0 addr 0xfee0: PC-AT compat
cpu0 at mainbus0: apid 4 (boot processor)
cpu0: Intel(R) Xeon(R) CPU E5-2643 v2 @ 3.50GHz ("GenuineIntel"
686-class) 3.61 GHz, 06-3e-04
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,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,DCA,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN
mtrr: Pentium Pro MTRR support, 10 var ranges, 88 fixed ranges
cpu0: apic clock running at 100MHz
cpu0: mwait min=64, max=64, C-substates=0.2.1.1, IBE
cpu1 at mainbus0: apid 6 (application processor)
cpu1: Intel(R) Xeon(R) CPU E5-2643 v2 @ 3.50GHz ("GenuineIntel"
686-class) 3.51 GHz, 06-3e-04
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,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,DCA,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN
cpu2 at mainbus0: apid 8 (application processor)
cpu2: Intel(R) Xeon(R) CPU E5-2643 v2 @ 3.50GHz ("GenuineIntel"
686-class) 3.51 GHz, 06-3e-04
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,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,DCA,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN
cpu3 at mainbus0: apid 16 (application processor)
cpu3: Intel(R) Xeon(R) CPU E5-2643 v2 @ 3.50GHz ("GenuineIntel"
686-class) 3.51 GHz, 06-3e-04
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,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,DCA,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN
cpu4 at mainbus0: apid 18 (application processor)
cpu4: Intel(R) Xeon(R) CPU E5-2643 v2 @ 3.50GHz ("GenuineIntel"
686-class) 3.51 GHz, 06-3e-04
cpu4:
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,SSE3,PCLMUL,DTES64,MWAIT,DS-CPL,VMX,SMX,EST,TM2,SSSE3,CX16,xTPR,PDCM,PCID,DCA,SSE4.1,SSE4.2,x2APIC,POPCNT,DEADLINE,AES,XSAVE,AVX,F16C,RDRAND,NXE,PAGE1GB,RDTSCP,LONG,LAHF,PERF,ITSC,FSGSBASE,SMEP,ERMS,MD_CLEAR,IBRS,IBPB,STIBP,L1DF,SSBD,SENSOR,ARAT,XSAVEOPT,MELTDOWN
cpu5 at mainbus0: apid 20 (application processor)
cpu5: Intel(R) Xeon(R) CPU E5-2643 v2 @ 3.50GHz ("GenuineIntel"
686-class) 3.51 GHz, 06-3e-04
cpu5:

Re: Kernel panic with i386 on latest snapshot

2020-12-15 Thread Mark Kettenis
> From: jungle Boogie 
> Date: Tue, 15 Dec 2020 08:07:04 -0800
> 
> Hi All,
> 
> On my i386 Toshiba netbook machine, I am getting a kernel panic with
> the latest i386 snapshot.
> 
> I hope this information helps someone with the issue.
> 
> > show panic
> kernel diagnostic assertion "_kernel_lock_held()" failed:
> "/usr/src/sys/uvm/uvm_km.c", line 246
> 
> > bt
> db_enter(d0bc6fab,d0c2da31,d0c3a6bb,d0e36b7c,d0e36b7c) at db_enter+0x4
> panic(d0bc6fab, d0c2da31, d0c3a6bb, d0c51f06, f6) at panic+0xd3
> _assert(d0c2da31,d0c51f06,f6,d0c3a6bb,d0e71330) at _assert+0x19
> uvm_km_pgremove(d0e578ec,2552c000,2553000) at uvm_km_pgremove+0x119
> uvm_umap_kill_entry(d0e36b7c,d0e71330) at uvm_unmap_kill_entry+0x92
> uvm_unmap(d0e36b7c,f552c000,f553) at uvm_unmap+0x53
> uvm_km_free(d0e36b7c,f552c000,4000,4000) at uvm_km_free+0x25
> cpu_ucode_setup(f092c000,f080,efff9000,8d565328,1107000) at
> cpu_ucode_setup+0xeb
> cpu_startup(8d565328,1107000,1116000,110a000,0) at cpu_startup+0x14a
> main(0,0,0,0) at main+0x6b

Does the diff below fix this?


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 -  1.2
+++ arch/i386/i386/ucode.c  15 Dec 2020 17:54:37 -
@@ -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, _any, _none, _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, _any, _none);
 }
 
 /*



Re: Kernel panic with i386 on latest snapshot

2020-12-15 Thread Hrvoje Popovski
On 15.12.2020. 17:07, jungle Boogie wrote:
> Hi All,
> 
> On my i386 Toshiba netbook machine, I am getting a kernel panic with
> the latest i386 snapshot.
> 
> I hope this information helps someone with the issue.
> 
>> show panic
> kernel diagnostic assertion "_kernel_lock_held()" failed:
> "/usr/src/sys/uvm/uvm_km.c", line 246
> 
>> bt
> db_enter(d0bc6fab,d0c2da31,d0c3a6bb,d0e36b7c,d0e36b7c) at db_enter+0x4
> panic(d0bc6fab, d0c2da31, d0c3a6bb, d0c51f06, f6) at panic+0xd3
> _assert(d0c2da31,d0c51f06,f6,d0c3a6bb,d0e71330) at _assert+0x19
> uvm_km_pgremove(d0e578ec,2552c000,2553000) at uvm_km_pgremove+0x119
> uvm_umap_kill_entry(d0e36b7c,d0e71330) at uvm_unmap_kill_entry+0x92
> uvm_unmap(d0e36b7c,f552c000,f553) at uvm_unmap+0x53
> uvm_km_free(d0e36b7c,f552c000,4000,4000) at uvm_km_free+0x25
> cpu_ucode_setup(f092c000,f080,efff9000,8d565328,1107000) at
> cpu_ucode_setup+0xeb
> cpu_startup(8d565328,1107000,1116000,110a000,0) at cpu_startup+0x14a
> main(0,0,0,0) at main+0x6b
> 
> I've had no panics on amd64.
> 
> Thanks!
> 

Hi,

i can confirm this panic on i386 on Dell R620

OpenBSD 6.8-current (GENERIC.MP) #561: Tue Dec 15 03:03:30 MST 2020
dera...@i386.openbsd.org:/usr/src/sys/arch/i386/compile/GENERIC.MP
real mem  = 3441889280 (3282MB)
avail mem = 3362799616 (3207MB)
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
TIDPIDUID PRFLAGS PFLAGS  CPU  COMMAND
db_enter(d0e4901c,d1109e68,d0e48600,d0e2f5e0,d0e2f5e0) at db_enter+0x4
panic(d0bc86cd,d0c2d366,d0c3a01b,d0c508c6,f6) at panic+0xd3
__assert(d0c2d366,d0c508c6,f6,d0c3a01b,d0e48600) at __assert+0x19
uvm_km_pgremove(d0e2edbc,2552c000,2553) at uvm_km_pgremove+0x119
uvm_unmap_kill_entry(d0e2f5e0,d0e48600) at uvm_unmap_kill_entry+0x92
uvm_unmap_remove(d0e2f5e0,f552c000,f553,d1109f10,0,1) at
uvm_unmap_remove+0x1cb
uvm_unmap(d0e2f5e0,f552c000,f553) at uvm_unmap+0x53
uvm_km_free(d0e2f5e0,f552c000,4000,4000) at uvm_km_free+0x25
cpu_ucode_setup(f092c000,f080,efff9000,68cac0bc,1107000) at
cpu_ucode_setup+0xeb
cpu_startup(68cac0bc,1107000,1116000,110a000,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}>


ddb{0}> show panic
kernel diagnostic assertion "_kernel_lock_held()" failed: file
"/usr/src/sys/uvm/uvm_km.c", line 246
ddb{0}> trace
db_enter(d0e4901c,d1109e68,d0e48600,d0e2f5e0,d0e2f5e0) at db_enter+0x4
panic(d0bc86cd,d0c2d366,d0c3a01b,d0c508c6,f6) at panic+0xd3
__assert(d0c2d366,d0c508c6,f6,d0c3a01b,d0e48600) at __assert+0x19
uvm_km_pgremove(d0e2edbc,2552c000,2553) at uvm_km_pgremove+0x119
uvm_unmap_kill_entry(d0e2f5e0,d0e48600) at uvm_unmap_kill_entry+0x92
uvm_unmap_remove(d0e2f5e0,f552c000,f553,d1109f10,0,1) at
uvm_unmap_remove+0x1cb
uvm_unmap(d0e2f5e0,f552c000,f553) at uvm_unmap+0x53
uvm_km_free(d0e2f5e0,f552c000,4000,4000) at uvm_km_free+0x25
cpu_ucode_setup(f092c000,f080,efff9000,68cac0bc,1107000) at
cpu_ucode_setup+0xeb
cpu_startup(68cac0bc,1107000,1116000,110a000,0) at cpu_startup+0x14a
main(0,0,0,0,0) at main+0x6b
ddb{0}>

ddb{0}> show reg
ds  0x10
es  0x10
fs  0x20
gs 0
edi   0xd0bc86cdacx100_txpower_maxim+0xc67c
esi0x100
ebp   0xd1109e40__kernel_bss_end+0x1c8e40
ebx   0xd1109e68__kernel_bss_end+0x1c8e68
edx0x2fd
ecx0
eax  0x1
eip   0xd05c05b4db_enter+0x4
cs   0x8
eflags   0x2
esp   0xd1109e40__kernel_bss_end+0x1c8e40
ss  0x10
db_enter+0x4:   popl%ebp
ddb{0}>