Skip to contentSkip to conversation

Hopefully fix PCMCIA boot deadlocks

CFT Russell King 3 participants 3 messages Apr 14, 2003 – Apr 15, 2003

lore
Share & tools
lore
#0 lore raw

Ok,

Here's my latest patch against 2.5.67 which introduces a proper state machine into the PCMCIA layer for handling the sockets. Unfortunately, I fear that this isn't the answer for the following reasons:

* We create our own workqueue (which spawns N threads, one thread per CPU.) We need to use a separate thread from the keventd since we call PCI probe and remove methods from this thread, which are free to use flush_scheduled_work() - which would be another deadlock waiting to happen. I think we need to go to a per-socket thread instead.

* The state machine isn't as readable as it should be. To be quite frank, I think it was a mistake to code it as a state machine - IMO its completely unreadable.

* We allow cardbus cards to be suspended and reset as though they are normal PCMCIA cards. Unfortunately, PCI drivers have no knowledge that these operations occur. This also applies to older kernels, so this isn't really a problem that's created by this patch.

This is even more true now that we have the capability to plug in a complete (possibly complex) PCI bus structure.

* There seems to be a whole bunch of setup stuff going on in pcmcia_register_client(). This is run each time a card device driver is inserted by cardmgr. Although this has buggy for the case where all drivers are built in, this patch makes it more buggy; if a card is inserted at the time ds.ko is loaded, we kick off the asynchronous state machine to process the card and carry on regardless.

However, we can not wait here - if we do wait for the state machine to complete, we will hit the same deadlock in the device model which we're hitting today.

It appears that it would mainly affect multi-function PCMCIA cards. Unfortunately, I don't have any to test.

That said, it seems to work for me.

The patch can be found at

http://patches.arm.linux.org.uk/pcmcia/pcmcia-1.diff

Now, thing is, I can't test this patch on its own; I can test it on ARM boxen with yenta cardbus bridges, or statically mapped PCMCIA-only sockets, but the former requires several other patches to the PCMCIA resource subsystem to be functional.

Hence I need other peoples feedback on this patch before I push it Linus-wards.

Signature · 2 lines
Russell King ([email protected])                The developer of ARM Linux
             http://www.arm.linux.org.uk/personal/aboutme.html
#1 lore raw
Quoted 5 lines · Russell King

Ok,

Here's my latest patch against 2.5.67 which introduces a proper state machine into the PCMCIA layer for handling the sockets. Unfortunately, I fear that this isn't the answer for the following reasons:

Well, maybe it's not the answer, but it's working for me with 2.5.67-mm3. Besides being too verbose, I have tried booting with the card plugged, booting with the card unplugged and then plugging it, and plugging/unplugging it several time to check that hotplug is working.

Haven't found any problems, although I'm testing right now on my main system (my everyday use laptop).

Nice work, Russell :-)

Signature · 3 lines
Please AVOID sending me WORD, EXCEL or POWERPOINT attachments.
See http://www.fsf.org/philosophy/no-word-attachments.html
Linux Registered User #287198
#2 lore raw
Quoted 11 lines · Felipe Alfaro Solana
Quoted 5 lines · Russell King

Ok,

Here's my latest patch against 2.5.67 which introduces a proper state machine into the PCMCIA layer for handling the sockets. Unfortunately, I fear that this isn't the answer for the following reasons:

Well, maybe it's not the answer, but it's working for me with 2.5.67-mm3. Besides being too verbose, I have tried booting with the card plugged, booting with the card unplugged and then plugging it, and plugging/unplugging it several time to check that hotplug is working.

Confirmed under vanilla 2.5.67 on a Dell C840. It's chatty, and I'll not comment on the neatness of implementation. But... ;)

It now boots with the offending card, without it, insert it, eject it, I haven't been able to confuse it (though I admit I havent tried a very fast insert/eject cycle so the eject arrives before the insert finishes). And yes, the card in question was a multifunction (abbreviated lspci -vv output):

03:00.0 Ethernet controller: Xircom Cardbus Ethernet 10/100 (rev 03)
Subsystem: Xircom Cardbus Ethernet 10/100
Control: I/O+ Mem+ BusMaster+ SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Latency: 64 (5000ns min, 10000ns max)
Interrupt: pin A routed to IRQ 11
Region 0: I/O ports at 1000 [size=128]
Region 1: Memory at 10800000 (32-bit, non-prefetchable) [size=2K]
Region 2: Memory at 10800800 (32-bit, non-prefetchable) [size=2K]
Expansion ROM at 10400000 [disabled] [size=16K]
Capabilities: [dc] Power Management version 1
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
Status: D0 PME-Enable- DSel=0 DScale=2 PME-

03:00.1 Serial controller: Xircom Cardbus Ethernet + 56k Modem (rev 03) (prog-if 02 [16550])
Subsystem: Xircom CBEM56G-100 Ethernet + 56k Modem
Control: I/O+ Mem+ BusMaster- SpecCycle- MemWINV- VGASnoop- ParErr- Stepping- SERR- FastB2B-
Status: Cap+ 66Mhz- UDF- FastB2B- ParErr- DEVSEL=medium >TAbort- <TAbort- <MAbort- >SERR- <PERR-
Interrupt: pin A routed to IRQ 11
Region 0: I/O ports at 1080 [size=8]
Region 1: Memory at 10801000 (32-bit, non-prefetchable) [size=2K]
Region 2: Memory at 10801800 (32-bit, non-prefetchable) [size=2K]
Expansion ROM at 10404000 [disabled] [size=16K]
Capabilities: [dc] Power Management version 1
Flags: PMEClk- DSI- D1+ D2+ AuxCurrent=0mA PME(D0+,D1+,D2+,D3hot+,D3cold+)
Status: D0 PME-Enable- DSel=0 DScale=2 PME-

Thanks Russell!