All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Stefan Hajnoczi <stefanha@redhat.com>
Cc: "Alexander Bulekov" <alxndr@bu.edu>,
	qemu-devel@nongnu.org, "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Mauro Matteo Cascella" <mcascell@redhat.com>,
	"Qiuhao Li" <Qiuhao.Li@outlook.com>,
	"Peter Xu" <peterx@redhat.com>,
	"Jason Wang" <jasowang@redhat.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	"Li Qiang" <liq3ea@gmail.com>, "Thomas Huth" <thuth@redhat.com>,
	"Laurent Vivier" <lvivier@redhat.com>,
	"Bandan Das" <bsd@redhat.com>,
	"Edgar E . Iglesias" <edgar.iglesias@gmail.com>,
	"Darren Kenny" <darren.kenny@oracle.com>,
	"Bin Meng" <bin.meng@windriver.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <eduardo@habkost.net>,
	"Jon Maloy" <jmaloy@redhat.com>
Subject: Re: [PATCH v2] memory: prevent dma-reentracy issues
Date: Tue, 25 Oct 2022 11:11:27 +0100	[thread overview]
Message-ID: <CAFEAcA9AUpK6d81hZQG7Ba06w5xTdXkgMaMu+nDKrVh8QwabhQ@mail.gmail.com> (raw)
In-Reply-To: <Y1bdgdWXG2FYHm/K@fedora>

On Mon, 24 Oct 2022 at 19:46, Stefan Hajnoczi <stefanha@redhat.com> wrote:
>
> On Thu, Oct 20, 2022 at 06:11:06PM -0400, Alexander Bulekov wrote:
> > Taking a stab at this. Here is the list of DMA APIs that appear to need
> > changes:
> > dma_memory_valid (1 usage)
> > dma_memory_rw (~5 uses)
> > dma_memory_read (~92 uses)
> > dma_memory_write (~71 uses)
> > dma_memory_set (~4 uses)
> > dma_memory_map (~18 uses)
> > dma_memory_unmap (~21 uses)
> > {ld,st}_{le,be}_{uw,l,q}_dma (~10 uses)
> > ldub_dma (does not appear to be used anywhere)
> > stb_dma (1 usage)
> > dma_buf_read (~18 uses)
> > dma_buf_write (~7 uses)
> >
> > These appear to be internal to the DMA API and probably don't need to be
> > changed:
> > dma_memory_read_relaxed (does not appear to be used anywhere)
> > dma_memory_write_relaxed (does not appear to be used anywhere)
> > dma_memory_rw_relaxed
> >
> > I don't think the sglist APIs need to be changed since we can get
> > DeviceState from the QEMUSGList.
> >
> > Does this look more-or-less right?
>
> That's along the lines of what I would expect. Interesting that
> map/unmap is also on the list; it makes sense when considering bounce
> buffers.

Not all devices that DMA do it via the dma_memory_* wrappers, of course:
some just use address_space_* functions directly. I guess maybe
we can just make the devices where we care about this problem
be more consistent about what function family they use.

-- PMM


      reply	other threads:[~2022-10-25 10:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-09 13:58 [PATCH v2] memory: prevent dma-reentracy issues Alexander Bulekov
2022-06-20 14:06 ` Alexander Bulekov
2022-06-21  8:34 ` David Hildenbrand
2022-06-21 15:11   ` Alexander Bulekov
2022-06-21 15:30 ` Peter Maydell
2022-06-21 15:53   ` Alexander Bulekov
2022-07-12  9:34     ` Stefan Hajnoczi
2022-07-13 15:51       ` Alexander Bulekov
2022-07-13 17:31         ` Stefan Hajnoczi
2022-10-20 22:11       ` Alexander Bulekov
2022-10-24 18:46         ` Stefan Hajnoczi
2022-10-25 10:11           ` Peter Maydell [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=CAFEAcA9AUpK6d81hZQG7Ba06w5xTdXkgMaMu+nDKrVh8QwabhQ@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=Qiuhao.Li@outlook.com \
    --cc=alxndr@bu.edu \
    --cc=berrange@redhat.com \
    --cc=bin.meng@windriver.com \
    --cc=bsd@redhat.com \
    --cc=darren.kenny@oracle.com \
    --cc=david@redhat.com \
    --cc=edgar.iglesias@gmail.com \
    --cc=eduardo@habkost.net \
    --cc=f4bug@amsat.org \
    --cc=jasowang@redhat.com \
    --cc=jmaloy@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=liq3ea@gmail.com \
    --cc=lvivier@redhat.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mcascell@redhat.com \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=thuth@redhat.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.