mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@suse.de>
To: Andi Kleen <ak@suse.de>
Cc: Andy Chittenden <AChittenden@bluearc.com>,
	Anton Altaparmakov <aia21@cam.ac.uk>,
	Andrew Morton <akpm@osdl.org>,
	davej@redhat.com, linux-kernel@vger.kernel.org,
	lwoodman@redhat.com,
	Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
Subject: Re: adding swap workarounds oom - was: Re: Out of Memory: Killed process 16498 (java).
Date: Wed, 1 Mar 2006 15:34:38 +0100	[thread overview]
Message-ID: <20060301143438.GX4816@suse.de> (raw)
In-Reply-To: <200603011526.39457.ak@suse.de>

On Wed, Mar 01 2006, Andi Kleen wrote:
> On Wednesday 01 March 2006 15:18, Jens Axboe wrote:
> > On Wed, Mar 01 2006, Andi Kleen wrote:
> > > On Wednesday 01 March 2006 14:41, Jens Axboe wrote:
> > > > On Wed, Mar 01 2006, Andy Chittenden wrote:
> > > > > with revised patch that does:
> > > > > 
> > > > >                 printk("sg%d: dma=%llx, dma_len=%u/%u, pfn=%lu\n", i,
> > > > > (unsigned long long) sg->dma_address, sg->dma_length, sg->offset,
> > > > > page_to_pfn(sg->page));
> > > > 
> > > > That is correct, thanks!
> > > > 
> > > > > hda: DMA table too small
> > > > > ide dma table, 255 entries, bounce pfn 1310720
> > > > > sg0: dma=81c8800, dma_len=4096/0, pfn=1296369
> > > > 
> > > > Still the same badness here, it's 2kb into a page so straddles two pages
> > > > for one entry.
> > > 
> > > That's normal if it was in the IOMMU and a merged entry. 
> > > 
> > > You can try iommu=nomerge.
> > > 
> > > Or maybe the higher layers are passing in physically continuous pages
> > > that get merged? Not too unlikely at boot.
> > 
> > But that would have to be 1kb or 512b io going in
> 
> Yes. Why not?

It's not totally out of the question, but I would say it's unlikely.
Andy, I have generated a new debug patch that also dumps the request in
question, can you apply that one? It replaces the earlier patch...

> > > > Andi, any idea what is going on here? Why is this throwing up all of a
> > > > sudden??
> > > 
> > > What is throwing up exactly?
> > >
> > > There was a change recently in the merging algorithm, but it shouldn't
> > > cause any bad side effects for correct users of *_map_sg()
> > 
> > That the request we end up passing to blk_rq_map_sg() and then to
> > pci_map_sg() ends up with more entries than the driver advertised. So
> > far I think only Andy reported this, and then only with your
> > blk_queue_bounce_limit() patch applied.
> 
> It shouldn't end up with more, only with less.

Sure yes, but if that 'less' is still more than what the driver can
handle, then there's a problem.

> Does iommu=nomerge make a difference?

Andy?


diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c
index 0523da7..f893f98 100644
--- a/drivers/ide/ide-dma.c
+++ b/drivers/ide/ide-dma.c
@@ -221,6 +221,37 @@ int ide_build_sglist(ide_drive_t *drive,
 
 EXPORT_SYMBOL_GPL(ide_build_sglist);
 
+static void dump_dma_table(ide_drive_t *drive, struct request *rq)
+{
+	ide_hwif_t *hwif = HWIF(drive);
+	request_queue_t *q = drive->queue;
+	struct bio *bio;
+	struct bio_vec *bvec;
+	int i;
+
+	printk("ide dma table, %d entries, bounce pfn %lu\n", hwif->sg_nents, q->bounce_pfn);
+	for (i = 0; i < hwif->sg_nents; i++) {
+		struct scatterlist *sg = &hwif->sg_table[i];
+
+		printk("sg%d: dma=%llx, len=%u/%u, pfn=%lu\n", i, (unsigned long long) sg->dma_address, sg->dma_length, sg->offset, page_to_pfn(sg->page));
+	}
+
+	printk("request: phys seg %d, hw seg %d, nr_sectors %lu\n", rq->nr_phys_segments, rq->nr_hw_segments, rq->nr_sectors);
+	i = 0;
+	rq_for_each_bio(bio, rq) {
+		int j;
+
+		printk("  bio%d: bytes=%u, phys seg %d, hw seg %d\n", i, bio->bi_size, bio->bi_phys_segments, bio->bi_hw_segments);
+		bio_for_each_segment(bvec, bio, j) {
+			void *addr = page_address(bvec->bv_page);
+
+			printk("    bvec%d: addr=%p, size=%u, off=%u\n", j, addr, bvec->bv_len, bvec->bv_offset);
+		}
+		i++;
+	}
+
+}
+
 /**
  *	ide_build_dmatable	-	build IDE DMA table
  *
@@ -311,6 +342,7 @@ use_pio_instead:
 		     hwif->sg_table,
 		     hwif->sg_nents,
 		     hwif->sg_dma_direction);
+	dump_dma_table(drive, rq);
 	return 0; /* revert to PIO for this request */
 }
 

-- 
Jens Axboe


  reply	other threads:[~2006-03-01 14:35 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-01 13:34 Andy Chittenden
2006-03-01 13:41 ` Jens Axboe
2006-03-01 14:05   ` Andi Kleen
2006-03-01 14:18     ` Jens Axboe
2006-03-01 14:26       ` Andi Kleen
2006-03-01 14:34         ` Jens Axboe [this message]
2006-03-01 14:41           ` Andi Kleen
2006-03-01 15:00             ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2006-03-03  9:16 Andy Chittenden
2006-03-02 10:46 Andy Chittenden
2006-03-02 11:10 ` Jens Axboe
2006-03-02 12:21   ` Andi Kleen
2006-03-02 12:26     ` Jens Axboe
     [not found] <89E85E0168AD994693B574C80EDB9C270393C141@uk-email.terastack.bluearc.com>
2006-03-01 15:57 ` Jens Axboe
2006-03-01 14:40 Andy Chittenden
2006-03-01 10:47 Andy Chittenden
2006-03-01 12:15 ` Jens Axboe
2006-03-01 12:19   ` Jens Axboe
2006-03-01 12:23     ` Andi Kleen
2006-03-01 12:25       ` Jens Axboe
2006-03-01  9:42 Andy Chittenden
2006-03-01  9:55 ` Jens Axboe
2006-02-28 10:27 Andy Chittenden
2006-02-28 10:29 ` Jens Axboe
2006-02-28 10:10 Andy Chittenden
2006-02-28 10:20 ` Jens Axboe
2006-02-27 16:39 Andy Chittenden
2006-02-27 14:50 Andy Chittenden
2006-02-27 14:56 ` Jens Axboe
     [not found] <89E85E0168AD994693B574C80EDB9C270393BF0E@uk-email.terastack.bluearc.com>
2006-02-27 14:28 ` Jens Axboe
2006-02-24  9:33 Andy Chittenden
2006-02-22 10:43 Andy Chittenden
2006-02-22 13:34 ` Jens Axboe
2006-02-22 13:35   ` Jens Axboe
2006-02-22 13:38     ` Jens Axboe
2006-02-03 13:56 Andy Chittenden
2006-02-03 14:00 ` Jens Axboe
2006-01-27 11:53 Andy Chittenden
2006-01-27 14:21 ` Jens Axboe
2006-01-27 14:39   ` Anton Altaparmakov
2006-02-03  9:20     ` adding swap workarounds oom - was: " Anton Altaparmakov
2006-02-03  9:26       ` Andrew Morton
2006-02-03 11:01         ` Anton Altaparmakov
2006-02-03 13:54           ` Jens Axboe

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=20060301143438.GX4816@suse.de \
    --to=axboe@suse.de \
    --cc=AChittenden@bluearc.com \
    --cc=aia21@cam.ac.uk \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=bzolnier@gmail.com \
    --cc=davej@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lwoodman@redhat.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

Powered by JetHome