All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: qemu-devel@nongnu.org, mst@redhat.com, jasowang@redhat.com,
	vkaplans@redhat.com, alex.williamson@redhat.com, wexu@redhat.com,
	pbonzini@redhat.com, cornelia.huck@de.ibm.com,
	dgibson@redhat.com
Subject: Re: [Qemu-devel] [PATCH v3 2/3] memory: generalize iommu_ops.notify_started to notifier_add
Date: Wed, 7 Sep 2016 15:23:16 +0800	[thread overview]
Message-ID: <20160907072316.GK21051@pxdev.xzpeter.org> (raw)
In-Reply-To: <20160907060550.GQ2780@voom.fritz.box>

On Wed, Sep 07, 2016 at 04:05:50PM +1000, David Gibson wrote:
> On Wed, Sep 07, 2016 at 01:32:23PM +0800, Peter Xu wrote:
> > Considering that we may have multiple IOMMU notifier consumers in the
> > future, converting iommu_ops.notify_{started|stopped} into some more
> > general form. Now we can trap all notifier registerations and
> > deregistrations, rather than only the first ones.
> > 
> > Power was leveraging the notifier_{started|stopped}, adding iommu_user
> > field for counting on Power guests to achieve the same goal.
> 
> Requiring each vIOMMU frontend to reference count or whatever seems
> like a pain.  The semantics of notify_started() were designed to avoid
> that.

The problem is that, I think we need something like "notifier_add",
just like you have mentioned before, e.g., what if we have more than
one registers for the notifier list? And if with that, it'll be
awkward to still keep the notify_started since it's actually a subset
of "notifier_add".

Considering the above, I think simply adding a count for IOMMUs who
want it is a reasonable trade-off.

> 
> Instead I'd suggest a callback which gets tripped any time the logical
> OR of the requested notifications for all current notifiers changes.

If so, we will need two callbacks (notify_started,
notifier_xxx_changed) instead of one. In that case I'd prefer a single
notifier_add. Besides that, I'd say the notifier_xxx_changed interface
is really hard to understand from the first glance.

Another reason to have notifier_add() is that, this is more easily to
be extended. E.g., we can add more fields to IOMMUNotifier in the
future (a channel between the consumer and provider), and it'll be
passed to each IOMMU's notifier_add() naturally.

Thanks,

-- peterx

  reply	other threads:[~2016-09-07  7:23 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-07  5:32 [Qemu-devel] [PATCH v3 0/3] Introduce IOMMUNotifier struct Peter Xu
2016-09-07  5:32 ` [Qemu-devel] [PATCH v3 1/3] memory: introduce IOMMUNotifier and its caps Peter Xu
2016-09-07  6:02   ` David Gibson
2016-09-07  7:09     ` Peter Xu
2016-09-07 10:20       ` David Gibson
2016-09-08 10:00         ` Peter Xu
2016-09-07  5:32 ` [Qemu-devel] [PATCH v3 2/3] memory: generalize iommu_ops.notify_started to notifier_add Peter Xu
2016-09-07  6:05   ` David Gibson
2016-09-07  7:23     ` Peter Xu [this message]
2016-09-07 10:23       ` David Gibson
2016-09-07 10:54     ` Paolo Bonzini
2016-09-08 10:22       ` Peter Xu
2016-09-12  1:17         ` David Gibson
2016-09-12  5:54           ` Peter Xu
2016-09-07  5:32 ` [Qemu-devel] [PATCH v3 3/3] intel_iommu: allow invalidation typed notifiers Peter Xu

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=20160907072316.GK21051@pxdev.xzpeter.org \
    --to=peterx@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --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 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.