Re: [patch] Fix deadlock in pcmcia as found by lockdep



On Fri, Jun 30, 2006 at 10:31:13AM +0200, Arjan van de Ven wrote:
On Thu, 2006-06-29 at 23:18 -0700, Miles Lane wrote:
To trigger this, I booted with a U.S. Robotics USR2210 Wifi card
plugged into my cardbus slot. I then ran "pccardctl eject" and then
removed and then reinserted the card. After looking at the latest
PCMCIA info, it seems that I may need to add some kernel boot options
to work around a BIOS or other problem that causes trouble when
removing a card.

PM: Removing info for pci:0000:02:00.0
PCMCIA: socket c1ebc9e0: *** DANGER *** unable to remove socket power


ok this looks like a real bug:

void pcmcia_parse_events(struct pcmcia_socket *s, u_int events)
{
cs_dbg(s, 4, "parse_events: events %08x\n", events);
if (s->thread) {
spin_lock(&s->thread_lock);
s->thread_events |= events;
spin_unlock(&s->thread_lock);

wake_up(&s->thread_wait);
}
} /* pcmcia_parse_events */


that function gets called from both user context and irq context!

user context:
[<c1181270>] pcmcia_parse_events+0x3e/0x6b
[<c1181945>] pcmcia_register_socket+0x29b/0x2fc
[<c118a8d1>] yenta_probe+0x51b/0x55c
[<c110d537>] pci_device_probe+0x39/0x5b

eg in pcmcia_register_socket:

ret = kernel_thread(pccardd, socket, CLONE_KERNEL);
if (ret < 0)
goto err;

wait_for_completion(&socket->thread_done);
if(!socket->thread) {
printk(KERN_WARNING "PCMCIA: warning: socket thread for
socket %p did not start\n", socket);
return -EIO;
}
pcmcia_parse_events(socket, SS_DETECT);

clearly sleeping/user context


interrupt context:
yenta_interrupt calls pcmcia_parse_events like this:
....
if (events)
pcmcia_parse_events(&socket->socket, events);

return IRQ_HANDLED;
}

and that's the irq handler.

Dominik: this really wants to have _irqsave versions of the spinlock
like this:

Applied.

Thanks,
Dominik
-
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

  • [patch] Fix deadlock in pcmcia as found by lockdep
    ... removed and then reinserted the card. ... PCMCIA info, it seems that I may need to add some kernel boot options ... that function gets called from both user context and irq context! ... IRQ context; the lock thus needs to be irqsave to avoid deadlocks ...
    (Linux-Kernel)
  • Re: enums vs OID pointers and a question about context
    ... does your embedded WEB server support it? ... same context, ... in every card MIB would need to be a table. ...
    (comp.protocols.snmp)
  • Re: Origin of Mahjong (MJ) / other Hu Pai Design
    ... That is a feature in mahjong has a similar feature in madiao ... Context is everything. ... It is those card packs of three ...
    (rec.games.mahjong)
  • Re: Victor Pelletier [Promo-20060417]
    ... you keep making and suggesting absolute ... has a context. ... talking about variety in terms of named card type AND IF the type ... card is bad for the game' or 'we don't need to do anything to help out ...
    (rec.games.trading-cards.jyhad)
  • Re: how do I record my classical guitar?
    ... For a classical guitar in a classical context something small ... M-audio Audiophile pci card comes to mind. ... Last time I recorded my Barslev guitar in my living room I ...
    (rec.audio.pro)