All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Williamson <alex@shazbot.org>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: "Cédric Le Goater" <clg@redhat.com>,
	qemu-devel@nongnu.org, qemu-arm@nongnu.org,
	"Eric Auger" <eric.auger@redhat.com>,
	"Stefan Berger" <stefanb@linux.ibm.com>,
	alex@shazbot.org
Subject: Re: [PATCH] vfio/listener: Only warn on misalignment for VFIO-owned regions
Date: Mon, 6 Jul 2026 09:42:41 -0600	[thread overview]
Message-ID: <20260706094241.1457bbc6@shazbot.org> (raw)
In-Reply-To: <CAFEAcA9wOZhn41Twz9zzCBD4MAET2+gbF71kUKnr7r6TXfhjuw@mail.gmail.com>

On Mon, 6 Jul 2026 16:27:46 +0100
Peter Maydell <peter.maydell@linaro.org> wrote:

> On Mon, 6 Jul 2026 at 16:12, Cédric Le Goater <clg@redhat.com> wrote:
> >
> > On 7/6/26 16:20, Alex Williamson wrote:  
> > > On Thu,  2 Jul 2026 18:06:40 +0200
> > > Cédric Le Goater <clg@redhat.com> wrote:
> > >  
> > >> Any device on the board can have non-page-aligned memory regions. The
> > >> VFIO listener should not warn about misalignment for regions that are
> > >> not VFIO-related.
> > >>
> > >> Replace the vfio_known_safe_misalignment() whitelist with a
> > >> vfio_get_vfio_device() ownership check: only warn when a VFIO device's
> > >> own region is misaligned. For all other regions, emit a trace event
> > >> and silently skip. Extract the misalignment test into a
> > >> vfio_section_misaligned() helper for readability.
> > >>
> > >> Note: vfio_get_vfio_device() currently only covers VFIO PCI devices,
> > >> including vfio-user-pci.  Other VFIO backends (AP, CCW) don't expose
> > >> memory regions through this path so this is sufficient for now.  
> > >
> > > I thought the whole point was to warn when there are non-vfio devices
> > > that we cannot insert into the DMA map.  851d6d1a0ff2 added tpm-crb-cmd
> > > to an ignore list because it's not a DMA target.  The intention of that
> > > ignore list was to continue to evaluate devices that are misaligned
> > > and either add them to the ignore list or determine they could be a
> > > valid DMA target and correct the alignment.  
> >
> > If the goal was to use the VFIO listener to catch all misaligned regions,
> > and potentially fix them, we should reconsider that approach :
> >
> >    https://lore.kernel.org/qemu-devel/20260701080843.2418461-1-clg@redhat.com/
> >
> > As Peter pointed out, regions that are not page-aligned regions are valid :
> >
> >    https://lore.kernel.org/qemu-devel/CAFEAcA-QHJ=HaBc5WSLLap8NdDw+tty4EFfGt6cmmNOK6e_m7w@mail.gmail.com/
> >
> > and aligning them would require a machine compat for migration.  
> 
> It seems very unlikely that anything not page-aligned is going
> to be a sensible target for DMA ops from a device: the main
> reason to have a non-page-aligned or non-page-sized region is that
> it's the way we've chosen to implement a device, or it's some
> "RAM but not general-purpose RAM" thing. If there's a path to
> warn/error if it's actually used for a DMA op that would be worthwhile,

But for a vfio-pci device there is no DMA op, it either gets mapped
into the IOMMU for direct access to the device or not.  This is the
point at which that decision is made.

> but as it stands I think all this warning will ever cause us to
> do is add more entries to its whitelist every time it complains.

IMO, that's ok.  That's the purpose.  We're up to one whole class of
device so far, we don't care about mapping failures to TPM devices.  If
some day this does fire on something we care about, especially a
regression, it'll earn its keep.  It doesn't seem like an excessive
burden yet. Thanks,

Alex


  reply	other threads:[~2026-07-06 15:43 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02 16:06 [PATCH] vfio/listener: Only warn on misalignment for VFIO-owned regions Cédric Le Goater
2026-07-06 11:46 ` Cédric Le Goater
2026-07-06 14:20 ` Alex Williamson
2026-07-06 15:12   ` Cédric Le Goater
2026-07-06 15:27     ` Peter Maydell
2026-07-06 15:42       ` Alex Williamson [this message]
2026-07-06 16:12         ` Peter Maydell
2026-07-06 17:16           ` Alex Williamson
2026-07-06 17:29             ` Peter Maydell
2026-07-06 15:34     ` Alex Williamson

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=20260706094241.1457bbc6@shazbot.org \
    --to=alex@shazbot.org \
    --cc=clg@redhat.com \
    --cc=eric.auger@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanb@linux.ibm.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.