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). Paolo