tech-kern archive

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

config_alldevs_lock is evil



Just updated to -current and tried to fetch some photos from
my digicam. Got two panics in a row, like:
#10 0xc05ad629 in __kernassert (t=0xc068a17e "diagnostic ",
    f=0xc06cef78 "../../../../kern/subr_autoconf.c", l=1835,
    e=0xc06ceda8 "TAILQ_EMPTY(&devs_gclist)")
    at ../../../../../../lib/libkern/__assert.c:50
#11 0xc04504b7 in config_alldevs_lock () at ../../../../kern/subr_autoconf.c:18
35
#12 0xc045058a in device_lookup (cd=0xc07005a0, unit=0)
    at ../../../../kern/subr_autoconf.c:1888
#13 0xc0450641 in device_lookup_private (cd=0xc07005a0, unit=0)
    at ../../../../kern/subr_autoconf.c:1909
#14 0xc057b6d3 in wsdisplaypoll (dev=12036, events=88, l=0xcc1edc80)
    at ../../../../dev/wscons/wsdisplay.c:1054
#15 0xc04549dd in cdev_poll (dev=12036, flag=88, l=0xcc1edc80)
    at ../../../../kern/subr_devsw.c:921

This shows two things:
- There is a blatant bug in the device g/c logics.
- Each device_lookup() as done by basically every device driver entry
  pulls config_alldevs_lock, which is at splhigh.

The first one is easily fixed hopefully, but the latter one points
to a design problem. The config_alldevs_lock at highest priority
shouldn't be used, at least not at runtime, the way it is used now.
I'm not sure it is necessary to do device addition/removal at
that high priority at all -- either it is done by normal threads
which can wait, or the bus already needs to deal with unexpected
removals in some way (like USB), and uses a helper thread.
Anyway, holding the global alldevs lock to look up a driver
specific instance is wrong.

best regards
Matthias



------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------
Forschungszentrum Juelich GmbH
52425 Juelich
Sitz der Gesellschaft: Juelich
Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
Dr. Ulrich Krafft (stellv. Vorsitzender), Prof. Dr.-Ing. Harald Bolt,
Prof. Dr. Sebastian M. Schmidt
------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------


Home | Main Index | Thread Index | Old Index