From: "Michael S. Tsirkin" <mst@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-kernel@vger.kernel.org, Jonathan Corbet <corbet@lwn.net>,
Marek Szyprowski <m.szyprowski@samsung.com>,
Robin Murphy <robin.murphy@arm.com>,
linux-doc@vger.kernel.org, iommu@lists.linux.dev
Subject: Re: [PATCH] dma: DMA_ATTR_SKIP_CPU_SYNC documentation tweaks
Date: Thu, 20 Jul 2023 02:34:41 -0400 [thread overview]
Message-ID: <20230720023359-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20230720022702-mutt-send-email-mst@kernel.org>
On Thu, Jul 20, 2023 at 02:30:08AM -0400, Michael S. Tsirkin wrote:
> On Thu, Jul 20, 2023 at 08:25:25AM +0200, Christoph Hellwig wrote:
> > On Thu, Jul 20, 2023 at 02:21:05AM -0400, Michael S. Tsirkin wrote:
> > > On Thu, Jul 20, 2023 at 08:07:42AM +0200, Christoph Hellwig wrote:
> > > > On Wed, Jul 19, 2023 at 06:15:59AM -0400, Michael S. Tsirkin wrote:
> > > > > A recent patchset highlighted to me that DMA_ATTR_SKIP_CPU_SYNC
> > > > > might be easily misunderstood.
> > > >
> > > > .. just curious: what patchset is that? DMA_ATTR_SKIP_CPU_SYNC is
> > > > often a bad idea and all users probably could use a really good
> > > > audit..
> > >
> > > Message-Id: <20230710034237.12391-1-xuanzhuo@linux.alibaba.com>
> >
> > Do you have an actual link?
>
> sure, they are not hard to generate ;)
>
> https://lore.kernel.org/all/20230710034237.12391-11-xuanzhuo%40linux.alibaba.com
actually there's a new version
https://lore.kernel.org/all/20230719040422.126357-11-xuanzhuo%40linux.alibaba.com
you can see it does map, sync, unmap
unmap immediately after sync seems to be exactly the use case
for DMA_ATTR_SKIP_CPU_SYNC.
> > >
> > >
> > > Looks like there's really little else can be done: there's a
> > > shared page we allow DMA into, so we sync periodically.
> > > Then when we unmap we really do not need that data
> > > synced again.
> > >
> > > What exactly is wrong with this?
> >
> > A "shared" page without ownership can't work with the streaming
> > DMA API (dma_map_*) at all. You need to use dma_alloc_coherent
> > so that it is mapped uncached.
>
> Hmm confused. Based on both documentation and code I think this works:
>
> dma_map
> dma_sync
> dma_sync
> dma_sync
> dma_sync
> dma_unmap(DMA_ATTR_SKIP_CPU_SYNC)
>
> right?
>
> --
> MST
next prev parent reply other threads:[~2023-07-20 6:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-19 10:15 [PATCH] dma: DMA_ATTR_SKIP_CPU_SYNC documentation tweaks Michael S. Tsirkin
2023-07-20 6:07 ` Christoph Hellwig
2023-07-20 6:21 ` Michael S. Tsirkin
2023-07-20 6:25 ` Christoph Hellwig
2023-07-20 6:30 ` Michael S. Tsirkin
2023-07-20 6:34 ` Michael S. Tsirkin [this message]
2023-07-20 6:43 ` Christoph Hellwig
2023-07-20 7:06 ` Michael S. Tsirkin
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=20230720023359-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=corbet@lwn.net \
--cc=hch@lst.de \
--cc=iommu@lists.linux.dev \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=m.szyprowski@samsung.com \
--cc=robin.murphy@arm.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.