Skip to contentSkip to conversation

Kernel Panic: too few segs for DMA mapping increase AHC_NSEG

DISCUSSION Marco Berizzi 2 participants 3 messages Nov 19, 2001 – Nov 21, 2001

lore
Share & tools
lore
#0 lore raw

Hi everybody.

I have just upgraded my PC from 768MB RAM to 1GB.
I have recompiled the kernel (2.4.14) for hi mem support (4GB).

Now it's appening a very strange behaviour.
I have several file system on the same disk (vfat file system). I have compiled vfat driver as a module. So before try to mount I must issue a 'modprobe vfat'. I'm using Slackware 8.0. modutils version is 2.4.6

Then if I try to copy a file from that filesystem to the root filesystem I get this error:

Kernel panic: too few segs for DMA mappings increase AHC_NSEG

Usually this is the procedure:

root login
modprobe vfat
mount /dev/sda2 /mnt (to mount the fat partition)
cd /usr/src
cp /mnt/linux/kernel/linux-2.2.20.tar.bz2 . (I want to copy kernel source tarball from the vfat partition to /usr/src) CRASH..........

My MB is ABIT KT7A (bios rev ID 65 11/07/2001). Two 512 MB SDRAM (takei).
Other HW: AHA 39160, SCSI IBM HD DDYS 18130, Matrox G450. gcc version 2.95.3, binutils 2.10.91.0.4 (***not the original slack 8.0***, I have downgraded it for Oracle 9i)

If I compile a kernel without hi mem support all is fine.

#1 lore raw
Quoted 10 lines · Marco Berizzi

Hi everybody.

I have just upgraded my PC from 768MB RAM to 1GB.
I have recompiled the kernel (2.4.14) for hi mem support (4GB).

Now it's appening a very strange behaviour.
I have several file system on the same disk (vfat file system). I have compiled vfat driver as a module. So before try to mount I must issue a 'modprobe vfat'. I'm using Slackware 8.0. modutils version is 2.4.6

Quoted 4 lines

Then if I try to copy a file from that filesystem to the root filesystem I get this error:

Kernel panic: too few segs for DMA mappings increase AHC_NSEG

Aha! Finally someone that can provoke this easily. Could you please apply attached patch and reproduce? Thanks.

Signature · 1 line
Jens Axboe
scsi/aic7xxx/aic7xxx_linux.c renamed from scsi/aic7xxx/aic7xxx_linux.c~ +13 -3
@@ -624,9 +624,10 @@
 {
 	int	 consumed;
 
-	if ((scb->sg_count + 1) > AHC_NSEG)
-		panic("Too few segs for dma mapping.  "
-		      "Increase AHC_NSEG\n");
+	if ((scb->sg_count + 1) > AHC_NSEG) {
+		printk("Too few segs for dma mapping. Increase AHC_NSEG\n");
+		return -1;
+	}
 
 	consumed = 1;
 	sg->addr = ahc_htole32(addr & 0xFFFFFFFF);
@@ -1674,6 +1675,13 @@
 				len = sg_dma_len(cur_seg);
 				consumed = ahc_linux_map_seg(ahc, scb,
 							     sg, addr, len);
+				if (consumed == -1) {
+					printk("aic7xxx: scsi segs %d,
+						pci segs %d, aic segs %d\n",
+						cmd->use_sg, nseg,
+						scb->sg_count);
+					BUG();
+				}
 				sg += consumed;
 				scb->sg_count += consumed;
 				cur_seg++;
@@ -1705,6 +1713,8 @@
 			scb->sg_count = ahc_linux_map_seg(ahc, scb,
 							  sg, addr,
 							  cmd->request_bufflen);
+			if (scb->sg_count == -1)
+				BUG();
 			sg->len |= ahc_htole32(AHC_DMA_LAST_SEG);
 
 			/*
#2 lore raw
In reply to Marco Berizzi

...not good news.
Same behaviour: without hi mem support all right. With hi mem support (4GB) I get this error on console, after a kernel dump:

SCSI1:0:0:0 attempt to queue an abort message
SCSI1:0:0:0 command not found
aic7xxx_abort returns 0x2002

Then the system freeze completely, so I press the reset button. At the startup INIT calls fsck and when the checking is at about 55% it displays this message:

SCSI1:A:0:0 locking max tag count at 128

then the following startup procedure goes well.
I want to tell you that with this kernel (hi mem support enabled), all is working perfectly (I can compile a new working kernel, for example). X Window (4.1) plus kde is working well.
Only when I mount a vfat filesystem type and then I try to copy a file to the root partition I get this error.
Another point: I usually build only mass storage driver in the kernel (Adaptec AHA 39160 bios rev 3.10). I build as modules all other HW (nic, sound, USB), however only the SB PCI512 is loaded in this situation. I haven't any IDE device just one SCSI HD (IBM DDYS-T18350N firmware rev S93E) and one Plextor SCSI cdrom (UltraPlex 40max PX-40TS firmware revision 1.04).

----- Original Message -----
From: "Jens Axboe" <[email protected]>
To: "Marco Berizzi" <[email protected]>
Cc: <[email protected]>
Sent: Monday, November 19, 2001 10:44 AM
Subject: Re: Kernel Panic: too few segs for DMA mapping increase AHC_NSEG

Quoted 8 lines · Marco Berizzi
Quoted 7 lines

Hi everybody.

I have just upgraded my PC from 768MB RAM to 1GB.
I have recompiled the kernel (2.4.14) for hi mem support (4GB).

Now it's appening a very strange behaviour.
I have several file system on the same disk (vfat file system). I

have

Quoted 1 line
Quoted 1 line

compiled vfat driver as a module. So before try to mount I must

issue a

Quoted 3 lines
Quoted 3 lines

'modprobe vfat'. I'm using Slackware 8.0. modutils version is 2.4.6

Then if I try to copy a file from that filesystem to the root

filesystem

Quoted 11 lines
Quoted 3 lines

I get this error:

Kernel panic: too few segs for DMA mappings increase AHC_NSEG

Aha! Finally someone that can provoke this easily. Could you please apply attached patch and reproduce? Thanks.

--
Jens Axboe