2003-09-04 20:41:24

by Matias Alejo Garcia

[permalink] [raw]
Subject: [PATCH] ide_cs w/TCQ


Hi Bart,

I reported I problem (Unable to handle kernel NULL pointer...) when
inserting a CF card in a PCMCIA adapter in 2.6.0test1. The problem
continues in test4 (log below, when inserting a card).

The problem only is present when BLK_DEV_TCQ_DEFAULT is enabled. It
seems that ide_cs (or ide, don't know) does not correctly initialize
hwif->ide_dma_queued_on() ...I don't know how this should be fixed if
the driver doesn't use DMA:

1) Not calling ide_dma_queued_on
or
2) Initializind ide_dma_queued_on to a dummy function

I tried 1) and it works...

Here is the patch...be gentle is my first contribution :-)

Thanks!
matias

--
mat?as <-> http://matiu.com.ar



--- linux-2.6.0-test4/drivers/ide/ide-disk.c.orig 2003-09-04
16:45:40.000000000 -0400
+++ linux-2.6.0-test4/drivers/ide/ide-disk.c 2003-09-04
15:41:25.000000000 -0400
@@ -1689,6 +1689,7 @@
write_cache(drive, (id->cfs_enable_2 & 0x3000));

#ifdef CONFIG_BLK_DEV_IDE_TCQ_DEFAULT
+ if (drive->using_dma)
HWIF(drive)->ide_dma_queued_on(drive);
#endif
}



-----------
Sep 4 05:01:28 runner cardmgr[793]: socket 0: ATA/IDE Fixed Disk
Sep 4 05:01:28 runner cardmgr[793]: executing: 'modprobe ide-cs'
Sep 4 05:01:31 runner kernel: hde: SanDisk SDCFB-32, CFA DISK drive
Sep 4 05:01:31 runner kernel: ide2 at 0x140-0x147,0x14e on irq 5
Sep 4 05:01:31 runner kernel: hde: max request size: 128KiB
Sep 4 05:01:31 runner kernel: hde: 62720 sectors (32 MB) w/1KiB Cache,
CHS=490/4/32
Sep 4 05:01:31 runner kernel: Unable to handle kernel NULL pointer
dereference at virtual address 00000000
Sep 4 05:01:31 runner kernel: printing
eip: Sep 4 05:01:31 runner kernel:
00000000
Sep 4 05:01:31 runner kernel: *pde = 00000000
Sep 4 05:01:31 runner kernel: Oops: 0000 [#1]
Sep 4 05:01:31 runner kernel: CPU: 0
Sep 4 05:01:31 runner kernel: EIP: 0060:[<00000000>] Tainted:
P Sep 4 05:01:31 runner kernel: EFLAGS: 00010246
Sep 4 05:01:31 runner kernel: EIP is at
0x0 Sep 4 05:01:31 runner kernel:
eax: c0427668 ebx: 00000020 ecx: de365400 edx:
00000000 Sep 4 05:01:31 runner kernel: esi: c0427714 edi: 0000f500 ebp: 00000000 esp: dbaf55a0
Sep 4 05:01:31 runner kernel: ds: 007b es: 007b ss:
0068 Sep 4 05:01:31 runner kernel: Process cardmgr
(pid: 793, threadinfo=dbaf4000 task=dbdaac80)
Sep 4 05:01:31 runner kernel: Stack: c024eb95 c0427714 000001ea
00000004 00000020 00000020 00000000 0000f500
Sep 4 05:01:31 runner kernel: 04000000 de365400 c0427714
c03b2844 dbaf4000 dfb82280 c024efa4 c0427714
Sep 4 05:01:31 runner kernel: c03b2780 00000001 00000001
c03b2844 dbaf4000 c03b2780 c024aa22 c0427714
Sep 4 05:01:32 runner kernel: Call
Trace: Sep 4 05:01:32 runner
kernel: [<c024eb95>] idedisk_setup+0x33b/0x412
Sep 4 05:01:32 runner kernel: [<c024efa4>]
idedisk_attach+0xae/0x1a4 Sep 4 05:01:32 runner kernel:
[<c024aa22>] ata_attach+0x96/0x1b2
Sep 4 05:01:32 runner kernel: [<c02446c4>]
ideprobe_init+0xe0/0xfc Sep 4 05:01:32 runner kernel:
[<c0248ec3>] ide_probe_module+0xd/0x10
Sep 4 05:01:32 runner kernel: [<c0249cbb>] ide_register_hw+0x155/0x186
Sep 4 05:01:32 runner kernel: [<e0845224>] idecs_register+0x5e/0x70
[ide_cs]


[bla bla bla]

Sep 4 05:01:33 runner kernel: Code: Bad EIP value.



Subject: Re: [PATCH] ide_cs w/TCQ

On Thursday 04 of September 2003 23:27, MAtias Alejo Garcia wrote:
> Hi Bart,

Hi,

> I reported I problem (Unable to handle kernel NULL pointer...) when
> inserting a CF card in a PCMCIA adapter in 2.6.0test1. The problem
> continues in test4 (log below, when inserting a card).
>
> The problem only is present when BLK_DEV_TCQ_DEFAULT is enabled. It
> seems that ide_cs (or ide, don't know) does not correctly initialize
> hwif->ide_dma_queued_on() ...I don't know how this should be fixed if
> the driver doesn't use DMA:

Yes, thanks!

> 1) Not calling ide_dma_queued_on
> or
> 2) Initializind ide_dma_queued_on to a dummy function
>
> I tried 1) and it works...

3) initialize ide_dma_queued_on to __ide_dma_queued_on()

because drive->using_dma is checked inside __ide_dma_queud_on,
but that looks stupid to assign it in DMA-unaware driver :-).

> Here is the patch...be gentle is my first contribution :-)
>
> Thanks!
> matias

--bartlomiej

2003-09-05 00:35:55

by Matias Alejo Garcia

[permalink] [raw]
Subject: Re: [PATCH] ide_cs w/TCQ

On Thu, 2003-09-04 at 17:04, Bartlomiej Zolnierkiewicz wrote:

> 3) initialize ide_dma_queued_on to __ide_dma_queued_on()
>
> because drive->using_dma is checked inside __ide_dma_queud_on,
> but that looks stupid to assign it in DMA-unaware driver :-).

Ok :-) then How it should be done? 3)?

I just found that when I eject the CF I get <see below>
I that already corrected, should I try to solve that?

thanks!
mat?as

--
mat?as <-> http://matiu.com.ar


Sep 4 16:55:32 runner kernel: Device 'ide2' does not have a release()
function, it is broken and must be fixed.
Sep 4 16:55:32 runner kernel: Badness in device_release at
drivers/base/core.c:85
Sep 4 16:55:32 runner kernel: Call Trace:
Sep 4 16:55:32 runner kernel: [<c021e9f1>] device_release+0x41/0x50
Sep 4 16:55:32 runner kernel: [<c01d88e9>] kobject_cleanup+0x29/0x40
Sep 4 16:55:32 runner kernel: [<c021ed0b>] device_unregister+0xb/0x20
Sep 4 16:55:32 runner kernel: [<c0238b14>] ide_unregister+0x314/0x850
Sep 4 16:55:32 runner kernel: [<c0121847>] printk+0x127/0x150
[bla bla bla]