Re: em0 panic: mutex em0 not owned



2007/11/22, Attilio Rao <attilio@xxxxxxxxxxx>:
2007/11/22, Benjamin Close <Benjamin.Close@xxxxxxxxxxxxxx>:
Hi Folks,
With a recent current I'm now getting panics when em0 tries to come up:

panic: mutex em0 not owned at ../../../kern/kern_mutex.c:144

_mtx_assert() + 0xdc
_callout_stop_safe()+0x5d
em_stop() + 0x50 (if_em.c:2546)
em_init_locked()+0x47 (if_em.c:1256)
em_ioctl()+0x466
ifhwioctl() + 0x75f
ifioctl() +0xb0
kern_ioctl() + 0xa3

This is even after atillos, latest patch.

Yes, this is a race access to callout_stop() in em driver.
callout_stop() needs to be called with callout-specific lock held
otherwise you can get a race and this seems not happening. I just
inserted this assertions in order to catch bugs like these.
I have no time to double-check it, can you do?

Ok, basically em_stop() both wants to stop core callout and tx channel
callout but it only holds core lock. It needs to hold both in order to
stop both. As I'm not sure about lock ordering there I can't produce a
patch now so the ball is in jfv@ court (CC'ed).

Thanks,
Attilio


--
Peace can only be achieved by understanding - A. Einstein
_______________________________________________
freebsd-current@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscribe@xxxxxxxxxxx"



Relevant Pages

  • Re: em0 panic: mutex em0 not owned
    ... basically em_stopboth wants to stop core callout and tx channel ... callout but it only holds core lock. ... patch now so the ball is in jfv@ court. ...
    (freebsd-current)
  • Re: em0 panic: mutex em0 not owned
    ... basically em_stopboth wants to stop core callout and tx channel ... callout but it only holds core lock. ... patch now so the ball is in jfv@ court. ...
    (freebsd-current)
  • [RFC] callout overhaul: part I
    ... Some benchmarks posted by rwatson some time ago ( ... would add the support for callout working with rwlock. ... only possible kind of lock to be used in conjuction with callouts and ...
    (freebsd-arch)
  • Re: cvs commit: src/sys/kern kern_timeout.c src/sys/sys callout.h
    ... Add the function callout_init_rw() to callout facility in order to use ... rwlocks in conjuction with callouts. ... CALLOUT_SHAREDLOCK flag can be used, now, in order to acquire the lock ... currently the allowed lock classes are mutexes and rwlocks because ...
    (freebsd-current)