[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2015af0a-cd66-8092-b075-10a1b434d35c@nvidia.com>
Date: Tue, 15 Nov 2016 20:41:26 +0530
From: Kirti Wankhede <kwankhede@...dia.com>
To: Alex Williamson <alex.williamson@...hat.com>
CC: <pbonzini@...hat.com>, <kraxel@...hat.com>, <cjia@...dia.com>,
<qemu-devel@...gnu.org>, <kvm@...r.kernel.org>,
<kevin.tian@...el.com>, <jike.song@...el.com>,
<bjsdjshi@...ux.vnet.ibm.com>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v12 11/22] vfio iommu: Add blocking notifier to notify
DMA_UNMAP
>> @@ -854,15 +857,29 @@ static int vfio_dma_do_unmap(struct vfio_iommu *iommu,
>> if (dma->task->mm != current->mm)
>> break;
>> unmapped += dma->size;
>> +
>> + mutex_unlock(&iommu->lock);
>> + if (iommu->external_domain && !RB_EMPTY_ROOT(&dma->pfn_list)) {
>> + struct vfio_iommu_type1_dma_unmap nb_unmap;
>> +
>> + nb_unmap.iova = dma->iova;
>> + nb_unmap.size = dma->size;
>> + blocking_notifier_call_chain(&iommu->notifier,
>> + VFIO_IOMMU_NOTIFY_DMA_UNMAP,
>> + &nb_unmap);
>> +
>> + if (WARN_ON(!RB_EMPTY_ROOT(&dma->pfn_list)))
>> + goto unmap_exit;
>> + }
>> + mutex_lock(&iommu->lock);
>
> Why are the mutexes pushed out so far, we are referencing way too much
> stuff outside of the mutex here. The notifier head has its own
> semaphore, so we should be able to squeeze the mutex opening to just
> around the notifier call, in which case we only worry about the iommu
> itself going way.
>
Right. Updating.
Thanks,
Kirti
Powered by blists - more mailing lists