linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] vfio iommu type1: WARN_ON if notifier block is not unregistered
@ 2016-12-05 21:08 Kirti Wankhede
  2016-12-05 23:26 ` Alex Williamson
  0 siblings, 1 reply; 3+ messages in thread
From: Kirti Wankhede @ 2016-12-05 21:08 UTC (permalink / raw)
  To: alex.williamson, pbonzini, kraxel, cjia
  Cc: qemu-devel, kvm, linux-kernel, Kirti Wankhede

mdev vendor driver should unregister the iommu notifier since the vfio
iommu can persist beyond the attachment of the mdev group. WARN_ON will
show warning if vendor driver doesn't unregister the notifier and is
forced to follow the implementations steps.

Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
Signed-off-by: Neo Jia <cjia@nvidia.com>
Change-Id: I75fd0a40e582a144fe7a037c7140d3513e8ff030
---
 drivers/vfio/vfio_iommu_type1.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
index 023fba7b8d5a..37871ee0c0c5 100644
--- a/drivers/vfio/vfio_iommu_type1.c
+++ b/drivers/vfio/vfio_iommu_type1.c
@@ -1361,6 +1361,8 @@ static void vfio_sanity_check_pfn_list(struct vfio_iommu *iommu)
 		if (WARN_ON(!RB_EMPTY_ROOT(&dma->pfn_list)))
 			break;
 	}
+	/* mdev venfor driver must unregister notifier */
+	WARN_ON(iommu->notifier.head);
 }
 
 static void vfio_iommu_type1_detach_group(void *iommu_data,
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] vfio iommu type1: WARN_ON if notifier block is not unregistered
  2016-12-05 21:08 [PATCH 1/1] vfio iommu type1: WARN_ON if notifier block is not unregistered Kirti Wankhede
@ 2016-12-05 23:26 ` Alex Williamson
  2016-12-06  3:57   ` Kirti Wankhede
  0 siblings, 1 reply; 3+ messages in thread
From: Alex Williamson @ 2016-12-05 23:26 UTC (permalink / raw)
  To: Kirti Wankhede; +Cc: pbonzini, kraxel, cjia, qemu-devel, kvm, linux-kernel

On Tue, 6 Dec 2016 02:38:20 +0530
Kirti Wankhede <kwankhede@nvidia.com> wrote:

> mdev vendor driver should unregister the iommu notifier since the vfio
> iommu can persist beyond the attachment of the mdev group. WARN_ON will
> show warning if vendor driver doesn't unregister the notifier and is
> forced to follow the implementations steps.
> 
> Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
> Signed-off-by: Neo Jia <cjia@nvidia.com>
> Change-Id: I75fd0a40e582a144fe7a037c7140d3513e8ff030
> ---
>  drivers/vfio/vfio_iommu_type1.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
> index 023fba7b8d5a..37871ee0c0c5 100644
> --- a/drivers/vfio/vfio_iommu_type1.c
> +++ b/drivers/vfio/vfio_iommu_type1.c
> @@ -1361,6 +1361,8 @@ static void vfio_sanity_check_pfn_list(struct vfio_iommu *iommu)
>  		if (WARN_ON(!RB_EMPTY_ROOT(&dma->pfn_list)))
>  			break;
>  	}
> +	/* mdev venfor driver must unregister notifier */

s/venfor/vendor/

> +	WARN_ON(iommu->notifier.head);
>  }
>  
>  static void vfio_iommu_type1_detach_group(void *iommu_data,

Applied for v4.10 with the above typo fix.  Thanks,

Alex

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH 1/1] vfio iommu type1: WARN_ON if notifier block is not unregistered
  2016-12-05 23:26 ` Alex Williamson
@ 2016-12-06  3:57   ` Kirti Wankhede
  0 siblings, 0 replies; 3+ messages in thread
From: Kirti Wankhede @ 2016-12-06  3:57 UTC (permalink / raw)
  To: Alex Williamson; +Cc: pbonzini, kraxel, cjia, qemu-devel, kvm, linux-kernel



On 12/6/2016 4:56 AM, Alex Williamson wrote:
> On Tue, 6 Dec 2016 02:38:20 +0530
> Kirti Wankhede <kwankhede@nvidia.com> wrote:
> 
>> mdev vendor driver should unregister the iommu notifier since the vfio
>> iommu can persist beyond the attachment of the mdev group. WARN_ON will
>> show warning if vendor driver doesn't unregister the notifier and is
>> forced to follow the implementations steps.
>>
>> Signed-off-by: Kirti Wankhede <kwankhede@nvidia.com>
>> Signed-off-by: Neo Jia <cjia@nvidia.com>
>> Change-Id: I75fd0a40e582a144fe7a037c7140d3513e8ff030
>> ---
>>  drivers/vfio/vfio_iommu_type1.c | 2 ++
>>  1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/vfio/vfio_iommu_type1.c b/drivers/vfio/vfio_iommu_type1.c
>> index 023fba7b8d5a..37871ee0c0c5 100644
>> --- a/drivers/vfio/vfio_iommu_type1.c
>> +++ b/drivers/vfio/vfio_iommu_type1.c
>> @@ -1361,6 +1361,8 @@ static void vfio_sanity_check_pfn_list(struct vfio_iommu *iommu)
>>  		if (WARN_ON(!RB_EMPTY_ROOT(&dma->pfn_list)))
>>  			break;
>>  	}
>> +	/* mdev venfor driver must unregister notifier */
> 
> s/venfor/vendor/
> 
>> +	WARN_ON(iommu->notifier.head);
>>  }
>>  
>>  static void vfio_iommu_type1_detach_group(void *iommu_data,
> 
> Applied for v4.10 with the above typo fix.  Thanks,
> 

Thanks Alex!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-12-06  3:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-05 21:08 [PATCH 1/1] vfio iommu type1: WARN_ON if notifier block is not unregistered Kirti Wankhede
2016-12-05 23:26 ` Alex Williamson
2016-12-06  3:57   ` Kirti Wankhede

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