All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@ziepe.ca>
To: Christoph Hellwig <hch@lst.de>
Cc: Stephen Warren <swarren@wwwdotorg.org>,
	Tariq Toukan <tariqt@mellanox.com>,
	xavier.huwei@huawei.com,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-rdma@vger.kernel.org" <linux-rdma@vger.kernel.org>,
	Doug Ledford <dledford@redhat.com>
Subject: Re: [RFC PATCH] net/mlx4: Get rid of page operation after dma_alloc_coherent
Date: Tue, 18 Dec 2018 12:04:12 -0700	[thread overview]
Message-ID: <20181218190412.GE21992@ziepe.ca> (raw)
In-Reply-To: <20181218185012.GB16052@lst.de>

On Tue, Dec 18, 2018 at 07:50:12PM +0100, Christoph Hellwig wrote:
> On Tue, Dec 18, 2018 at 11:43:08AM -0700, Jason Gunthorpe wrote:
> > So the problem here is that on some arches
> > 
> >  sg_set_buf(sg, dma_coherent_buf, size)
> >  p = sg_virt(sg);
> >  assert(p == dma_coherent_buf);
> 
> dma allocations purely return a virtual address, you must never
> call virt_to_page or virt_to_phys on them, which sg_set_buf
> will do.  On many architectures this will give your the wrong
> result as the coherent DMA address is a vmap or ioremap address.

Yes, that is what I gathered - if that is the design then I'd say that
drivers shouldn't be stuffing these DMA coherent virtual addresses
into a sg at all.

Jason

      parent reply	other threads:[~2018-12-18 19:04 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-14 23:32 [RFC PATCH] net/mlx4: Get rid of page operation after dma_alloc_coherent Stephen Warren
2018-12-18 13:40 ` Tariq Toukan
2018-12-18 16:32 ` Jason Gunthorpe
2018-12-18 17:08   ` Stephen Warren
2018-12-18 17:12     ` Jason Gunthorpe
2018-12-18 17:45       ` Stephen Warren
2018-12-18 18:43         ` Jason Gunthorpe
2018-12-18 18:50           ` Christoph Hellwig
2018-12-18 18:51             ` David Miller
2018-12-18 19:04             ` Jason Gunthorpe [this message]

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=20181218190412.GE21992@ziepe.ca \
    --to=jgg@ziepe.ca \
    --cc=dledford@redhat.com \
    --cc=hch@lst.de \
    --cc=linux-rdma@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=swarren@wwwdotorg.org \
    --cc=tariqt@mellanox.com \
    --cc=xavier.huwei@huawei.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 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.