From: Yan Zhao <yan.y.zhao@intel.com>
To: Auger Eric <eric.auger@redhat.com>
Cc: "pbonzini@redhat.com" <pbonzini@redhat.com>,
"qemu-devel@nongnu.org" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] memory: warning on out of scope notification
Date: Mon, 24 Jun 2019 03:21:14 -0400 [thread overview]
Message-ID: <20190624072114.GD27894@joy-OptiPlex-7040> (raw)
In-Reply-To: <ff6e9034-5e23-7a29-1377-1892036bfec2@redhat.com>
On Mon, Jun 24, 2019 at 03:09:24PM +0800, Auger Eric wrote:
> Hi Yan,
>
> On 6/24/19 7:33 AM, Yan Zhao wrote:
> > if an entry has parts out of scope of notifier's range, print warning
> > message.
> >
> > Out of scope mapping/unmapping would cause problem, as in below case:
> >
> > 1. initially there are two notifiers with ranges
> > 0-0xfedfffff, 0xfef00000-0xffffffffffffffff,
> > IOVAs from 0x3c000000 - 0x3c1fffff is in shadow page table.
> >
> > 2. in vfio, memory_region_register_iommu_notifier() is followed by
> > memory_region_iommu_replay(), which will first call address space
> > unmap,
> > and walk and add back all entries in vtd shadow page table. e.g.
> > (1) for notifier 0-0xfedfffff,
> > IOVAs from 0 - 0xffffffff get unmapped,
> > and IOVAs from 0x3c000000 - 0x3c1fffff get mapped
> > (2) for notifier 0xfef00000-0xffffffffffffffff
> > IOVAs from 0 - 0x7fffffffff get unmapped,
> > but IOVAs from 0x3c000000 - 0x3c1fffff cannot get mapped back.
> >
> > Cc: Auger Eric <eric.auger@redhat.com>
> > Signed-off-by: Yan Zhao <yan.y.zhao@intel.com>
> > ---
> > memory.c | 10 ++++++++++
> > 1 file changed, 10 insertions(+)
> >
> > diff --git a/memory.c b/memory.c
> > index 0a089a7..18927f2 100644
> > --- a/memory.c
> > +++ b/memory.c
> > @@ -1953,6 +1953,16 @@ void memory_region_notify_one(IOMMUNotifier *notifier,
> > request_flags = IOMMU_NOTIFIER_UNMAP;
> > }
> I think introducing a local variable for entry end would be worth now
> >
> > + if (entry->iova < notifier->start ||
> > + entry->iova + entry->addr_mask > notifier->end) {
> > + warn_report("%s IOMMUTLBEntry %lx-%lx outside of "
> > + "notifier scope %lx-%lx",
> Also I think you should use PRIx64 instead.
>
Got it!
Thanks :)
> Thanks
>
> Eric
> > + (request_flags == IOMMU_NOTIFIER_MAP) ?
> > + "Mapping" : "Unmapping",
> > + entry->iova, entry->iova + entry->addr_mask,
> > + notifier->start, notifier->end);
> > + }
> > +
> > if (notifier->notifier_flags & request_flags) {
> > notifier->notify(notifier, entry);
> > }
> >
prev parent reply other threads:[~2019-06-24 7:29 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-24 5:33 [Qemu-devel] [PATCH] memory: warning on out of scope notification Yan Zhao
2019-06-24 7:09 ` Auger Eric
2019-06-24 7:21 ` 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=20190624072114.GD27894@joy-OptiPlex-7040 \
--to=yan.y.zhao@intel.com \
--cc=eric.auger@redhat.com \
--cc=pbonzini@redhat.com \
--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).