From: "Michael S. Tsirkin" <mst@redhat.com>
To: Stefano Stabellini <sstabellini@kernel.org>
Cc: Peng Fan <peng.fan@nxp.com>,
"hch@infradead.org" <hch@infradead.org>,
"jasowang@redhat.com" <jasowang@redhat.com>,
"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
"linux-remoteproc@vger.kernel.org"
<linux-remoteproc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"virtualization@lists.linux-foundation.org"
<virtualization@lists.linux-foundation.org>,
"luto@kernel.org" <luto@kernel.org>,
"jgross@suse.com" <jgross@suse.com>,
"boris.ostrovsky@oracle.com" <boris.ostrovsky@oracle.com>,
"bjorn.andersson@linaro.org" <bjorn.andersson@linaro.org>,
"jliang@xilinx.com" <jliang@xilinx.com>
Subject: Re: [Xen-devel] [RFC] virtio_ring: check dma_mem for xen_domain
Date: Thu, 24 Jan 2019 15:34:25 -0500 [thread overview]
Message-ID: <20190124145849-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <alpine.DEB.2.10.1901241110290.17936@sstabellini-ThinkPad-X260>
On Thu, Jan 24, 2019 at 11:14:53AM -0800, Stefano Stabellini wrote:
> On Thu, 24 Jan 2019, Peng Fan wrote:
> > Hi stefano,
> >
> > > -----Original Message-----
> > > From: Stefano Stabellini [mailto:sstabellini@kernel.org]
> > > Sent: 2019年1月24日 7:44
> > > To: hch@infradead.org
> > > Cc: Stefano Stabellini <sstabellini@kernel.org>; Peng Fan
> > > <peng.fan@nxp.com>; mst@redhat.com; jasowang@redhat.com;
> > > xen-devel@lists.xenproject.org; linux-remoteproc@vger.kernel.org;
> > > linux-kernel@vger.kernel.org; virtualization@lists.linux-foundation.org;
> > > luto@kernel.org; jgross@suse.com; boris.ostrovsky@oracle.com;
> > > bjorn.andersson@linaro.org; jliang@xilinx.com
> > > Subject: Re: [Xen-devel] [RFC] virtio_ring: check dma_mem for xen_domain
> > >
> > > On Wed, 23 Jan 2019, hch@infradead.org wrote:
> > > > On Wed, Jan 23, 2019 at 01:04:33PM -0800, Stefano Stabellini wrote:
> > > > > If vring_use_dma_api is actually supposed to return true when
> > > > > dma_dev->dma_mem is set, then both Peng's patch and the patch I
> > > > > wrote are not fixing the real issue here.
> > > > >
> > > > > I don't know enough about remoteproc to know where the problem
> > > > > actually lies though.
> > > >
> > > > The problem is the following:
> > > >
> > > > Devices can declare a specific memory region that they want to use
> > > > when the driver calls dma_alloc_coherent for the device, this is done
> > > > using the shared-dma-pool DT attribute, which comes in two variants
> > > > that would be a little to much to explain here.
> > > >
> > > > remoteproc makes use of that because apparently the device can only
> > > > communicate using that region. But it then feeds back memory obtained
> > > > with dma_alloc_coherent into the virtio code. For that it calls
> > > > vmalloc_to_page on the dma_alloc_coherent, which is a huge no-go for
> > > > the ĐMA API and only worked accidentally on a few platform, and
> > > > apparently arm64 just changed a few internals that made it stop
> > > > working for remoteproc.
> > > >
> > > > The right answer is to not use the DMA API to allocate memory from a
> > > > device-speficic region, but to tie the driver directly into the DT
> > > > reserved memory API in a way that allows it to easilt obtain a struct
> > > > device for it.
> > >
> > > If I understand correctly, Peng should be able to reproduce the problem on
> > > native Linux without any Xen involvement simply by forcing
> > > vring_use_dma_api to return true. Peng, can you confirm?
> >
> > It is another issue without xen involvement,
> > There is an thread talking this: https://patchwork.kernel.org/patch/10742923/
> >
> > Without xen, vring_use_dma_api will return false.
> > With xen, if vring_use_dma_api returns true, it will dma_map_xx and trigger dump.
>
> It is true that for Xen on ARM DomUs it is not necessary today to return
> true from vring_use_dma_api. However, returning true from
> vring_use_dma_api should not break Linux. When the rpmesg issue is
> fixed, this problem should also go away without any need for additional
> changes on the xen side I think.
Let less systems bypass the standard virtio logic (using feature bit
to figure out bypassing DMA API), the better.
next prev parent reply other threads:[~2019-01-24 20:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-21 4:51 [RFC] virtio_ring: check dma_mem for xen_domain Peng Fan
2019-01-21 8:28 ` hch
2019-01-22 2:32 ` Peng Fan
2019-01-22 2:36 ` Michael S. Tsirkin
2019-01-22 19:59 ` [Xen-devel] " Stefano Stabellini
2019-01-23 2:57 ` Michael S. Tsirkin
2019-01-23 7:12 ` hch
2019-01-23 21:04 ` Stefano Stabellini
2019-01-23 21:14 ` hch
2019-01-23 23:43 ` Stefano Stabellini
2019-01-24 6:47 ` Peng Fan
2019-01-24 19:14 ` Stefano Stabellini
2019-01-24 20:34 ` Michael S. Tsirkin [this message]
2019-01-25 9:45 ` Peng Fan
2019-01-25 19:18 ` Stefano Stabellini
2019-01-28 8:00 ` hch
2019-01-29 9:26 ` Peng Fan
2019-01-24 6:42 ` Peng Fan
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=20190124145849-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=bjorn.andersson@linaro.org \
--cc=boris.ostrovsky@oracle.com \
--cc=hch@infradead.org \
--cc=jasowang@redhat.com \
--cc=jgross@suse.com \
--cc=jliang@xilinx.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-remoteproc@vger.kernel.org \
--cc=luto@kernel.org \
--cc=peng.fan@nxp.com \
--cc=sstabellini@kernel.org \
--cc=virtualization@lists.linux-foundation.org \
--cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox