mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Ross Biro <rossb@google.com>
Cc: linux-kernel@vger.kernel.org, alan@redhat.com
Subject: Re: 2.4.21-pre3 kernel crash
Date: 27 Jan 2003 20:21:35 +0100	[thread overview]
Message-ID: <1043695294.2755.61.camel@zion.wanadoo.fr> (raw)
In-Reply-To: <1043694192.2756.55.camel@zion.wanadoo.fr>

Ok, after a second look, 2.4.20 seem correct. Here's a patch against 2.4.21-pre3
doing it like 2.4.20 did.

Let me know if it helps


===== drivers/ide/ide-dma.c 1.7 vs edited =====
--- 1.7/drivers/ide/ide-dma.c	Tue Dec 10 21:21:57 2002
+++ edited/drivers/ide/ide-dma.c	Mon Jan 27 20:17:35 2003
@@ -249,36 +249,54 @@
 {
 	struct buffer_head *bh;
 	struct scatterlist *sg = hwif->sg_table;
+	unsigned long lastdataend = ~0UL;
 	int nents = 0;
 
 	if (hwif->sg_dma_active)
 		BUG();
 
+	hwif->sg_dma_direction = ddir;
+
 	bh = rq->bh;
 	do {
-		unsigned char *virt_addr = bh->b_data;
-		unsigned int size = bh->b_size;
+		struct scatterlist *sge;
+
+		/*
+		 * continue segment from before?
+		 */
+		if (bh_phys(bh) == lastdataend) {
+			sg[nents - 1].length += bh->b_size;
+			lastdataend += bh->b_size;
+			continue;
+		}
 
+		/*
+		 * start new segment
+		 */
 		if (nents >= PRD_ENTRIES)
 			return 0;
 
-		while ((bh = bh->b_reqnext) != NULL) {
-			if ((virt_addr + size) != (unsigned char *) bh->b_data)
-				break;
-			size += bh->b_size;
+		sge = &sg[nents];
+		memset(sge, 0, sizeof(*sge));
+
+		if (bh->b_page) {
+			sge->page = bh->b_page;
+			sge->offset = bh_offset(bh);
+		} else {
+			if (((unsigned long) bh->b_data) < PAGE_SIZE)
+				BUG();
+
+			sge->address = bh->b_data;
 		}
-		memset(&sg[nents], 0, sizeof(*sg));
-		sg[nents].address = virt_addr;
-		sg[nents].length = size;
-		if(size == 0)
-			BUG();
+
+		sge->length = bh->b_size;
+		lastdataend = bh_phys(bh) + bh->b_size;
 		nents++;
-	} while (bh != NULL);
+	} while ((bh = bh->b_reqnext) != NULL);
 
 	if(nents == 0)
 		BUG();
 		
-	hwif->sg_dma_direction = ddir;
 	return pci_map_sg(hwif->pci_dev, sg, nents, ddir);
 }
 


  reply	other threads:[~2003-01-27 19:10 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-27 15:41 Martin MOKREJŠ
2003-01-27 16:53 ` Ross Biro
2003-01-27 17:13   ` Martin MOKREJŠ
2003-01-27 19:23     ` Jens Axboe
2003-01-27 20:27       ` Edward Tandi
2003-01-27 20:36         ` Jeff Garzik
2003-01-27 20:47           ` Edward Tandi
2003-01-27 20:57             ` Jeff Garzik
2003-01-28  9:08               ` Alan Cox
2003-01-28 10:50         ` Martin MOKREJŠ
2003-01-27 23:18       ` J.A. Magallon
2003-01-27 23:24         ` Jens Axboe
2003-01-28  0:02           ` J.A. Magallon
2003-01-27 19:03   ` Benjamin Herrenschmidt
2003-01-27 19:21     ` Benjamin Herrenschmidt [this message]
2003-01-27 19:25     ` Jens Axboe
2003-01-27 19:45     ` Alan Cox
2003-01-27 19:49       ` Jens Axboe
2003-01-28 16:41 Larry Sendlosky
2003-01-28 22:06 ` Jens Axboe
2003-01-29  8:23   ` Benjamin Herrenschmidt
2003-01-29  8:53     ` Jens Axboe
2003-01-29  9:44       ` Benjamin Herrenschmidt
2003-01-29 10:16         ` Jens Axboe
2003-01-29  8:23 Benjamin Herrenschmidt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1043695294.2755.61.camel@zion.wanadoo.fr \
    --to=benh@kernel.crashing.org \
    --cc=alan@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rossb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®