[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190619162903.GF9360@ziepe.ca>
Date: Wed, 19 Jun 2019 13:29:03 -0300
From: Jason Gunthorpe <jgg@...pe.ca>
To: Christoph Hellwig <hch@....de>,
Potnuri Bharat Teja <bharat@...lsio.com>
Cc: Dan Carpenter <dan.carpenter@...cle.com>,
Maarten Lankhorst <maarten.lankhorst@...ux.intel.com>,
Maxime Ripard <maxime.ripard@...tlin.com>,
Sean Paul <sean@...rly.run>, David Airlie <airlied@...ux.ie>,
Daniel Vetter <daniel@...ll.ch>,
Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>,
Rodrigo Vivi <rodrigo.vivi@...el.com>,
Ian Abbott <abbotti@....co.uk>,
H Hartley Sweeten <hsweeten@...ionengravers.com>,
devel@...verdev.osuosl.org, linux-s390@...r.kernel.org,
Intel Linux Wireless <linuxwifi@...el.com>,
linux-rdma@...r.kernel.org, netdev@...r.kernel.org,
intel-gfx@...ts.freedesktop.org, linux-wireless@...r.kernel.org,
linux-kernel@...r.kernel.org, dri-devel@...ts.freedesktop.org,
linux-mm@...ck.org, iommu@...ts.linux-foundation.org,
"moderated list:ARM PORT" <linux-arm-kernel@...ts.infradead.org>,
linux-media@...r.kernel.org
Subject: Re: use exact allocation for dma coherent memory
On Mon, Jun 17, 2019 at 10:33:42AM +0200, Christoph Hellwig wrote:
> > drivers/infiniband/hw/cxgb4/qp.c
> > 129 static int alloc_host_sq(struct c4iw_rdev *rdev, struct t4_sq *sq)
> > 130 {
> > 131 sq->queue = dma_alloc_coherent(&(rdev->lldi.pdev->dev), sq->memsize,
> > 132 &(sq->dma_addr), GFP_KERNEL);
> > 133 if (!sq->queue)
> > 134 return -ENOMEM;
> > 135 sq->phys_addr = virt_to_phys(sq->queue);
> > 136 dma_unmap_addr_set(sq, mapping, sq->dma_addr);
> > 137 return 0;
> > 138 }
> >
> > Is this a bug?
>
> Yes. This will blow up badly on many platforms, as sq->queue
> might be vmapped, ioremapped, come from a pool without page backing.
Gah, this addr gets fed into io_remap_pfn_range/remap_pfn_range too..
Potnuri, you should fix this..
You probably need to use dma_mmap_from_dev_coherent() in the mmap ?
Jason
Powered by blists - more mailing lists