Skip to contentSkip to conversation

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

DISCUSSION Arthur Marsh 2 participants 3 messages Dec 21, 2008 – Dec 22, 2008 SCSI

lore
Share & tools
lore
#0 lore raw

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.

#1 lore raw
Quoted 16 lines · On Mon, 22 Dec 2008 02:38:16 +1030 Arthur Marsh…

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.

Quoted 8 lines

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?

drivers/scsi/eata.c +12 -3
index a73a6bb..976cdd5 100644
@@ -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;
#2 lore raw

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

Quoted 27 lines

Sorry about the problem. Can you try this patch?

drivers/scsi/eata.c +9 -2
index a73a6bb..976cdd5 100644
@@ -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));

drivers/scsi/eata.c static void unmap_dma(unsigned int i, struct hostdata *ha) · line 1670

Quoted 10 lines
drivers/scsi/eata.c +3 -1
@@ -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.