From: Alex Williamson <alex.williamson@redhat.com>
To: Pavel Fedin <p.fedin@samsung.com>
Cc: 'Peter Maydell' <peter.maydell@linaro.org>,
'QEMU Developers' <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] vfio: Align iova also to IOMMU page size
Date: Wed, 02 Dec 2015 12:05:39 -0700 [thread overview]
Message-ID: <1449083139.15753.90.camel@redhat.com> (raw)
In-Reply-To: <00a201d1274e$ff0bf0c0$fd23d240$@samsung.com>
On Wed, 2015-11-25 at 10:00 +0300, Pavel Fedin wrote:
> Hello!
>
> > There are a number of different interesting page sizes here:
> > * the host kernel page size
> > * the target CPU architecture's worst-case smallest page size
> > * the page size the guest kernel is actually using at the moment
> > (consider a 4K-page guest kernel on a 64K-page host kernel)
> >
> > These don't necessarily have to all be the same. I would
> > expect VFIO to be interested in the host kernel page size,
> > not TARGET_PAGE_ALIGN.
>
> So would the appropriate fix be just replacing TARGET_PAGE_ALIGN with HOST_PAGE_ALIGN?
> Alex: there's however, still no answer to "why are we aligning up, not down?" question..
Sorry for the late reply, I've been on holiday. It may simply be a
matter of "because it worked". If we round down then any sub-mapping
within the page aliases to the same IOMMU mappings and we don't know how
to deal with that. Duplicate IOMMU mappings will fail and any unmap
will unmap the whole page. As it is, sub-page mappings get ignored,
which is sometimes the correct (or at least adequate) behavior.
For instance, one case I know of realtek NICs with a 4K PCI BAR which is
split by a quirk. We currently align up, which means that either side
of the mapping is ignored (becomes zero sized). Being an MMIO region,
dropping the mapping disables peer-to-peer for this area, which is
generally not something that gets used anyway. The right thing to do
would be to ignore the quirk for the IOMMU mapping, but then we need
enough smarts to handle not failing when the second sub-region is
mapped.
We might do the same thing in some of the x86-specific PAM regions, but
these are never DMA targets, so it doesn't cause problems either.
So I don't think there's an easy solution of "just round down", it
involves something much more significant than that. It might be the
right thing to do though if we ever expect any of those sub-mappings to
be DMA targets. Thanks,
Alex
prev parent reply other threads:[~2015-12-02 19:05 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-17 7:46 [Qemu-devel] [PATCH] vfio: Align iova also to IOMMU page size Pavel Fedin
2015-11-18 22:04 ` Alex Williamson
2015-11-19 10:29 ` Pavel Fedin
2015-11-19 23:33 ` Alex Williamson
2015-11-24 15:24 ` Pavel Fedin
2015-12-02 19:40 ` Alex Williamson
2015-12-03 9:02 ` Pavel Fedin
2015-12-03 16:26 ` Alex Williamson
2015-12-03 16:33 ` Peter Maydell
2015-12-03 17:19 ` Alex Williamson
2015-12-03 17:36 ` Peter Maydell
2015-12-03 17:58 ` Alex Williamson
2015-12-07 10:53 ` Pavel Fedin
2015-12-07 11:20 ` Peter Maydell
2015-12-08 23:42 ` Alex Williamson
2015-12-09 8:08 ` Pavel Fedin
2015-12-09 10:09 ` Alex Bennée
2015-11-24 15:34 ` Peter Maydell
2015-11-25 7:00 ` Pavel Fedin
2015-12-02 19:05 ` Alex Williamson [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=1449083139.15753.90.camel@redhat.com \
--to=alex.williamson@redhat.com \
--cc=p.fedin@samsung.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).