Skip to contentSkip to conversation

aha152x(_cs) oops

PATCH Randy.Dunlap 3 participants 11 messages Apr 13, 2006 – Apr 28, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Is aha152x(_cs) known not to work with highmem or is it just busted in its use of s/g list handling?
This is 2.6.17-rc1-git7 on a Dell notebook with 2 GB RAM.

On all recent kernels, I get an Oops in aha152x.c:datao_run(), where the SG_ADDRESS() macro uses page_address().

[42949628.890000] BUG: unable to handle kernel NULL pointer dereference at virtual address 00000000
[42949628.890000]  printing eip:
[42949628.890000] f8d033ea
[42949628.890000] *pde = 00000000
[42949628.890000] Oops: 0000 [#1]
[42949628.890000] SMP DEBUG_PAGEALLOC
[42949628.890000] Modules linked in: aha152x_cs snd_pcm_oss snd_mixer_oss snd_seq snd_seq_device usbhid usbmouse pcmcia ipw2200 ieee80211 ieee80211_crypt snd_intel8x0 snd_ac97_codec snd_ac97_bus snd_pcm yenta_socket rsrc_nonstatic pcmcia_core snd_timer snd soundcore snd_page_alloc
[42949628.890000] CPU:    0
[42949628.890000] EIP:    0060:[<f8d033ea>]    Not tainted VLI
[42949628.890000] EFLAGS: 00010206   (2.6.17-rc1-git7 #1) 
[42949628.890000] EIP is at datao_run+0xc4/0x1dd [aha152x_cs]
[42949628.890000] eax: f1f7ceb4   ebx: f794db20   ecx: 00000040   edx: 00000356
[42949628.890000] esi: 00000000   edi: 00000040   ebp: c2569f28   esp: c2569f0c
[42949628.890000] ds: 007b   es: 007b   ss: 0068
[42949628.890000] Process events/0 (pid: 5, threadinfo=c2568000 task=c2556af0)
[42949628.890000] Stack: <0>00000000 00000282 00000282 00000340 f794db20 00000001 f794d7f8 c2569f58 
[42949628.890000]        f8d02e48 f794d7f8 0000034c f794db30 00000001 ffffeec9 00000042 f8d06730 
[42949628.890000]        f8d06700 f8d06704 c25234f0 c2569f7c c012611b 00000000 00000292 f8d02acd

The Oops disappears if I prevent the driver from using highmem (force bounces to lowmem) the same way that the imm driver does it. (patch below) What is the correct way to fix this?

Thanks,
---
~Randy

From: Randy Dunlap <[email protected]>

Prevent highmem usage, bounce all buffers to lowmem, to prevent Oops in S/G list handling.

---
 drivers/scsi/aha152x.c |   11 +++++++++++
 1 files changed, 11 insertions(+)
drivers/scsi/aha152x.c +11 -0
@@ -3479,6 +3479,12 @@ static int aha152x_proc_info(struct Scsi
 	return thislength < length ? thislength : length;
 }
 
+static int aha152x_adjust_queue(struct scsi_device *device)
+{
+	blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_HIGH);
+	return 0;
+}
+
 static struct scsi_host_template aha152x_driver_template = {
 	.module				= THIS_MODULE,
 	.name				= AHA152X_REVID,
@@ -3495,6 +3501,11 @@ static struct scsi_host_template aha152x
 	.sg_tablesize			= SG_ALL,
 	.cmd_per_lun			= 1,
 	.use_clustering			= DISABLE_CLUSTERING,
+	.slave_alloc			= aha152x_adjust_queue,
+	.unchecked_isa_dma		= 1, /* driver cannot deal with
+					* highmem, so this is an easy trick
+					* to ensure all IO pages for this
+					* host reside in low memory */
 };
 
 #if !defined(PCMCIA)
#1 lore raw
Quoted 6 lines · Randy.Dunlap

Is aha152x(_cs) known not to work with highmem or is it just busted in its use of s/g list handling?
This is 2.6.17-rc1-git7 on a Dell notebook with 2 GB RAM.

On all recent kernels, I get an Oops in aha152x.c:datao_run(), where the SG_ADDRESS() macro uses page_address().

This routine is trying to do the identical action that Guennady Liakhovetski just posted a dc395x patch for (i.e. re-feed a DMA transaction via PIO) could we see if we can utilise pieces of that patch to do this correctly (or provide more common infrastructure)?

James

#2 lore raw
Quoted 5 lines · On Thu, 13 Apr 2006 12:40:36 -0500 James Bottomley wrote:
Quoted 4 lines · Randy.Dunlap

Is aha152x(_cs) known not to work with highmem or is it just busted in its use of s/g list handling?
This is 2.6.17-rc1-git7 on a Dell notebook with 2 GB RAM.

Quoted 7 lines
Quoted 2 lines

On all recent kernels, I get an Oops in aha152x.c:datao_run(), where the SG_ADDRESS() macro uses page_address().

This routine is trying to do the identical action that Guennady Liakhovetski just posted a dc395x patch for (i.e. re-feed a DMA transaction via PIO) could we see if we can utilise pieces of that patch to do this correctly (or provide more common infrastructure)?

I've spent a lot of time using the sg-PIO patch with the aha152x driver. The sg-PIO part of it works for me, but the aha152x driver sometimes does not complete a full DMA-out transfer (data-out phase). The driver calls this the need to "resend" some data (in datao_end()). I can't get this resend logic to work correctly with the sg-PIO changes and I can't keep spending time on it without some docs and/or errata, so I'll just continue to use my lowmem patch for the aha152x driver.

---
~Randy

#3 lore raw
Quoted 4 lines · Randy.Dunlap

I've spent a lot of time using the sg-PIO patch with the aha152x driver. The sg-PIO part of it works for me, but the aha152x driver sometimes does not complete a full DMA-out transfer (data-out phase). The driver calls this the need to "resend" some data (in datao_end()).

Sorry, didn't quite understand it - you mean the "in" direction modified to use sg-pio works, whereas the "out" doesn't? How exactly it doesn't work?

Quoted 4 lines

I can't get this resend logic to work correctly with the sg-PIO changes and I can't keep spending time on it without some docs and/or errata, so I'll just continue to use my lowmem patch for the aha152x driver.

Could you send me / upload your current patch using k(un)map_atomic_pio?

Thanks
Guennadi
---
Guennadi Liakhovetski

#4 lore raw
Quoted 10 lines · On Tue, 25 Apr 2006 22:41:28 +0200 (CEST) Guennadi Liakhovetski wrote:
Quoted 4 lines · Randy.Dunlap

I've spent a lot of time using the sg-PIO patch with the aha152x driver. The sg-PIO part of it works for me, but the aha152x driver sometimes does not complete a full DMA-out transfer (data-out phase). The driver calls this the need to "resend" some data (in datao_end()).

Sorry, didn't quite understand it - you mean the "in" direction modified to use sg-pio works, whereas the "out" doesn't? How exactly it doesn't work?

It's not a problem with the (your) sg patch. It's just that this SCSI chip sometimes (apparently) stops a DMA-out transfer before it should (e.g., half way thru an sg list). The driver detects this and decides that it needs to "resend" the remaining part of the sg list, but first it must back up the sg list ptr (possibly), the data transfer ptr (before this patch), this_residual, and possibly buffers_residual. I've made many attempts at doing that, but they are not succeeding.

Quoted 6 lines
Quoted 4 lines

I can't get this resend logic to work correctly with the sg-PIO changes and I can't keep spending time on it without some docs and/or errata, so I'll just continue to use my lowmem patch for the aha152x driver.

Could you send me / upload your current patch using k(un)map_atomic_pio?

Sure, it's here:
http://www.xenotime.net/linux/patches/aha152x-sg-pio.patch

---
~Randy

#5 lore raw

Hi

Quoted 13 lines · Randy.Dunlap
Quoted 10 lines · On Tue, 25 Apr 2006 22:41:28 +0200 (CEST) Guennadi Liakhovetski wrote:
Quoted 4 lines · Randy.Dunlap

I've spent a lot of time using the sg-PIO patch with the aha152x driver. The sg-PIO part of it works for me, but the aha152x driver sometimes does not complete a full DMA-out transfer (data-out phase). The driver calls this the need to "resend" some data (in datao_end()).

Sorry, didn't quite understand it - you mean the "in" direction modified to use sg-pio works, whereas the "out" doesn't? How exactly it doesn't work?

Quoted 8 lines

It's not a problem with the (your) sg patch. It's just that this SCSI chip sometimes (apparently) stops a DMA-out transfer before it should (e.g., half way thru an sg list). The driver detects this and decides that it needs to "resend" the remaining part of the sg list, but first it must back up the sg list ptr (possibly), the data transfer ptr (before this patch), this_residual, and possibly buffers_residual. I've made many attempts at doing that, but they are not succeeding.

What kind of device is it and what are you doing to reproduce the error? Do you know if the stock kernel / aha152x driver work if you boot without highmem?

Transferring "residual" bytes left after an incomplete DMA is exactly the same situation as in dc395x and tmscsim...

Quoted 4 lines
Quoted 1 line

Could you send me / upload your current patch using k(un)map_atomic_pio?

Sure, it's here:
http://www.xenotime.net/linux/patches/aha152x-sg-pio.patch

Thanks, looking at it. I have an old ISA SCSI card, that runs under aha152x...

Guennadi
---
Guennadi Liakhovetski

#6 lore raw
Quoted 26 lines · On Wed, 26 Apr 2006 22:05:40 +0200 (CEST) Guennadi Liakhovetski wrote:

Hi

Quoted 13 lines · Randy.Dunlap
Quoted 10 lines · On Tue, 25 Apr 2006 22:41:28 +0200 (CEST) Guennadi Liakhovetski wrote:
Quoted 4 lines · Randy.Dunlap

I've spent a lot of time using the sg-PIO patch with the aha152x driver. The sg-PIO part of it works for me, but the aha152x driver sometimes does not complete a full DMA-out transfer (data-out phase). The driver calls this the need to "resend" some data (in datao_end()).

Sorry, didn't quite understand it - you mean the "in" direction modified to use sg-pio works, whereas the "out" doesn't? How exactly it doesn't work?

Quoted 8 lines

It's not a problem with the (your) sg patch. It's just that this SCSI chip sometimes (apparently) stops a DMA-out transfer before it should (e.g., half way thru an sg list). The driver detects this and decides that it needs to "resend" the remaining part of the sg list, but first it must back up the sg list ptr (possibly), the data transfer ptr (before this patch), this_residual, and possibly buffers_residual. I've made many attempts at doing that, but they are not succeeding.

Quoted 3 lines

What kind of device is it and what are you doing to reproduce the error? Do you know if the stock kernel / aha152x driver work if you boot without highmem?

I'm using a PCMCIA (not CardBus) Adapter AP-1460 card on a new Dell notebook, with an iomega Jaz drive attached to it.

I haven't tested without highmem. I know that the in-kernel driver with a one-line patch works for me. The patch forces all buffers to lowmem, by setting
+ .unchecked_isa_dma = 1,
in the scsi_host_template.

I can test with a non-highmem kernel if you want me to, but I don't see much need to do that.

To reproduce the error: a kernel build will do it. However, the easiest way (hardest on the driver) is: mkfs.ext3 /dev/sdX4

Quoted 10 lines

Transferring "residual" bytes left after an incomplete DMA is exactly the same situation as in dc395x and tmscsim...

Quoted 4 lines
Quoted 1 line

Could you send me / upload your current patch using k(un)map_atomic_pio?

Sure, it's here:
http://www.xenotime.net/linux/patches/aha152x-sg-pio.patch

Thanks, looking at it. I have an old ISA SCSI card, that runs under aha152x...

---
~Randy

#7 lore raw
Quoted 2 lines · Randy.Dunlap

I'm using a PCMCIA (not CardBus) Adapter AP-1460 card on a new Dell notebook, with an iomega Jaz drive attached to it.

Ok, I attached a ZIP drive to my card...

Quoted 8 lines

I haven't tested without highmem. I know that the in-kernel driver with a one-line patch works for me. The patch forces all buffers to lowmem, by setting
+ .unchecked_isa_dma = 1,
in the scsi_host_template.

I can test with a non-highmem kernel if you want me to, but I don't see much need to do that.

What I want to achieve with this test is see, if the stock driver works fine without highmem in the PIO case. As you know, the driver has to calculate the position in the buffer where from/to it has to transfer the data. So, by disabling highmem we would see, if those calculations are right there, that would mean we have a problem with the kmem_atomic conversion, in which case we just have to check carefully our own calculations and compare them with the stock lowmem case. Whereas, if already the stock driver has a problem with lowmem PIO, then we, probably, won't get much further without chip docs.

Quoted 2 lines

To reproduce the error: a kernel build will do it. However, the easiest way (hardest on the driver) is: mkfs.ext3 /dev/sdX4

Ok, just tried

smartctl -a -T permissive /dev/sda

on my Zip - and got

(scsi0:6:9) command sent incompletely (6/10)

which also looks like a case similar to yours? Whereas creating a ext3 fs
+ running fsck -c -f didn't produce any more output. However, this doesn't mean much.

Thanks
Guennadi
---
Guennadi Liakhovetski

#8 lore raw
Quoted 33 lines · On Wed, 26 Apr 2006 23:32:06 +0200 (CEST) Guennadi Liakhovetski wrote:
Quoted 2 lines · Randy.Dunlap

I'm using a PCMCIA (not CardBus) Adapter AP-1460 card on a new Dell notebook, with an iomega Jaz drive attached to it.

Ok, I attached a ZIP drive to my card...

Quoted 8 lines

I haven't tested without highmem. I know that the in-kernel driver with a one-line patch works for me. The patch forces all buffers to lowmem, by setting
+ .unchecked_isa_dma = 1,
in the scsi_host_template.

I can test with a non-highmem kernel if you want me to, but I don't see much need to do that.

What I want to achieve with this test is see, if the stock driver works fine without highmem in the PIO case. As you know, the driver has to calculate the position in the buffer where from/to it has to transfer the data. So, by disabling highmem we would see, if those calculations are right there, that would mean we have a problem with the kmem_atomic conversion, in which case we just have to check carefully our own calculations and compare them with the stock lowmem case. Whereas, if already the stock driver has a problem with lowmem PIO, then we, probably, won't get much further without chip docs.

Quoted 2 lines

To reproduce the error: a kernel build will do it. However, the easiest way (hardest on the driver) is: mkfs.ext3 /dev/sdX4

Ok, just tried

smartctl -a -T permissive /dev/sda

Quoted 7 lines

on my Zip - and got

(scsi0:6:9) command sent incompletely (6/10)

which also looks like a case similar to yours? Whereas creating a ext3 fs
+ running fsck -c -f didn't produce any more output. However, this doesn't mean much.

I built a kernel without highmem support and banged on the jaz drive quite a bit with it, without errors AFAICT. I also did not see any evidence of "resend"s being needed, so it was a bit inconclusive.

---
~Randy

#9 lore raw
Quoted 3 lines · Randy.Dunlap

I built a kernel without highmem support and banged on the jaz drive quite a bit with it, without errors AFAICT. I also did not see any evidence of "resend"s being needed, so it was a bit inconclusive.

Hm, well, I don't see a burning need in fixing this particular driver "properly", I think, it might do with your fix for now. I might give it a couple more tries but it won't be too soon and not too intensive either, unless someone can give good reasons for the opposite.

Thanks
Guennadi
---
Guennadi Liakhovetski

#10 lore raw
Quoted 10 lines · Guennadi Liakhovetski
Quoted 3 lines · Randy.Dunlap

I built a kernel without highmem support and banged on the jaz drive quite a bit with it, without errors AFAICT. I also did not see any evidence of "resend"s being needed, so it was a bit inconclusive.

Hm, well, I don't see a burning need in fixing this particular driver "properly", I think, it might do with your fix for now. I might give it a couple more tries but it won't be too soon and not too intensive either, unless someone can give good reasons for the opposite.

Agreed, I don't have a problem with that.

Signature · 1 line
~Randy