Re: [RFC][PATCH] netconsole: avoid deadlock on printk from driver code



From: Vegard Nossum <vegardno@xxxxxxxxxx>
Date: Wed, 13 Aug 2008 11:53:24 +0200

[PATCH] netconsole: avoid deadlock on printk from driver code

I encountered a hard-to-debug deadlock when I pulled out the plug of my
RealTek 8139 which was also running netconsole: The driver wants to print
a "link down" message. However, this triggers netconsole, which wants to
print the message using the same device. Here is a backtrace:

See my other reply, this is absolutely the wrong way to go about
this.

You only have two sane options:

1) Defer the link status printk message into a deferred context,
such as a workqueue, so that you can do it outside of the
lock.

2) Do your locking differently so that the link status handling
locking does not bisect the locking used for packet transmit
in ->hard_start_xmit().

#2 is the reason why most other drivers don't have this silly
bug, they don't hold TX path locks when handling link status
and printing out such messages.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



Relevant Pages

  • Re: [RFC/PATCH 0/22] W1: sysfs, lifetime and other fixes
    ... >> and they must follow protocol, defined in family driver. ... > bus - it's all the same. ... it requires different locking, which may race - and I will fix it. ... Bus master driver is low-level part that lives in it's own driver, ...
    (Linux-Kernel)
  • Re: Thanks for all the work on the MPSAFE network stack project
    ... :>> Paul Saab, Hidetoshi Shimokawa, Mike Silberback, Bruce Simpson, Gleb ... Nate Lawson fixed some ACPI related locking issues that were exposed ... by some network driver that I was locking, but since I lost all email ... And I think that some chap by the name of Robert Watson did a little ...
    (freebsd-current)
  • Re: [PATCH] drivers/isdn/gigaset: new M101 driver
    ... It is doubtful if the locking here does anything useful. ... already part of the kernel. ... would require significant changes in those other parts, ... adding the missing M101 hardware driver. ...
    (Linux-Kernel)
  • Re: [RFC][PATCH] netconsole: avoid deadlock on printk from driver code
    ... I encountered a hard-to-debug deadlock when I pulled out the plug of my ... RealTek 8139 which was also running netconsole: The driver wants to print ... We have assertand debugging printks ...
    (Linux-Kernel)
  • CFR: bridge locking
    ... Beware that buried in these changes are a renaming of the bridge MIB ... their "driver lock" before passing packets up. ... driver has a totally different locking strategy where this doesn't occur. ...
    (freebsd-net)