public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* BUG: bad: [58e2a02eb18393e76a469580fedf7caec190eb5e] [SCSI] eata: convert to use the data buffer accessors
@ 2008-12-21 16:08 Arthur Marsh
  2008-12-22  2:09 ` FUJITA Tomonori
  0 siblings, 1 reply; 3+ messages in thread
From: Arthur Marsh @ 2008-12-21 16:08 UTC (permalink / raw)
  To: linux-scsi; +Cc: ballabio_dario

I've recently installed Debian on a PII-266 machine with DPT2044W SCSI 
controller.

Kernels 2.6.18-2.6.22 work fine, and kernels 2.6.23-2.6.27 lock up after 
loading the eata module using modprobe, with the error:

modprobe exited with preempt_count 1

I've run a git bisection and have a few more passes to go, but suspect 
the commit in the subject line,

[58e2a02eb18393e76a469580fedf7caec190eb5e] [SCSI] eata: convert to use 
the data buffer accessors

to be the patch which triggers the problem.

I'm not a C programmer, let alone a kernel programmer, but can build and 
check any suggested patches.

Is anyone successfully using the eata module since the data buffer 
accessors patch?

Is anyone able to examine the code to see if anything was done wrong in 
the data buffer accessors patch?

Regards,

Arthur.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: BUG: bad: [58e2a02eb18393e76a469580fedf7caec190eb5e] [SCSI] eata: convert to use the data buffer accessors
  2008-12-21 16:08 BUG: bad: [58e2a02eb18393e76a469580fedf7caec190eb5e] [SCSI] eata: convert to use the data buffer accessors Arthur Marsh
@ 2008-12-22  2:09 ` FUJITA Tomonori
  2008-12-22 17:47   ` Arthur Marsh
  0 siblings, 1 reply; 3+ messages in thread
From: FUJITA Tomonori @ 2008-12-22  2:09 UTC (permalink / raw)
  To: arthur.marsh; +Cc: linux-scsi, ballabio_dario

On Mon, 22 Dec 2008 02:38:16 +1030
Arthur Marsh <arthur.marsh@internode.on.net> wrote:

> I've recently installed Debian on a PII-266 machine with DPT2044W SCSI 
> controller.
> 
> Kernels 2.6.18-2.6.22 work fine, and kernels 2.6.23-2.6.27 lock up after 
> loading the eata module using modprobe, with the error:
> 
> modprobe exited with preempt_count 1
> 
> I've run a git bisection and have a few more passes to go, but suspect 
> the commit in the subject line,
> 
> [58e2a02eb18393e76a469580fedf7caec190eb5e] [SCSI] eata: convert to use 
> the data buffer accessors
> 
> to be the patch which triggers the problem.
> 
> I'm not a C programmer, let alone a kernel programmer, but can build and 
> check any suggested patches.
> 
> Is anyone successfully using the eata module since the data buffer 
> accessors patch?
> 
> Is anyone able to examine the code to see if anything was done wrong in 
> the data buffer accessors patch?

Sorry about the problem. Can you try this patch?


diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
index a73a6bb..976cdd5 100644
--- a/drivers/scsi/eata.c
+++ b/drivers/scsi/eata.c
@@ -1626,8 +1626,15 @@ static void map_dma(unsigned int i, struct hostdata *ha)
 
 	cpp->sense_len = SCSI_SENSE_BUFFERSIZE;
 
-	count = scsi_dma_map(SCpnt);
-	BUG_ON(count < 0);
+	if (!scsi_sg_count(SCpnt)) {
+		cpp->data_len = 0;
+		return;
+	}
+
+	count = pci_map_sg(ha->pdev, scsi_sglist(SCpnt), scsi_sg_count(SCpnt),
+			   pci_dir);
+	BUG_ON(!count);
+
 	scsi_for_each_sg(SCpnt, sg, count, k) {
 		cpp->sglist[k].address = H2DEV(sg_dma_address(sg));
 		cpp->sglist[k].num_bytes = H2DEV(sg_dma_len(sg));
@@ -1655,7 +1662,9 @@ static void unmap_dma(unsigned int i, struct hostdata *ha)
 		pci_unmap_single(ha->pdev, DEV2H(cpp->sense_addr),
 				 DEV2H(cpp->sense_len), PCI_DMA_FROMDEVICE);
 
-	scsi_dma_unmap(SCpnt);
+	if (scsi_sg_count(SCpnt))
+		pci_unmap_sg(ha->pdev, scsi_sglist(SCpnt), scsi_sg_count(SCpnt),
+			     pci_dir);
 
 	if (!DEV2H(cpp->data_len))
 		pci_dir = PCI_DMA_BIDIRECTIONAL;

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: BUG: bad: [58e2a02eb18393e76a469580fedf7caec190eb5e] [SCSI] eata: convert to use the data buffer accessors
  2008-12-22  2:09 ` FUJITA Tomonori
@ 2008-12-22 17:47   ` Arthur Marsh
  0 siblings, 0 replies; 3+ messages in thread
From: Arthur Marsh @ 2008-12-22 17:47 UTC (permalink / raw)
  To: linux-scsi; +Cc: ballabio_dario, 506835

FUJITA Tomonori wrote, on 22/12/08 12:39:

> 
> Sorry about the problem. Can you try this patch?
> 
> 
> diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c
> index a73a6bb..976cdd5 100644
> --- a/drivers/scsi/eata.c
> +++ b/drivers/scsi/eata.c
> @@ -1626,8 +1626,15 @@ static void map_dma(unsigned int i, struct hostdata *ha)
>  
>  	cpp->sense_len = SCSI_SENSE_BUFFERSIZE;
>  
> -	count = scsi_dma_map(SCpnt);
> -	BUG_ON(count < 0);
> +	if (!scsi_sg_count(SCpnt)) {
> +		cpp->data_len = 0;
> +		return;
> +	}
> +
> +	count = pci_map_sg(ha->pdev, scsi_sglist(SCpnt), scsi_sg_count(SCpnt),
> +			   pci_dir);
> +	BUG_ON(!count);
> +
>  	scsi_for_each_sg(SCpnt, sg, count, k) {
>  		cpp->sglist[k].address = H2DEV(sg_dma_address(sg));
>  		cpp->sglist[k].num_bytes = H2DEV(sg_dma_len(sg));
> @@ -1655,7 +1662,9 @@ static void unmap_dma(unsigned int i, struct hostdata *ha)
>  		pci_unmap_single(ha->pdev, DEV2H(cpp->sense_addr),
>  				 DEV2H(cpp->sense_len), PCI_DMA_FROMDEVICE);
>  
> -	scsi_dma_unmap(SCpnt);
> +	if (scsi_sg_count(SCpnt))
> +		pci_unmap_sg(ha->pdev, scsi_sglist(SCpnt), scsi_sg_count(SCpnt),
> +			     pci_dir);
>  
>  	if (!DEV2H(cpp->data_len))
>  		pci_dir = PCI_DMA_BIDIRECTIONAL;

Thanks, I applied the patch manually against the Debian 2.6.27 kernel 
source at http://kernel-archive.buildserver.net/ and after starting the 
  patched kernel, the eata module loaded successfully. I mounted the 
filesystems on the attached scsi disk and ran ls -alR on all filesystems 
successfully.

dmesg reported:

[  168.343910] PCI: setting IRQ 5 as level-triggered
[  168.343944] pci 0000:00:0a.0: found PCI INT A -> IRQ 5
[  168.346548] EATA/DMA 2.0x: Copyright (C) 1994-2003 Dario Ballabio.
[  168.346657] EATA config options -> tm:1, lc:y, mq:16, rs:y, et:n, 
ip:y, ep:n, pp:y.
[  168.346769] EATA0: 2.0C, PCI 0xe010, IRQ 5, BMST, SG 122, MB 64.
[  168.346863] EATA0: wide SCSI support enabled, max_id 16, max_lun 8.
[  168.346958] EATA0: SCSI channel 0 enabled, host target ID 7.
[  168.411912] scsi0 : EATA/DMA 2.0x rev. 8.10.00
[  169.953101] scsi 0:0:6:0: Direct-Access     IBM      DCAS-34330W 
  S65A PQ: 0 ANSI: 2
[  169.953239] scsi 0:0:6:0: cmds/lun 16, sorted, simple tags.
[  172.189180] Driver 'sd' needs updating - please use bus_type methods
[  172.193186] sd 0:0:6:0: [sda] 8466688 512-byte hardware sectors (4335 MB)
[  172.230078] sd 0:0:6:0: [sda] Write Protect is off
[  172.230191] sd 0:0:6:0: [sda] Mode Sense: b3 00 00 08
[  172.251052] sd 0:0:6:0: [sda] Write cache: enabled, read cache: 
enabled, doesn't support DPO or FUA
[  172.254288] sd 0:0:6:0: [sda] 8466688 512-byte hardware sectors (4335 MB)
[  172.263454] sd 0:0:6:0: [sda] Write Protect is off
[  172.263551] sd 0:0:6:0: [sda] Mode Sense: b3 00 00 08
[  172.284232] sd 0:0:6:0: [sda] Write cache: enabled, read cache: 
enabled, doesn't support DPO or FUA
[  172.284375]  sda: sda1 sda2 < sda5 >
[  172.322394] sd 0:0:6:0: [sda] Attached SCSI disk


As with 2.6.22 kernels gnu fdisk had problems with the scsi drive, but 
cfdisk and sfdisk were ok:

[  222.575704] fdisk[1996]: segfault at 60 ip 41b6d443 sp bff98034 error 
4 in libc-2.7.so[41af7000+155000]
[  249.063672] lfdisk[1998]: segfault at 60 ip 41b6d443 sp bfe50084 
error 4 in libc-2.7.so[41af7000+155000]

The gfdisk/lfdisk error was reported as Debian Bug#463720:

Thanks very much for the rapid response to this bug report!

Arthur.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-12-22 17:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-12-21 16:08 BUG: bad: [58e2a02eb18393e76a469580fedf7caec190eb5e] [SCSI] eata: convert to use the data buffer accessors Arthur Marsh
2008-12-22  2:09 ` FUJITA Tomonori
2008-12-22 17:47   ` Arthur Marsh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox