All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: bharrosh@panasas.com, just.for.lkml@googlemail.com,
	hancockrwd@gmail.com, linux-kernel@vger.kernel.org,
	linux-scsi@vger.kernel.org
Subject: Re: sata_sil24 0000:04:00.0: DMA-API: device driver frees DMA sg list  with different entry count [map count=13] [unmap count=10]
Date: Thu, 4 Jun 2009 09:53:09 +0200	[thread overview]
Message-ID: <20090604075309.GU11363@kernel.dk> (raw)
In-Reply-To: <20090604164418F.fujita.tomonori@lab.ntt.co.jp>

On Thu, Jun 04 2009, FUJITA Tomonori wrote:
> On Thu, 04 Jun 2009 10:15:14 +0300
> Boaz Harrosh <bharrosh@panasas.com> wrote:
> 
> > On 06/04/2009 09:33 AM, FUJITA Tomonori wrote:
> > > On Thu, 4 Jun 2009 08:12:34 +0200
> > > Torsten Kaiser <just.for.lkml@googlemail.com> wrote:
> > > 
> > >> On Thu, Jun 4, 2009 at 2:02 AM, FUJITA Tomonori
> > >> <fujita.tomonori@lab.ntt.co.jp> wrote:
> > >>> On Wed, 3 Jun 2009 21:30:32 +0200
> > >>> Torsten Kaiser <just.for.lkml@googlemail.com> wrote:
> > >>>> Still happens with 2.6.30-rc8 (see trace at the end of the email)
> > >>>>
> > >>>> As orig_n_elem is only used two times in libata-core.c I suspected a
> > >>>> corruption of the qc->sg, but adding checks for this did not trigger.
> > >>>> So I looked into lib/dma-debug.c.
> > >>>> It seems add_dma_entry() does not protect against adding the same
> > >>>> entry twice.
> > >>> Do you mean that add_dma_entry() doesn't protect against adding a new
> > >>> entry identical to the existing entry, right?
> > >> Yes, as I read the hash bucket code in lib/dma-debug.c a second entry
> > >> from the same device and the same address will just be added to the
> > >> list and on unmap it will always return the first entry.
> > > 
> > > It means that two different DMA operations will be performed against
> > > the same dma addresss on the same device at the same time. It doesn't
> > > happen unless there is a bug in a driver, an IOMMU or somewhere, as I
> > > wrote in the previous mail.
> > > 
> > 
> > What about the draining buffers used by libata. Are they not the same buffer
> > for all devices for all requests?
> 
> I'm not sure if the drain buffer is used like that. But is there
> easier ways to see the same buffer; e.g. sending the same buffer twice
> with DIO?

I'm pretty sure we discussed this some months ago, the intel iommu
driver had a similar bug iirc. Lets say you want to write the same 4kb
block to two spots on the disk. You prepare and submit that with
O_DIRECT and using aio. On a device with NCQ, that could easily map the
same page twice. Or, perhaps more likely, doing 512b writes and not
getting all of them merged.

> As I wrote, I assume that he uses GART IOMMU; it allocates an unique
> dma address per dma mapping operation.
> 
> However, dma-debug is broken wrt this, I guess.

Seems so.

-- 
Jens Axboe


  reply	other threads:[~2009-06-04  7:53 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-26 19:14 sata_sil24 0000:04:00.0: DMA-API: device driver frees DMA sg list with different entry count [map count=13] [unmap count=10] Torsten Kaiser
2009-05-26 19:14 ` Torsten Kaiser
2009-05-26 23:40 ` Robert Hancock
2009-05-27  2:11   ` Torsten Kaiser
2009-05-27  2:11     ` Torsten Kaiser
2009-06-03 19:30   ` Torsten Kaiser
2009-06-03 19:30     ` Torsten Kaiser
2009-06-03 20:21     ` Kasper Sandberg
2009-06-03 23:33       ` Robert Hancock
2009-06-04  6:00       ` Torsten Kaiser
2009-06-04  6:00         ` Torsten Kaiser
2009-06-04  0:02     ` FUJITA Tomonori
2009-06-04  6:12       ` Torsten Kaiser
2009-06-04  6:12         ` Torsten Kaiser
2009-06-04  6:33         ` FUJITA Tomonori
2009-06-04  7:15           ` Boaz Harrosh
2009-06-04  7:44             ` FUJITA Tomonori
2009-06-04  7:53               ` Jens Axboe [this message]
2009-06-04 18:07                 ` Torsten Kaiser
2009-06-04 18:07                   ` Torsten Kaiser
2009-06-04 22:43                   ` FUJITA Tomonori

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=20090604075309.GU11363@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=bharrosh@panasas.com \
    --cc=fujita.tomonori@lab.ntt.co.jp \
    --cc=hancockrwd@gmail.com \
    --cc=just.for.lkml@googlemail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.