From: Yan Zhao <yan.y.zhao@intel.com>
To: Sean Christopherson <seanjc@google.com>
Cc: <kvm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<pbonzini@redhat.com>, <stevensd@chromium.org>
Subject: Re: [PATCH] KVM: allow mapping of compound tail pages for IO or PFNMAP mapping
Date: Thu, 20 Jul 2023 10:03:15 +0800 [thread overview]
Message-ID: <ZLiV4y5uFJz4GxUr@yzhao56-desk.sh.intel.com> (raw)
In-Reply-To: <ZLgEbalDPD38qHmm@google.com>
On Wed, Jul 19, 2023 at 08:42:37AM -0700, Sean Christopherson wrote:
> On Wed, Jul 19, 2023, Yan Zhao wrote:
> > Allow mapping of tail pages of compound pages for IO or PFNMAP mapping
> > by trying and getting ref count of its head page.
> >
> > For IO or PFNMAP mapping, sometimes it's backed by compound pages.
> > KVM will just return error on mapping of tail pages of the compound pages,
> > as ref count of the tail pages are always 0.
> >
> > So, rather than check and add ref count of a tail page, check and add ref
> > count of its folio (head page) to allow mapping of the compound tail pages.
> >
> > This will not break the origial intention to disallow mapping of tail pages
> > of non-compound higher order allocations as the folio of a non-compound
> > tail page is the same as the page itself.
> >
> > On the other side, put_page() has already converted page to folio before
> > putting page ref.
>
> Is there an actual use case for this? It's not necessarily a strict requirement,
> but it would be helpful to know if KVM supports this for a specific use case, or
> just because it can.
Well, the actual use case is a kind of "yes and no".
In VFIO we now have the concept of "variant drivers" which work with
specific PCI IDs. The variant drivers can inject device specific
knowledge into VFIO. I tested this patch by writing a variant driver to
my e1000e NIC and composing a BAR whose backends are compound pages of 4M in
length.
I guess there might be real use case when the backend pages are in
ZONE_DEVICE but I haven't spent enough time to setup such kind of
environment for verification.
> Either way, this needs a selftest, KVM has had way too many bugs in this area.
Sure, I'll try to provide a selftest.
Thanks for bringing it out!
prev parent reply other threads:[~2023-07-20 2:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-19 8:33 Yan Zhao
2023-07-19 15:42 ` Sean Christopherson
2023-07-20 2:03 ` Yan Zhao [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=ZLiV4y5uFJz4GxUr@yzhao56-desk.sh.intel.com \
--to=yan.y.zhao@intel.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=stevensd@chromium.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
all inboxes | Powered by JetHome®