From: Peter Xu <peterx@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: qemu-devel@nongnu.org, mst@redhat.com, jasowang@redhat.com,
vkaplans@redhat.com, alex.williamson@redhat.com, wexu@redhat.com,
cornelia.huck@de.ibm.com, dgibson@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/3] memory: add iommu_notify_flag
Date: Tue, 6 Sep 2016 13:27:33 +0800 [thread overview]
Message-ID: <20160906052733.GA21051@pxdev.xzpeter.org> (raw)
In-Reply-To: <dcb70f94-76da-da93-8c6a-38b1e40fa479@redhat.com>
On Mon, Sep 05, 2016 at 11:56:12AM +0200, Paolo Bonzini wrote:
> Yeah, if you really want to have these semantics, you need to define an
> enum like this:
>
> IOMMU_NOTIFIER_NONE = -1,
> IOMMU_NOTIFIER_FLUSH = 0,
> IOMMU_NOTIFIER_CHANGED_ENTRY = 1,
>
> But I'm still not convinced of the exclusivity between "flush" and
> "entry changed" notifiers. If I saw the above, my first reaction would
> be that you need a bit mask:
>
> IOMMU_NOTIFIER_NONE = -1,
> IOMMU_NOTIFIER_FLUSH = 1,
> IOMMU_NOTIFIER_CHANGED_ENTRY = 2,
>
> But perhaps what you're looking for is to change the "notifier" to a
> "listener" like
>
> struct IOMMUListener {
> void (*flush)(IOMMUListener *);
> void (*entry_changed)(IOMMUListener *, IOMMUTLBEntry *);
> QLIST_ENTRY(IOMMUListener) node;
> };
>
> The patches can start with an IOMMUListener that only has the
> entry_changed callback and that replaces the current use of Notifier.
> Then notify_started and notify_stopped can be called on every notifier
> that is added/removed (see attached prototype), and the Intel IOMMU can
> simply reject registration of a listener that has a non-NULL
> iotlb_changed member.
Thanks for the quick prototyping. :-)
Maybe I haven't explained the idea very clearly, but device-IOTLB is
not a "flush" of whole device cache. It still needs a IOMMUTLBEntry,
and works just like how general IOMMU invalidations. E.g., we can do
device-IOTLB invalidation for a single 4K page.
However, I agree with you that the namings are confusing, maybe at
least we should introduce IOMMU_NOTIFIER_* macros, though instead of a
_FLUSH one, we can have:
IOMMU_NOTIFIER_NONE = -1,
IOMMU_NOTIFIER_DEVICE_INVALIDATE = 0,
IOMMU_NOTIFIER_IOTLB_CHANGED = 1,
To clarify that these are two non-overlapped cases.
Thanks,
-- peterx
next prev parent reply other threads:[~2016-09-06 5:27 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-05 7:21 [Qemu-devel] [PATCH 0/3] memory: add IOMMU notifier type Peter Xu
2016-09-05 7:21 ` [Qemu-devel] [PATCH 1/3] memory: add one flag for IOMMU notifier Peter Xu
2016-09-05 7:21 ` [Qemu-devel] [PATCH 2/3] memory: add iommu_notify_flag Peter Xu
2016-09-05 8:04 ` Paolo Bonzini
2016-09-05 8:38 ` Peter Xu
2016-09-05 9:56 ` Paolo Bonzini
2016-09-06 5:27 ` Peter Xu [this message]
2016-09-06 7:51 ` Paolo Bonzini
2016-09-06 8:17 ` Peter Xu
2016-09-06 8:19 ` Paolo Bonzini
2016-09-06 10:31 ` Peter Xu
2016-09-07 5:44 ` David Gibson
2016-09-07 6:34 ` Peter Xu
2016-09-07 6:41 ` David Gibson
2016-09-08 9:07 ` Peter Xu
2016-09-12 1:26 ` David Gibson
2016-09-12 5:13 ` Peter Xu
2016-09-14 4:00 ` David Gibson
2016-09-14 5:43 ` Peter Xu
2016-09-06 5:18 ` David Gibson
2016-09-06 5:55 ` Peter Xu
2016-09-06 5:12 ` David Gibson
2016-09-06 5:33 ` Peter Xu
2016-09-05 7:21 ` [Qemu-devel] [PATCH 3/3] intel_iommu: allow IOMMU_NONE typed notifiers Peter Xu
2016-09-06 5:06 ` [Qemu-devel] [PATCH 0/3] memory: add IOMMU notifier type David Gibson
2016-09-06 5:49 ` Peter Xu
2016-09-06 6:26 ` Jason Wang
2016-09-07 4:38 ` David Gibson
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=20160906052733.GA21051@pxdev.xzpeter.org \
--to=peterx@redhat.com \
--cc=alex.williamson@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=dgibson@redhat.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=vkaplans@redhat.com \
--cc=wexu@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 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).