[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 2/3] memory: generalize iommu_ops.notify_star
From: |
Peter Xu |
Subject: |
Re: [Qemu-devel] [PATCH v3 2/3] memory: generalize iommu_ops.notify_started to notifier_add |
Date: |
Thu, 8 Sep 2016 18:22:40 +0800 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
On Wed, Sep 07, 2016 at 12:54:23PM +0200, Paolo Bonzini wrote:
>
>
> On 07/09/2016 08:05, 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.
> >
> > Instead I'd suggest a callback which gets tripped any time the logical
> > OR of the requested notifications for all current notifiers changes.
>
> I like the suggestion. Alternatively you could call notify_stopped if
> old & ~new is nonzero (and you pass old & ~new), and notify_started if
> new & ~old is nonzero (and you pass new & ~old).
I think now I understand the point... Then I'd prefer to use David's
suggestion. A single notify_changed() looks cleaner. To be more
explicit, I would prefer to rename it to notifier_flag_changed(),
since notify_changed() looks like to be called every time notifier
list changed, but actually it is for monitoring the flags.
Thanks,
-- peterx
- [Qemu-devel] [PATCH v3 1/3] memory: introduce IOMMUNotifier and its caps, (continued)
[Qemu-devel] [PATCH v3 2/3] memory: generalize iommu_ops.notify_started to notifier_add, Peter Xu, 2016/09/07
[Qemu-devel] [PATCH v3 3/3] intel_iommu: allow invalidation typed notifiers, Peter Xu, 2016/09/07