<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/vfio/vfio.c, branch linux-4.12.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.12.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-4.12.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2017-07-27T22:10:16Z</updated>
<entry>
<title>vfio: Remove unnecessary uses of vfio_container.group_lock</title>
<updated>2017-07-27T22:10:16Z</updated>
<author>
<name>Alex Williamson</name>
</author>
<published>2017-07-07T21:37:38Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5a5e706f1168ef66cd2a36e3a6460063d9380759'/>
<id>urn:sha1:5a5e706f1168ef66cd2a36e3a6460063d9380759</id>
<content type='text'>
commit 7f56c30bd0a232822aca38d288da475613bdff9b upstream.

The original intent of vfio_container.group_lock is to protect
vfio_container.group_list, however over time it's become a crutch to
prevent changes in container composition any time we call into the
iommu driver backend.  This introduces problems when we start to have
more complex interactions, for example when a user's DMA unmap request
triggers a notification to an mdev vendor driver, who responds by
attempting to unpin mappings within that request, re-entering the
iommu backend.  We incorrectly assume that the use of read-locks here
allow for this nested locking behavior, but a poorly timed write-lock
could in fact trigger a deadlock.

The current use of group_lock seems to fall into the trap of locking
code, not data.  Correct that by removing uses of group_lock that are
not directly related to group_list.  Note that the vfio type1 iommu
backend has its own mutex, vfio_iommu.lock, which it uses to protect
itself for each of these interfaces anyway.  The group_lock appears to
be a redundancy for these interfaces and type1 even goes so far as to
release its mutex to allow for exactly the re-entrant code path above.

Reported-by: Chuanxiao Dong &lt;chuanxiao.dong@intel.com&gt;
Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
Acked-by: Alexey Kardashevskiy &lt;aik@ozlabs.ru&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>vfio: New external user group/file match</title>
<updated>2017-07-27T22:10:16Z</updated>
<author>
<name>Alex Williamson</name>
</author>
<published>2017-06-28T19:50:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9ffc6fc6c2add85e06921f6f26b0204bfc407016'/>
<id>urn:sha1:9ffc6fc6c2add85e06921f6f26b0204bfc407016</id>
<content type='text'>
commit 5d6dee80a1e94cc284d03e06d930e60e8d3ecf7d upstream.

At the point where the kvm-vfio pseudo device wants to release its
vfio group reference, we can't always acquire a new reference to make
that happen.  The group can be in a state where we wouldn't allow a
new reference to be added.  This new helper function allows a caller
to match a file to a group to facilitate this.  Given a file and
group, report if they match.  Thus the caller needs to already have a
group reference to match to the file.  This allows the deletion of a
group without acquiring a new reference.

Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
Reviewed-by: Eric Auger &lt;eric.auger@redhat.com&gt;
Reviewed-by: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Tested-by: Eric Auger &lt;eric.auger@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>vfio: Fix group release deadlock</title>
<updated>2017-07-27T22:10:16Z</updated>
<author>
<name>Alex Williamson</name>
</author>
<published>2017-06-19T15:10:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4fb3d76fcac31d2f9423bb8021030ac22bc552ec'/>
<id>urn:sha1:4fb3d76fcac31d2f9423bb8021030ac22bc552ec</id>
<content type='text'>
commit 811642d8d8a82c0cce8dc2debfdaf23c5a144839 upstream.

If vfio_iommu_group_notifier() acquires a group reference and that
reference becomes the last reference to the group, then vfio_group_put
introduces a deadlock code path where we're trying to unregister from
the iommu notifier chain from within a callout of that chain.  Use a
work_struct to release this reference asynchronously.

Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
Reviewed-by: Eric Auger &lt;eric.auger@redhat.com&gt;
Tested-by: Eric Auger &lt;eric.auger@redhat.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;

</content>
</entry>
<entry>
<title>vfio: Rework group release notifier warning</title>
<updated>2017-03-21T19:19:09Z</updated>
<author>
<name>Alex Williamson</name>
</author>
<published>2017-03-21T19:19:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=65b1adebfe43c642dfe3b109edb5d992db5fbe72'/>
<id>urn:sha1:65b1adebfe43c642dfe3b109edb5d992db5fbe72</id>
<content type='text'>
The intent of the original warning is make sure that the mdev vendor
driver has removed any group notifiers at the point where the group
is closed by the user.  Theoretically this would be through an
orderly shutdown where any devices are release prior to the group
release.  We can't always count on an orderly shutdown, the user can
close the group before the notifier can be removed or the user task
might be killed.  We'd like to add this sanity test when the group is
idle and the only references are from the devices within the group
themselves, but we don't have a good way to do that.  Instead check
both when the group itself is removed and when the group is opened.
A bit later than we'd prefer, but better than the current over
aggressive approach.

Fixes: ccd46dbae77d ("vfio: support notifier chain in vfio_group")
Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
Cc: &lt;stable@vger.kernel.org&gt; # v4.10
Cc: Jike Song &lt;jike.song@intel.com&gt;
</content>
</entry>
<entry>
<title>vfio: fix a typo in comment of function vfio_pin_pages</title>
<updated>2017-02-22T18:40:15Z</updated>
<author>
<name>Changbin Du</name>
</author>
<published>2017-02-06T07:03:37Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d9d84780f17cd9e25ddde10eb40357b96b7d6874'/>
<id>urn:sha1:d9d84780f17cd9e25ddde10eb40357b96b7d6874</id>
<content type='text'>
Correct the description that 'unpinned' -&gt; 'pinned'.

Signed-off-by: Changbin Du &lt;changbin.du@intel.com&gt;
Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio: Replace module request with softdep</title>
<updated>2017-02-09T19:13:53Z</updated>
<author>
<name>Alex Williamson</name>
</author>
<published>2017-02-08T20:13:26Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0ca582fd0463106e277e1f723b4554b4d0e5f700'/>
<id>urn:sha1:0ca582fd0463106e277e1f723b4554b4d0e5f700</id>
<content type='text'>
Rather than doing a module request from within the init function, add
a soft dependency on the available IOMMU backend drivers.  This makes
the dependency visible to userspace when picking modules for the
ram disk.

Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio: support notifier chain in vfio_group</title>
<updated>2016-12-01T17:40:05Z</updated>
<author>
<name>Jike Song</name>
</author>
<published>2016-12-01T05:20:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ccd46dbae77dbf0d33f42e04b59536f108c395e8'/>
<id>urn:sha1:ccd46dbae77dbf0d33f42e04b59536f108c395e8</id>
<content type='text'>
Beyond vfio_iommu events, users might also be interested in
vfio_group events. For example, if a vfio_group is used along
with Qemu/KVM, whenever kvm pointer is set to/cleared from the
vfio_group, users could be notified.

Currently only VFIO_GROUP_NOTIFY_SET_KVM supported.

Cc: Kirti Wankhede &lt;kwankhede@nvidia.com&gt;
Cc: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Cc: Xiao Guangrong &lt;guangrong.xiao@linux.intel.com&gt;
Signed-off-by: Jike Song &lt;jike.song@intel.com&gt;
[aw: remove use of new typedef]
Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio: vfio_register_notifier: classify iommu notifier</title>
<updated>2016-12-01T16:38:47Z</updated>
<author>
<name>Jike Song</name>
</author>
<published>2016-12-01T05:20:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=22195cbd3451a75abaf30651a61cf85c89061327'/>
<id>urn:sha1:22195cbd3451a75abaf30651a61cf85c89061327</id>
<content type='text'>
Currently vfio_register_notifier assumes that there is only one
notifier chain, which is in vfio_iommu. However, the user might
also be interested in events other than vfio_iommu, for example,
vfio_group. Refactor vfio_{un}register_notifier implementation
to make it feasible.

Cc: Paolo Bonzini &lt;pbonzini@redhat.com&gt;
Cc: Xiao Guangrong &lt;guangrong.xiao@linux.intel.com&gt;
Reviewed-by: Kirti Wankhede &lt;kwankhede@nvidia.com&gt;
Signed-off-by: Jike Song &lt;jike.song@intel.com&gt;
[aw: merge with commit 816ca69ea9c7 ("vfio: Fix handling of error returned by 'vfio_group_get_from_dev()'"), remove typedef]
Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio: Fix handling of error returned by 'vfio_group_get_from_dev()'</title>
<updated>2016-12-01T15:45:49Z</updated>
<author>
<name>Christophe JAILLET</name>
</author>
<published>2016-11-30T07:06:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d256459fae4dba66d50850f2d948306503818913'/>
<id>urn:sha1:d256459fae4dba66d50850f2d948306503818913</id>
<content type='text'>
'vfio_group_get_from_dev()' seems to return only NULL on error, not an
error pointer.

Fixes: 2169037dc322 ("vfio iommu: Added pin and unpin callback functions to vfio_iommu_driver_ops")
Fixes: c086de818dd8 ("vfio iommu: Add blocking notifier to notify DMA_UNMAP")
Signed-off-by: Christophe JAILLET &lt;christophe.jaillet@wanadoo.fr&gt;
Reported-by: Dan Carpenter &lt;dan.carpenter@oracle.com&gt;
Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
<entry>
<title>vfio: fix vfio_info_cap_add/shift</title>
<updated>2016-11-21T18:51:53Z</updated>
<author>
<name>Eric Auger</name>
</author>
<published>2016-11-21T06:21:02Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=5ba6de98c78ac45166036516e34bec487887ba5d'/>
<id>urn:sha1:5ba6de98c78ac45166036516e34bec487887ba5d</id>
<content type='text'>
Capability header next field is an offset relative to the start of
the INFO buffer. tmp-&gt;next is assigned the proper value but iterations
implemented in vfio_info_cap_add and vfio_info_cap_shift use next
as an offset between the headers. When coping with multiple capabilities
this leads to an Oops.

Signed-off-by: Eric Auger &lt;eric.auger@redhat.com&gt;
Reviewed-by: David Hildenbrand &lt;david@redhat.com&gt;
Signed-off-by: Alex Williamson &lt;alex.williamson@redhat.com&gt;
</content>
</entry>
</feed>
