Problems with pcmcia code
Larry W. Finger
Larry.Finger at lwfinger.net
Wed Oct 22 00:50:02 BST 2003
At 12:26 PM 10/21/2003, David Hinds wrote:
>On Tue, Oct 21, 2003 at 10:50:36AM -0500, Larry W. Finger wrote:
> >
> > yenta_sock_init: entry
> > yenta_sock_init: re-enabling CSC interrupts
>
>At a glance, I think there could be several bugs in yenta_sock_init().
>Whenever you write to the CB_SOCKET_MASK register, you must always
>also do:
>
> cb_writel(socket, CB_SOCKET_EVENT, -1);
I haven't tried this yet. As seen below, the next suggestion fixed the
every-other-insert behavior.
>This might account for the every-other-insert-is-seen behavior, though
>it doesn't seem to be completely consistent with that.
>
>Also I am suspicious of this:
>
> cb_writel(socket, CB_SOCKET_FORCE, CB_CVSTEST);
>
>I would instead try something like:
>
> u32 state = cb_readl(socket, CB_SOCKET_STATE);
> if (!(state & (CB_CDETECT1 | CB_CDETECT2 | CB_5VCARD |
> CB_3VCARD | CB_XVCARD | CB_YVCARD)))
> cb_writel(socket, CB_SOCKET_FORCE, CB_CVSTEST);
>
>I'm not sure I can give a succinct explanation why. I only remember
>that "bad things happened" when I tried using CVSTEST liberally, and I
>later decided to never use it on a socket that had already completed
>card interrogation.
When I added the above code to yenta_socket, the every-other-time
activation went away. The system now recognizes every card
insertion/removal event.
>To the original poster, I'd suggest using "cardctl eject" and "cardctl
>insert" to trigger soft insert and eject events, to separate the event
>detection issue from what the modules do in response to the events.
This causes a new problem. After the card was recognized properly, I gave
the cardctl eject command. The system took a very long time to return a
prompt. When it did, the keyboard was locked; however, mouse events were
still recognized. I was able to telnet to the machine and issue a dmesg
command. The buffer had overflowed despite my having configured the kernel
with a 256K kernel message buffer. The buffer contains an unknown number of
the following 3 lines:
===============================================================
aha152x0: scsi reset in
(scsi-1:-1:-1) reselection missed?
waiting: rsti(rsti) SCSISEQ( TARGET MODE SELO SELI RESELI AUTOATNO AUTOATNI
AUTOATNP SCSIRSTO ); \
SCSISIG(MESSAGE IN); INTSTAT (hi); SSTAT( TARGET SELDO SELDI SELINGO
SWRAP SDONE SPIORDY DMADONE \
SELTO ATNTARG SCSIRSTI PHASEMIS BUSFREE SCSIPERR PHASECHG REQINIT );
SSTAT( TARGET SELDO SELDI \
SELINGO SWRAP SDONE SPIORDY DMADONE SELTO ATNTARG SCSIRSTI PHASEMIS
BUSFREE SCSIPERR PHASECHG \
REQINIT ); SXFRCTL0( SCSIEN DMAEN CH1 CLRSTCNT SPIOEN CLRCH1 );
SIGNAL( ATNI SELI BSYI REQI ACKI ); \
SELID (ff), STCNT (16777215), SSTAT2( SOFFSET SEMPTY SFULL ); SFCNT
(15); SCSICNT (15), OFFCNT(15), \
SSTAT4( SYNCERR FWERR FRERR ); DMACNTRL0( 8BIT DMA WRITE ENDMA INTEN
RSTFIFO SWINT ); \
DMASTAT( ATDONE WORDRDY DFIFOFULL DFIFOEMP )
================================================================
Following the last of the above messages are the kernel oops messages
listed below:
=================================================================
<1>Unable to handle kernel paging request at virtual address cc7d4d68
printing eip:
cf986a14
*pde = 00030067
*pte = 0c7d4000
Oops: 0000 [#1]
CPU: 0
EIP: 0060:[<cf986a14>] Not tainted
EFLAGS: 00010292
EIP is at disp_ports+0x1a4/0xa40 [aha152x_cs]
eax: 00000008 ebx: 00000001 ecx: c03ece20 edx: cbd88df8
esi: cc7d47f8 edi: 00000020 ebp: cef4bedc esp: cef4bec4
ds: 007b es: 007b ss: 0068
Process events/0 (pid: 3, threadinfo=cef4a000 task=cef69960)
Stack: cf98c2a7 cf98c0eb cf98bc9a cf98bc9a 00000000 cc7d47f8 cef4bf08 cf98536a
cc7d47f8 ffffffff ffffffff ffffffff 0000034c 00000000 00000246
cc7d47f8
00000001 cef4bf48 cf985b60 cc7d47f8 0ebdf363 0000003b 00000082
00000001
Call Trace:
[<cf98536a>] update_state+0xda/0x230 [aha152x_cs]
[<cf985b60>] is_complete+0x500/0x11d0 [aha152x_cs]
[<cf980f92>] run+0x42/0x50 [aha152x_cs]
[<c013dba7>] worker_thread+0x257/0x4d0
[<cf980f50>] run+0x0/0x50 [aha152x_cs]
[<c0121070>] default_wake_function+0x0/0x30
[<c010be86>] ret_from_fork+0x6/0x14
[<c0121070>] default_wake_function+0x0/0x30
[<c013d950>] worker_thread+0x0/0x4d0
[<c01090e9>] kernel_thread_helper+0x5/0xc
Code: 8b 96 70 05 00 00 83 c2 0c ec 0f b6 d8 84 db 0f 88 f0 06 00
ds_write(socket 0)
ds_poll(socket 0)
cs: send_event(sock 0, event 8, pri 1)
ds: ds_event(0x000008, 1, 0xce3f6ef8)
cs: shutdown_socket(ce43ec3c)
yenta_sock_init: entry
yenta_set_socket: flags 00000000 csc_mask 00000080 vcc 0 vpp 0 irq 0
yenta_set_io_map: map 0 flags 0 speed 0 start 00000000 stop 00000001
yenta_set_io_map: map 1 flags 0 speed 0 start 00000000 stop 00000001
yenta_set_mem_map: map 0 flags 0 speed 0 start 00000000 stop 00000fff card
00000000
yenta_set_mem_map: map 1 flags 0 speed 0 start 00000000 stop 00000fff card
00000000
yenta_set_mem_map: map 2 flags 0 speed 0 start 00000000 stop 00000fff card
00000000
yenta_set_mem_map: map 3 flags 0 speed 0 start 00000000 stop 00000fff card
00000000
yenta_set_mem_map: map 4 flags 0 speed 0 start 00000000 stop 00000fff card
00000000
yenta_sock_init: re-enabling CSC interrupts
yenta_set_socket: flags 00000000 csc_mask 00000080 vcc 0 vpp 0 irq 0
yenta_get_status: state 30000411 ret 000000c1
ds_release(socket 0)
show_interrupts: action 0xcc8cab24
Unable to handle kernel paging request at virtual address cf98be01
printing eip:
c0219c5e
*pde = 0ec8d067
*pte = 00000000
Oops: 0000 [#2]
CPU: 0
EIP: 0060:[<c0219c5e>] Not tainted
EFLAGS: 00010097
EIP is at vsnprintf+0x2ee/0x420
eax: cf98be01 ebx: 0000000a ecx: cf98be01 edx: fffffffe
esi: c22af0af edi: 00000000 ebp: c481fed0 esp: c481fe98
ds: 007b es: 007b ss: 0068
Process kdeinit (pid: 995, threadinfo=c481e000 task=c2dbe960)
Stack: c481fee0 c22affff 00000011 00000000 0000000a fffffffd 00000001 00000000
ffffffff ffffffff c22affff c20cf820 00000180 c20cf820 c481feec
c01a33a4
c22af0ad 00000f53 c03b038c c481ff00 cc8cab24 c481ff28 c010e17b
c20cf820
Call Trace:
[<c01a33a4>] seq_printf+0x34/0x60
[<c010e17b>] show_interrupts+0x14b/0x370
[<c01a2daf>] seq_read+0x12f/0x320
[<c018f502>] sys_select+0x222/0x4d0
[<c017455a>] vfs_read+0xaa/0x120
[<c01747ef>] sys_read+0x3f/0x60
[<c010bfaf>] syscall_call+0x7/0xb
Code: 80 38 00 74 07 40 4a 83 fa ff 75 f4 29 c8 83 e7 10 89 c3 75
<6>note: kdeinit[995] exited with preempt_count 1
bad: scheduling while atomic!
Call Trace:
[<c0121011>] schedule+0x8a1/0x8b0
[<c015df21>] unmap_page_range+0x41/0x70
[<c015e164>] unmap_vmas+0x214/0x330
[<c0163b2b>] exit_mmap+0xcb/0x2b0
[<c0124535>] mmput+0xb5/0x150
[<c012ac47>] do_exit+0x1a7/0x970
[<c011e170>] do_page_fault+0x0/0x56a
[<c011e170>] do_page_fault+0x0/0x56a
[<c010d1a7>] die+0x227/0x230
[<c011e356>] do_page_fault+0x1e6/0x56a
[<c0266092>] poke_blanked_console+0x12/0x70
[<c02653ee>] vt_console_print+0x21e/0x310
[<c0127e22>] call_console_drivers+0x72/0x140
[<c011e170>] do_page_fault+0x0/0x56a
[<c010c9b9>] error_code+0x2d/0x38
[<c0219c5e>] vsnprintf+0x2ee/0x420
[<c01a33a4>] seq_printf+0x34/0x60
[<c010e17b>] show_interrupts+0x14b/0x370
[<c01a2daf>] seq_read+0x12f/0x320
[<c018f502>] sys_select+0x222/0x4d0
[<c017455a>] vfs_read+0xaa/0x120
[<c01747ef>] sys_read+0x3f/0x60
[<c010bfaf>] syscall_call+0x7/0xb
bad: scheduling while atomic!
Call Trace:
[<c0121011>] schedule+0x8a1/0x8b0
[<c015df21>] unmap_page_range+0x41/0x70
[<c015e164>] unmap_vmas+0x214/0x330
[<c0163b2b>] exit_mmap+0xcb/0x2b0
[<c0124535>] mmput+0xb5/0x150
[<c012ac47>] do_exit+0x1a7/0x970
[<c011e170>] do_page_fault+0x0/0x56a
[<c011e170>] do_page_fault+0x0/0x56a
[<c010d1a7>] die+0x227/0x230
[<c011e356>] do_page_fault+0x1e6/0x56a
[<c0266092>] poke_blanked_console+0x12/0x70
[<c02653ee>] vt_console_print+0x21e/0x310
[<c0127e22>] call_console_drivers+0x72/0x140
[<c011e170>] do_page_fault+0x0/0x56a
[<c010c9b9>] error_code+0x2d/0x38
[<c0219c5e>] vsnprintf+0x2ee/0x420
[<c01a33a4>] seq_printf+0x34/0x60
[<c010e17b>] show_interrupts+0x14b/0x370
[<c01a2daf>] seq_read+0x12f/0x320
[<c018f502>] sys_select+0x222/0x4d0
[<c017455a>] vfs_read+0xaa/0x120
[<c01747ef>] sys_read+0x3f/0x60
[<c010bfaf>] syscall_call+0x7/0xb
Debug: sleeping function called from invalid context at
include/asm/semaphore.h:119
in_atomic():1, irqs_disabled():0
Call Trace:
[<c0123730>] __might_sleep+0xa0/0xf0
[<c0161a79>] remove_shared_vm_struct+0x39/0xa0
[<c0163c31>] exit_mmap+0x1d1/0x2b0
[<c0124535>] mmput+0xb5/0x150
[<c012ac47>] do_exit+0x1a7/0x970
[<c011e170>] do_page_fault+0x0/0x56a
[<c011e170>] do_page_fault+0x0/0x56a
[<c010d1a7>] die+0x227/0x230
[<c011e356>] do_page_fault+0x1e6/0x56a
[<c0266092>] poke_blanked_console+0x12/0x70
[<c02653ee>] vt_console_print+0x21e/0x310
[<c0127e22>] call_console_drivers+0x72/0x140
[<c011e170>] do_page_fault+0x0/0x56a
[<c010c9b9>] error_code+0x2d/0x38
[<c0219c5e>] vsnprintf+0x2ee/0x420
[<c01a33a4>] seq_printf+0x34/0x60
[<c010e17b>] show_interrupts+0x14b/0x370
[<c01a2daf>] seq_read+0x12f/0x320
[<c018f502>] sys_select+0x222/0x4d0
[<c017455a>] vfs_read+0xaa/0x120
[<c01747ef>] sys_read+0x3f/0x60
[<c010bfaf>] syscall_call+0x7/0xb
yenta_events: cb_event = 0x6, events = 0x80, csc = 0x0
yenta_interrupt: events 0x80, CB_SOCKET_STATE 0x30000417
yenta_get_status: state 30000417 ret 00000041
================================================================
The following two lines are repeated many times to the end of the
logging information:
================================================================
yenta_events: cb_event = 0x0, events = 0x0, csc = 0x0
yenta_interrupt: events 0x0, CB_SOCKET_STATE 0x30000417
===========================================================
Larry
More information about the linux-pcmcia
mailing list