Bug 8262 - PCMCIA: socket *** DANGER *** unable to remove socket power
PCMCIA: socket *** DANGER *** unable to remove socket power
Status: CLOSED CODE_FIX
Product: Drivers
Classification: Unclassified
Component: PCMCIA
i386 Linux
: P2 high
Assigned To: Dominik Brodowski
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-03-26 00:50 UTC by Nils Neumann
Modified: 2009-10-17 12:11 UTC (History)
6 users (show)

See Also:
Kernel Version: 2.6.20.4
Tree: Mainline
Regression: No


Attachments
testpatch: wait 100ms before power down check (1.07 KB, patch)
2007-07-29 12:46 UTC, Daniel Ritz
Details | Diff

Description Nils Neumann 2007-03-26 00:50:54 UTC
Most recent kernel where this bug did *NOT* occur: I don't know any.
Distribution: Debian Etch
Hardware Environment: Thinkpad T41p
Software Environment: pccardctl eject
Problem Description: 

The command "pccardctl eject" gives the following warning:

kernel: PCMCIA: socket f793c428: *** DANGER *** unable to remove socket power

It seems that this warning is wrong, because the pcmcia-card is offline. (LED 
is off.)

Steps to reproduce:
Inserting a pcmcia-card (I use the merlin u740.) and after this use "pccardctl 
eject". If I remove the card without pccardctl eject I get no warning from the 
kernel.

cat /proc/iomem  | grep -C1 yenta
b0000000-b0000fff : 0000:02:00.0
  b0000000-b0000fff : yenta_socket
b1000000-b1000fff : 0000:02:00.1
  b1000000-b1000fff : yenta_socket

lspci -vv  | grep -A14 Card
02:00.0 CardBus bridge: Texas Instruments PCI4520 PC card Cardbus Controller 
(rev 01)
        Subsystem: IBM Unknown device 0552
        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: 168, Cache Line Size: 64 bytes
        Interrupt: pin A routed to IRQ 11
        Region 0: Memory at b0000000 (32-bit, non-prefetchable) [size=4K]
        Bus: primary=02, secondary=03, subordinate=06, sec-latency=176
        Memory window 0: e8000000-ebfff000 (prefetchable)
        Memory window 1: c4000000-c7fff000
        I/O window 0: 00004000-000040ff
        I/O window 1: 00004400-000044ff
        BridgeCtl: Parity- SERR- ISA- VGA- MAbort- >Reset+ 16bInt+ PostWrite+
        16-bit legacy interface ports at 0001

02:00.1 CardBus bridge: Texas Instruments PCI4520 PC card Cardbus Controller 
(rev 01)
        Subsystem: IBM Unknown device 0552
        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: 168, Cache Line Size: 64 bytes
        Interrupt: pin B routed to IRQ 11
        Region 0: Memory at b1000000 (32-bit, non-prefetchable) [size=4K]
        Bus: primary=02, secondary=07, subordinate=07, sec-latency=176
        Memory window 0: ec000000-effff000 (prefetchable)
        Memory window 1: c8000000-cbfff000
        I/O window 0: 00004800-000048ff
        I/O window 1: 00004c00-00004cff
        BridgeCtl: Parity- SERR- ISA- VGA- MAbort- >Reset+ 16bInt- PostWrite+
        16-bit legacy interface ports at 0001

kernel: BIOS-e820: 00000000000dc000 - 0000000000100000 (reserved)
kernel: BIOS-e820: 0000000000100000 - 000000003ff40000 (usable)
kernel: BIOS-e820: 000000003ff40000 - 000000003ff52000 (ACPI data)
kernel: BIOS-e820: 000000003ff52000 - 000000003ff54000 (ACPI NVS)
kernel: BIOS-e820: 000000003ff80000 - 0000000040000000 (reserved)
kernel: BIOS-e820: 00000000ff800000 - 0000000100000000 (reserved)
Comment 1 Anonymous Emailer 2007-03-26 02:16:43 UTC
Reply-To: pcmcia@arm.linux.org.uk

On Mon, Mar 26, 2007 at 12:50:55AM -0700, bugme-daemon@bugzilla.kernel.org wrote:
> The command "pccardctl eject" gives the following warning:
> 
> kernel: PCMCIA: socket f793c428: *** DANGER *** unable to remove socket power
> 
> It seems that this warning is wrong, because the pcmcia-card is offline. (LED 
> is off.)

FYI, the warning is generated when the status from the PCMCIA bridge
indicates that the power is still applied to the socket, despite the
socket being instructed to power itself off.

IOW, something is interfering with the CPU's ability to communicate
with the PCMCIA bridge.  I'll let those more into this issue make
further suggestions.

Comment 2 Nils Neumann 2007-04-26 10:47:27 UTC
same problem with 2.6.21 

(only as information, because there are no patches between 2.6.20->2.6.21 
regarding this error)
Comment 3 Natalie Protasevich 2007-07-06 16:15:08 UTC
Nils,
Can you confirm the problem is still there in latest kernels (2.6.22+)?
Thanks.
Comment 4 Nils Neumann 2007-07-07 00:55:33 UTC
I test kernel 2.6.22-rc7 and the problem is still there.
Comment 5 Nils Neumann 2007-07-10 10:00:58 UTC
... and the same problem with final 2.6.22 (It seems to be another bug, but an active pcmcia-card prevents power state C3/C4.)
Comment 6 Nils Neumann 2007-07-10 23:53:41 UTC
Relation between bug "*** DANGER *** unable to remove socket power" and power state C3/C4.
1.) inserting pcmcia card
2.) initialize the driver (I use the option module for umts.)
3.) the pcmcia card prevents power state C3/C4 (high power consumption!)


4a.) remove the card without "pccardctl eject" (not a nice solution, because the card is powered) -> everything works fine, also CPU power state C3/C4 can be used

-- or --

4b.) remove the card with "pccardctl eject" -> "*** DANGER *** unable ...." and the CPU power state C3/C4 is unuseable, also after physical removing the card.
Comment 7 Andrew Morton 2007-07-24 14:15:50 UTC
Looks like a pcmcia core problem.  I'll assign it to 
Dominik - hopefully he will find time to look at it when he
gets back on deck.
Comment 8 Daniel Ritz 2007-07-28 13:15:36 UTC
please post the relevant parts from dmesg as well as the output of this command
after you got the power warning:
  cat /sys/devices/pci0000\:00/*/yenta_registers
Comment 9 Nils Neumann 2007-07-29 01:10:20 UTC
Here are the outputs from dmesg/yenta_registers before/after the warning:

# outputs after inserting the card
# --------------------------------
# dmesg
ohci_hcd 0000:07:00.1: OHCI Host Controller
ohci_hcd 0000:07:00.1: new USB bus registered, assigned bus number 6
ohci_hcd 0000:07:00.1: irq 11, io mem 0xc8001000
usb usb6: configuration #1 chosen from 1 choice
hub 6-0:1.0: USB hub found
hub 6-0:1.0: 2 ports detected
usb 5-1: new full speed USB device using ohci_hcd and address 2
usb 5-1: device descriptor read/64, error -62
usb 5-1: device descriptor read/64, error -62
usb 5-1: new full speed USB device using ohci_hcd and address 3
usb 5-1: device descriptor read/64, error -62
usb 5-1: device descriptor read/64, error -62
usb 5-1: new full speed USB device using ohci_hcd and address 4
usb 5-1: device not accepting address 4, error -62
usb 5-1: new full speed USB device using ohci_hcd and address 6
usb 5-1: configuration #1 chosen from 1 choice
drivers/usb/serial/usb-serial.c: USB Serial support registered for GSM modem (1-port)
option 5-1:1.0: GSM modem (1-port) converter detected
usb 5-1: GSM modem (1-port) converter now attached to ttyUSB0
option 5-1:1.1: GSM modem (1-port) converter detected
usb 5-1: GSM modem (1-port) converter now attached to ttyUSB1
usbcore: registered new interface driver option
drivers/usb/serial/option.c: USB Driver for GSM modems: v0.7.1

# cat /sys/devices/pci0000:00/0000:00:1e.0/0000\:02\:00.0/yenta_registers
CB registers:
00: 00000000 00000006 30000086 00000000
10: 00000000 00000000 00000000 00000000
20: 00000000

ExCA registers:
00: 84 00 00 50 00 08 00 00 - 00 00 01 00 00 00 01 00
10: 00 00 00 00 00 00 c0 00 - 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
30: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
40: 00 00 00 00 00

# cat /sys/devices/pci0000:00/0000:00:1e.0/0000\:02\:00.1/yenta_registers
CB registers:
00: 00000000 00000006 30000968 00000000
10: 00000033 00000000 00000000 00000000
20: 03000000

ExCA registers:
00: 84 7e 19 50 00 08 00 00 - 00 00 01 00 00 00 01 00
10: 00 00 00 00 00 00 c0 00 - 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
30: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
40: 00 00 00 00 00


# outputs after the power warning (pccardctl eject)
# -------------------------------------------------
# dmesg
pccard: card ejected from slot 1
ohci_hcd 0000:07:00.0: remove, state 1
usb usb5: USB disconnect, address 1
usb 5-1: USB disconnect, address 6
ohci_hcd 0000:07:00.0: HC died; cleaning up
ohci_hcd 0000:07:00.1: HC died; cleaning up
option1 ttyUSB0: GSM modem (1-port) converter now disconnected from ttyUSB0
option 5-1:1.0: device disconnected
option1 ttyUSB1: GSM modem (1-port) converter now disconnected from ttyUSB1
option 5-1:1.1: device disconnected
ohci_hcd 0000:07:00.0: USB bus 5 deregistered
ACPI: PCI interrupt for device 0000:07:00.0 disabled
ohci_hcd 0000:07:00.1: remove, state 0
usb usb6: USB disconnect, address 1
ohci_hcd 0000:07:00.1: USB bus 6 deregistered
ACPI: PCI interrupt for device 0000:07:00.1 disabled
PCMCIA: socket f7503840: *** DANGER *** unable to remove socket power

# cat /sys/devices/pci0000:00/0000:00:1e.0/0000\:02\:00.0/yenta_registers
CB registers:
00: 00000000 00000006 30000086 00000000
10: 00000000 00000000 00000000 00000000
20: 00000000

ExCA registers:
00: 84 00 00 50 00 08 00 00 - 00 00 01 00 00 00 01 00
10: 00 00 00 00 00 00 c0 00 - 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
30: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
40: 00 00 00 00 00

# cat /sys/devices/pci0000:00/0000:00:1e.0/0000\:02\:00.1/yenta_registers
CB registers:
00: 00000000 00000006 30000920 00000000
10: 00000000 00000000 00000000 00000000
20: 02000000

ExCA registers:
00: 84 0c 00 50 00 08 00 00 - 00 00 01 00 00 00 01 00
10: 00 00 00 00 00 00 c0 00 - 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
30: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
40: 00 00 00 00 00


# output after physical removing the card
# ---------------------------------------
# dmesg
nothing more

# cat /sys/devices/pci0000:00/0000:00:1e.0/0000\:02\:00.0/yenta_registers
CB registers:
00: 00000000 00000006 30000086 00000000
10: 00000000 00000000 00000000 00000000
20: 00000000

ExCA registers:
00: 84 00 00 50 00 08 00 00 - 00 00 01 00 00 00 01 00
10: 00 00 00 00 00 00 c0 00 - 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
30: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
40: 00 00 00 00 00

# cat /sys/devices/pci0000:00/0000:00:1e.0/0000\:02\:00.1/yenta_registers
CB registers:
00: 00000000 00000006 30000126 00000000
10: 00000000 00000000 00000000 00000000
20: 00000000

ExCA registers:
00: 84 00 00 50 00 08 00 00 - 00 00 01 00 00 00 01 00
10: 00 00 00 00 00 00 c0 00 - 00 00 00 00 00 00 00 00
20: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
30: 00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00
40: 00 00 00 00 00
Comment 10 Daniel Ritz 2007-07-29 12:43:35 UTC
the registers show that no power is applied after the warning, so the warning is
wrong:

# cat /sys/devices/pci0000:00/0000:00:1e.0/0000\:02\:00.1/yenta_registers
CB registers:
00: 00000000 00000006 30000920 00000000
                           ^^^ = 3V, CB card, dataloss, no power applied

for the C3/C4 problem i'd suggest to build a tickless kernel (CONFIG_NO_HZ) and
use powertop (http://www.linuxpowertop.org/) to figure out what keeps the CPU busy
Comment 11 Daniel Ritz 2007-07-29 12:46:55 UTC
Created attachment 12195 [details]
testpatch: wait 100ms before power down check

- remove pointless shutdown_delay
- give socket 100ms to powerdown before checking state
Comment 12 Nils Neumann 2007-07-29 23:20:19 UTC
The testpatch is working fine:

# dmesg  after pccardctl eject
ohci_hcd 0000:07:00.1: remove, state 4
usb usb6: USB disconnect, address 1
ohci_hcd 0000:07:00.1: USB bus 6 deregistered
ACPI: PCI interrupt for device 0000:07:00.1 disabled

I use also powertop and a tickless kernel. My computer is nearly always in C4 state. After inserting the pcmcia-card it is furthermore in C4 state, but then I connect to the umts network and C3/C4 doesn't work. Powertop shows no information about the problem. The number of interrupts is the same.

I think this bug is solved, but it would be nice if anyone has an idea why the C3/C4 is prevented.

Thank you for the patch!
Comment 13 Andrew Morton 2007-07-30 12:16:28 UTC
Merged pcmcia-give-socket-time-to-power-down.patch into -mm.
Comment 14 Nils Neumann 2007-09-29 23:58:02 UTC
It's fixed since kernel 2.6.22.2,
the C3/C4 problem is not regarding this bug report, because it seems to be a problem with the usb-subsystem.

Note You need to log in before you can comment on or make changes to this bug.