Bug 192082

Summary: [FreeBSD10 on Hyper-v] Panic at boot with kernel built with INVARIANTS & WITNESS
Product: Base System Reporter: Kylie <kyliel>
Component: kernAssignee: Li-Wen Hsu <lwhsu>
Status: Open ---    
Severity: Affects Some People CC: decui, lizzha, lwhsu, zlei
Priority: ---    
Version: 10.0-RELEASE   
Hardware: amd64   
OS: Any   

Description Kylie 2014-07-24 03:35:15 UTC
Firstly, we reproduced this issue by following below steps. Furthermore, we uninstalled FreeBSD Integration Service driver which is to provide synthetic driver in FreeBSD VM running on Hyper-v, we still could reproduce this issue. 

1. Boot vm on WS2012 R2

2. Download FreeBSD 10.0 source code

3. add following config into  sys/amd64/conf/GENERIC

    options    DDB

    options    INVARIANTS

    options    INVARIANT_SUPPORT

    options    WITNESS

4. build and install kernel

5. reboot

6. panic:

Timecounter "Hyper-V" frequency 10000000 Hz quality 10000000

panic: mtx_lock_spin: recursed on non-recursive mutex cnputs_mtx @ /usr/src/sys/kern/kern_cons.c:500

cpuid = 0

KDB: stack backtrace:

#0 0xffffffff808e1b10 at kdb_backtrace+0x60

#1 0xffffffff808aa786 at vpanic+0x126

#2 0xffffffff808aa656 at kassert_panic+0x136

#3 0xffffffff80896936 at __mtx_lock_spin_flags+0x166

#4 0xffffffff80862bd2 at cnputs+0x32

#5 0xffffffff808e6eca at putchar+0x13a

#6 0xffffffff808e5c5a at kvprintf+0xda

#7 0xffffffff808e74e7 at vprintf+0x87

#8 0xffffffff808e7453 at printf+0x43

#9 0xffffffff808fa6c9 at witness_checkorder+0xa99

#10 0xffffffff80896865 at __mtx_lock_spin_flags+0x95

#11 0xffffffff80722b9b at uart_cnputc+0x3b

#12 0xffffffff8086295f at cnputc+0x7f

#13 0xffffffff80862bf8 at cnputs+0x58

#14 0xffffffff808e6eca at putchar+0x13a

#15 0xffffffff808e5c5a at kvprintf+0xda

#16 0xffffffff808e74e7 at vprintf+0x87

#17 0xffffffff808e7453 at printf+0x43







Note: If adding options WITNESS_SKIPSPIN when building kernel, the panic will not occur
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2016-05-20 07:42:02 UTC
Canonicalize assignment.
Comment 2 Li-Wen Hsu freebsd_committer freebsd_triage 2023-12-06 16:19:52 UTC
I suspect this one can be closed as OBE, while in the -CURRENT's GENERIC, we have

  INVARIANTS
  INVARIANT_SUPPORT
  WITNESS

and also

  WITNESS_SKIPSPIN

defined. I'll try to build a kernel without WITNESS_SKIPSPIN and test on Azure.