tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Multiple interlocks on the same condvar(9)



Hi all,

With condvar(9), is it possible to have different LWPs waiting on the same cv, but with different interlocks?

I'm asking this because, with the LOCKDEBUG_WAKEUP checks re-enabled
in kern_condvar.c (see attached diff and kernel configuration), I get
a LOCK_DEBUG panic (when gdm is starting in case that matters):

Condition variable error: lockdebug_wakeup: interlocking mutex not
held during wakeup

A manual backtrace (as explained in [1], thanks haad@ :-)) shows that
the panic comes from a cv_broadcast() call in sowakeup().  I'm not
familiar with this code, but afaics the adequate lock is held when
this cv_broadcast() call is performed.

Now, the function lockdebug_wakeup() contains:

616     /*
617      * If it has any waiters, ensure that they are using the
618      * same interlock.
619      */

So I guess that the problem may come from the fact that the waiters
(see function sbwait()) did not call cv_timewait with same mutex.
Hence, the above question.

Thanks for your help,

Grégoire

[1] http://wiki.netbsd.org/~haad/ddb_howto/

Index: kern/kern_condvar.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_condvar.c,v
retrieving revision 1.28
diff -u -p -r1.28 kern_condvar.c
--- kern/kern_condvar.c 5 Dec 2009 22:38:19 -0000       1.28
+++ kern/kern_condvar.c 11 Jan 2011 21:00:08 -0000
@@ -292,7 +292,7 @@ void
 cv_signal(kcondvar_t *cv)
 {
 
-       /* LOCKDEBUG_WAKEUP(CV_DEBUG_P(cv), cv, CV_RA); */
+       LOCKDEBUG_WAKEUP(CV_DEBUG_P(cv), cv, CV_RA);
        KASSERT(cv_is_valid(cv));
 
        if (__predict_false(!TAILQ_EMPTY(CV_SLEEPQ(cv))))
@@ -334,7 +334,7 @@ void
 cv_broadcast(kcondvar_t *cv)
 {
 
-       /* LOCKDEBUG_WAKEUP(CV_DEBUG_P(cv), cv, CV_RA); */
+       LOCKDEBUG_WAKEUP(CV_DEBUG_P(cv), cv, CV_RA);
        KASSERT(cv_is_valid(cv));
 
        if (__predict_false(!TAILQ_EMPTY(CV_SLEEPQ(cv))))  
include         "arch/i386/conf/GENERIC"

options         DIAGNOSTIC
options         DEBUG
options         LOCKDEBUG
Copyright (c) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
    2006, 2007, 2008, 2009, 2010, 2011
    The NetBSD Foundation, Inc.  All rights reserved.
Copyright (c) 1982, 1986, 1989, 1991, 1993
    The Regents of the University of California.  All rights reserved.

NetBSD 5.99.43 (LOCKCHECK) #0: Tue Jan 11 21:57:49 CET 2011
        
sutre@tahoe:/data/sutre/build-i386/home/sutre/netbsd/src/sys/arch/i386/compile/LOCKCHECK
total memory = 1526 MB
avail memory = 1487 MB
timecounter: Timecounters tick every 10.000 msec
timecounter: Timecounter "i8254" frequency 1193182 Hz quality 100
FUJITSU SIEMENS LIFEBOOK P7120 ( )
mainbus0 (root)
cpu0 at mainbus0 apid 0: Intel 686-class, 1197MHz, id 0x6d8
ioapic0 at mainbus0 apid 1: pa 0xfec00000, version 20, 24 pins
acpi0 at mainbus0: Intel ACPICA 20100528
acpi0: X/RSDT: OemId <FUJ   ,FJNB1A5 ,01230000>, AslId <FUJ ,00000100>
acpi0: SCI interrupting at int 9
timecounter: Timecounter "ACPI-Fast" frequency 3579545 Hz quality 1000
CPU0 (ACPI Object Type 'Processor' [0x0c]) at acpi0 not configured
MCFG (PNP0C02) at acpi0 not configured
acpivga0 at acpi0 (GFX0): ACPI Display Adapter
acpiout0 at acpivga0 (CRT, 0x0100): ACPI Display Output Device
acpiout1 at acpivga0 (LCD, 0x0400): ACPI Display Output Device
acpiout1: brightness levels: 1 15 29 43 57 71 85 100
acpiout2 at acpivga0 (TV, 0x0200): ACPI Display Output Device
acpiout3 at acpivga0 (DVI, 0x0300): ACPI Display Output Device
acpivga0: connected output devices:
acpivga0:   0x0100 (acpiout0): Ext. Monitor, head 0, bios detect
acpivga0:   0x0400 (acpiout1): Unknown Output Device, head 0, bios detect
acpivga0:   0x0200 (acpiout2): TV, head 0, bios detect
acpivga0:   0x0300 (acpiout3): Unknown Output Device, head 0, bios detect
MBIO (PNP0C02) at acpi0 not configured
fujbp0 at acpi0 (FJEX, FUJ02B1): Fujitsu Brightness & Pointer
attimer1 at acpi0 (TIME, PNP0100): io 0x40-0x43 irq 0
pcppi1 at acpi0 (SPKR, PNP0800): io 0x61
midi0 at pcppi1: PC speaker
sysbeep0 at pcppi1
npx1 at acpi0 (MATH, PNP0C04): io 0xf0-0xfe irq 13
npx1: reported by CPUID; using exception 16
pckbc1 at acpi0 (KBC, PNP0303) (kbd port): io 0x60,0x64 irq 1
pckbc2 at acpi0 (PS2M, PNP0F13) (aux port): irq 12
fujhk0 at acpi0 (FEXT, FUJ02E3): Fujitsu Hotkeys
acpilid0 at acpi0 (LID, PNP0C0D): ACPI Lid Switch
acpibut0 at acpi0 (PWRB, PNP0C0C): ACPI Power Button
acpiacad0 at acpi0 (AC, ACPI0003): ACPI AC Adapter
acpibat0 at acpi0 (CMB1, PNP0C0A-1): ACPI Battery
acpibat0: Fujitsu LION rechargeable battery
acpibat0: model number CP234019, serial number 1
acpibat0: granularity: low->warn 0.001 Ah, warn->full 0.001 Ah
acpibat1 at acpi0 (CMB2, PNP0C0A-2): ACPI Battery
acpibat1: Fujitsu LION rechargeable battery
acpibat1: model number CP194250 / CP194251, serial number 2
acpibat1: granularity: low->warn 0.001 Ah, warn->full 0.001 Ah
acpitz0 at acpi0 (TZ00): ACPI Thermal Zone
acpitz0: levels: critical 105.0 C, passive cooling
apm0 at acpi0: Power Management spec V1.2
attimer1: attached to pcppi1
pckbd0 at pckbc1 (kbd slot)
pckbc1: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard
pms0 at pckbc1 (aux slot)
pms0: Synaptics touchpad version 6.2
pms0: Up/down buttons, Palm detect, Multi-finger
pckbc1: using irq 12 for aux slot
wsmouse0 at pms0 mux 0
pci0 at mainbus0 bus 0: configuration mode 1
pci0: i/o space, memory space enabled, rd/line, rd/mult, wr/inv ok
pchb0 at pci0 dev 0 function 0: vendor 0x8086 product 0x2590 (rev. 0x04)
agp0 at pchb0: detected 7932k stolen memory
agp0: aperture at 0xc0000000, size 0x10000000
vga1 at pci0 dev 2 function 0: vendor 0x8086 product 0x2592 (rev. 0x04)
wsdisplay0 at vga1 kbdmux 1: console (80x25, vt100 emulation), using wskbd0
wsmux1: connecting to wsdisplay0
i915drm0 at vga1: Intel i915GM
i915drm0: AGP at 0xc0000000 256MB
i915drm0: Initialized i915 1.6.0 20080730
vendor 0x8086 product 0x2792 (miscellaneous display, revision 0x04) at pci0 dev 
2 function 1 not configured
hdaudio0 at pci0 dev 27 function 0: HD Audio Controller
hdaudio0: interrupting at ioapic0 pin 16
hdafg0 at hdaudio0: Realtek ALC260
hdafg0: duplicate pin in association
hdafg0: ADC01 2ch: Line In [Built-In], AUX [Built-In], Mic In [Jack]
hdafg0: 0ch/2ch 44100Hz 48000Hz 96000Hz 192000Hz 16/16 20/32 24/32
audio0 at hdafg0: full duplex, playback, capture, independent
hdvsmfg at hdaudio0 not configured
uhci0 at pci0 dev 29 function 0: vendor 0x8086 product 0x2658 (rev. 0x04)
uhci0: interrupting at ioapic0 pin 23
usb0 at uhci0: USB revision 1.0
uhci1 at pci0 dev 29 function 1: vendor 0x8086 product 0x2659 (rev. 0x04)
uhci1: interrupting at ioapic0 pin 19
usb1 at uhci1: USB revision 1.0
uhci2 at pci0 dev 29 function 2: vendor 0x8086 product 0x265a (rev. 0x04)
uhci2: interrupting at ioapic0 pin 18
usb2 at uhci2: USB revision 1.0
uhci3 at pci0 dev 29 function 3: vendor 0x8086 product 0x265b (rev. 0x04)
uhci3: interrupting at ioapic0 pin 16
usb3 at uhci3: USB revision 1.0
ehci0 at pci0 dev 29 function 7: vendor 0x8086 product 0x265c (rev. 0x04)
ehci0: interrupting at ioapic0 pin 23
ehci0: EHCI version 1.0
ehci0: companion controllers, 2 ports each: uhci0 uhci1 uhci2 uhci3
usb4 at ehci0: USB revision 2.0
ppb0 at pci0 dev 30 function 0: vendor 0x8086 product 0x2448 (rev. 0xd4)
pci1 at ppb0 bus 6
pci1: i/o space, memory space enabled
cbb0 at pci1 dev 3 function 0: vendor 0x1180 product 0x0476 (rev. 0xb3)
fwohci0 at pci1 dev 3 function 1: vendor 0x1180 product 0x0552 (rev. 0x08)
fwohci0: interrupting at ioapic0 pin 17
fwohci0: OHCI version 1.10 (ROM=0)
fwohci0: No. of Isochronous channels is 4.
fwohci0: EUI64 00:00:0e:10:03:8b:4c:05
fwohci0: Phy 1394a available S400, 2 ports.
fwohci0: Link S400, max_rec 2048 bytes.
ieee1394if0 at fwohci0: IEEE1394 bus
fwip0 at ieee1394if0: IP over IEEE1394
fwohci0: Initiate bus reset
sdhc0 at pci1 dev 3 function 2: vendor 0x1180 product 0x0822 (rev. 0x17)
sdhc0: interrupting at ioapic0 pin 16
sdmmc0 at sdhc0
vendor 0x1180 product 0x0592 (miscellaneous system, revision 0x08) at pci1 dev 
3 function 3 not configured
vendor 0x1180 product 0x0852 (miscellaneous system, revision 0x03) at pci1 dev 
3 function 4 not configured
rtk0 at pci1 dev 4 function 0: Realtek 8139 10/100BaseTX (rev. 0x10)
rtk0: interrupting at ioapic0 pin 20
rtk0: Ethernet address 00:17:42:02:39:db
rlphy0 at rtk0 phy 7: Realtek internal PHY
rlphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
iwi0 at pci1 dev 5 function 0: vendor 0x8086 product 0x4223 (rev. 0x05)
iwi0: interrupting at ioapic0 pin 18
iwi0: 802.11 address 00:16:6f:75:e7:5f
iwi0: 11a rates: 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 36Mbps 48Mbps 54Mbps
iwi0: 11b rates: 1Mbps 2Mbps 5.5Mbps 11Mbps
iwi0: 11g rates: 1Mbps 2Mbps 5.5Mbps 11Mbps 6Mbps 9Mbps 12Mbps 18Mbps 24Mbps 
36Mbps 48Mbps 54Mbps
cbb0: cacheline 0x0 lattimer 0x40
cbb0: bhlc 0x824000
cbb0: interrupting at ioapic0 pin 16
cardslot0 at cbb0
cardbus0 at cardslot0: bus 7
pcmcia0 at cardslot0
ichlpcib0 at pci0 dev 31 function 0: vendor 0x8086 product 0x2641 (rev. 0x04)
timecounter: Timecounter "ichlpcib0" frequency 3579545 Hz quality 1000
ichlpcib0: 24-bit timer
ichlpcib0: TCO (watchdog) timer configured.
gpiobus at ichlpcib0 not configured
piixide0 at pci0 dev 31 function 1: Intel 82801FB IDE Controller (ICH6) (rev. 
0x04)
piixide0: bus-master DMA support present
piixide0: primary channel configured to compatibility mode
piixide0: primary channel interrupting at ioapic0 pin 14
atabus0 at piixide0 channel 0
piixide0: secondary channel configured to compatibility mode
piixide0: secondary channel ignored (disabled)
piixide1 at pci0 dev 31 function 2: Intel 82801FBM Serial ATA Controller (ICH6) 
(rev. 0x04)
piixide1: bus-master DMA support present
piixide1: primary channel configured to native-PCI mode
piixide1: using ioapic0 pin 19 for native-PCI interrupt
atabus1 at piixide1 channel 0
piixide1: secondary channel configured to native-PCI mode
atabus2 at piixide1 channel 1
ichsmb0 at pci0 dev 31 function 3: vendor 0x8086 product 0x266a (rev. 0x04)
ichsmb0: interrupting at ioapic0 pin 19
iic0 at ichsmb0: I2C bus
isa0 at ichlpcib0
fwohci0: BUS reset
fwohci0: node_id=0xc800ffc0, gen=1, CYCLEMASTER mode
ieee1394if0: 1 nodes, maxhop <= 0 cable IRM irm(0) (me)
ieee1394if0: bus manager 0
timecounter: Timecounter "clockinterrupt" frequency 100 Hz quality 0
acpiacad0: AC adapter online.
uhub0 at usb0: vendor 0x8086 UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub0: 2 ports with 2 removable, self powered
uhub1 at usb1: vendor 0x8086 UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub1: 2 ports with 2 removable, self powered
uhub2 at usb2: vendor 0x8086 UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub2: 2 ports with 2 removable, self powered
uhub3 at usb3: vendor 0x8086 UHCI root hub, class 9/0, rev 1.00/1.00, addr 1
uhub3: 2 ports with 2 removable, self powered
uhub4 at usb4: vendor 0x8086 EHCI root hub, class 9/0, rev 2.00/1.00, addr 1
uhub4: 8 ports with 8 removable, self powered
ehci0: handing over full speed device on port 5 to uhci2
wd0 at atabus0 drive 0: <TOSHIBA MK6006GAH>
wd0: drive supports 16-sector PIO transfers, LBA48 addressing
wd0: 57231 MB, 116280 cyl, 16 head, 63 sec, 512 bytes/sect x 117210240 sectors
wd0: 32-bit data port
wd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)
wd0(piixide0:0:0): using PIO mode 4, Ultra-DMA mode 5 (Ultra/100) (using DMA)
Kernelized RAIDframe activated
ugen0 at uhub2 port 1
ugen0: vendor 0x08ff Fingerprint Sensor, rev 1.10/6.21, addr 2
boot device: wd0
root on wd0a dumps on wd0b
mountroot: trying ffs...
root file system type: ffs
init: copying out path `/sbin/init' 11
wsdisplay0: screen 1 added (80x25, vt100 emulation)
wsdisplay0: screen 2 added (80x25, vt100 emulation)
wsdisplay0: screen 3 added (80x25, vt100 emulation)
wsdisplay0: screen 4 added (80x25, vt100 emulation)
wsdisplay0: screen 5 added (80x25, vt100 emulation)
wsdisplay0: screen 6 added (80x25, vt100 emulation)
wsdisplay0: screen 7 added (80x25, vt100 emulation)


Home | Main Index | Thread Index | Old Index