From: Konrad Rzeszutek Wilk via dri-devel <dri-devel@lists.freedesktop.org>
To: Michael Labriola <michael.d.labriola@gmail.com>,
dri-devel@lists.freedesktop.org
Cc: Juergen Gross <jgross@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
xen-devel@lists.xen.org, Christoph Hellwig <hch@infradead.org>,
Paul Durrant <Paul.Durrant@citrix.com>,
Jan Beulich <JBeulich@suse.com>
Subject: Re: [Xen-devel] Upstream Dom0 DRM problems regarding swiotlb
Date: Fri, 15 Feb 2019 11:26:41 -0500 [thread overview]
Message-ID: <20190215162641.GA32461@char.us.oracle.com> (raw)
In-Reply-To: <CAOQxz3yhQsRhSTWBSwVhHP-BPqr3uTDpqa8bO44YTgUCYEkbXw@mail.gmail.com>
On Fri, Feb 15, 2019 at 11:07:22AM -0500, Michael Labriola wrote:
> On Fri, Feb 15, 2019 at 12:57 AM Juergen Gross <jgross@suse.com> wrote:
> >
> > On 14/02/2019 18:57, Christoph Hellwig wrote:
> > > On Thu, Feb 14, 2019 at 07:03:38AM +0100, Juergen Gross wrote:
> > >>> The thing which is different between Xen PV guests and most others (all
> > >>> others(?), now that Lguest and UML have been dropped) is that what Linux
> > >>> thinks of as PFN $N isn't necessarily adjacent to PFN $N+1 in system
> > >>> physical address space.
> > >>>
> > >>> Therefore, code which has a buffer spanning a page boundary can't just
> > >>> convert a pointer to the buffer into a physical address, and hand that
> > >>> address to a device. You generally end up with either memory corruption
> > >>> (DMA hitting the wrong page allocated to the guest), or an IOMMU fault
> > >>> (DMA hitting a pages which isn't allocated to the guest).
> > >
> > > The Linux DMA API allows for dma_map_page / dma_map_single calls to
> > > spawn 4k boundaries. If Xen doesn't support that it will have to bounce
> > > buffer for that case (and get horrible performance).
> > >
> > > But the latter text seems to agree with that. So what is the actual
> > > problem that started this discussion?
> > >
> >
> > See https://lists.xen.org/archives/html/xen-devel/2019-02/threads.html#00818
>
> I believe the actual problem is either:
>
> 1) The radeon/amdgpu drivers are calling ttm_populate_and_map_pages()
> which *should* work on a Xen PV host, but doesn't and needs to be
> fixed.
>
> or
>
> 2) The radeon/amdgpu drivers are calling ttm_populate_and_map_pages()
> which *cannot* work in Xen, and they should go back to calling
> ttm_dma_populate() in that case.
The Nvidia one has this (correct):
1583 #if IS_ENABLED(CONFIG_SWIOTLB) && IS_ENABLED(CONFIG_X86)
1584 if (swiotlb_nr_tbl()) {
1585 return ttm_dma_populate((void *)ttm, dev, ctx);
1586 }
1587 #endif
The Radeon has this - where now it adds 'need_swiotlb':
695 #ifdef CONFIG_SWIOTLB
696 if (rdev->need_swiotlb && swiotlb_nr_tbl()) {
697 return ttm_dma_populate(>t->ttm, rdev->dev, ctx);
698 }
699 #endif
The problem is fairly simple - the platform _requires_ to use
DMA API.
But the driver's have their own 'need_swiotlb' which ignores the platform
and sets it based on the device's DMA width:
rdev->need_swiotlb = drm_get_max_iomem() > ((u64)1 << dma_bits);
There should be an extra check to see if the platform requires
to use DMA API.
>
> I'm having a hard time figuring out which of those is correct.
>
> --
> Michael D Labriola
> 21 Rip Van Winkle Cir
> Warwick, RI 02886
> 401-316-9844 (cell)
> 401-848-8871 (work)
> 401-234-1306 (home)
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
parent reply other threads:[~2019-02-15 16:26 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <CAOQxz3yhQsRhSTWBSwVhHP-BPqr3uTDpqa8bO44YTgUCYEkbXw@mail.gmail.com>]
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=20190215162641.GA32461@char.us.oracle.com \
--to=dri-devel@lists.freedesktop.org \
--cc=JBeulich@suse.com \
--cc=Paul.Durrant@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=hch@infradead.org \
--cc=jgross@suse.com \
--cc=konrad.wilk@oracle.com \
--cc=michael.d.labriola@gmail.com \
--cc=xen-devel@lists.xen.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