Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754296AbcKQEtp (ORCPT ); Wed, 16 Nov 2016 23:49:45 -0500 Received: from hqemgate16.nvidia.com ([216.228.121.65]:9762 "EHLO hqemgate16.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932229AbcKQEtm (ORCPT ); Wed, 16 Nov 2016 23:49:42 -0500 X-PGP-Universal: processed; by hqnvupgp07.nvidia.com on Wed, 16 Nov 2016 08:48:38 -0800 Subject: Re: [PATCH v14 10/22] vfio iommu type1: Add support for mediated devices To: Alex Williamson References: <1479329194-10247-1-git-send-email-kwankhede@nvidia.com> <1479329194-10247-11-git-send-email-kwankhede@nvidia.com> <20161116165715.5da8f734@t450s.home> CC: , , , , , , , , X-Nvconfidentiality: public From: Kirti Wankhede Message-ID: Date: Thu, 17 Nov 2016 10:19:28 +0530 MIME-Version: 1.0 In-Reply-To: <20161116165715.5da8f734@t450s.home> X-Originating-IP: [10.24.216.210] X-ClientProxiedBy: DRUKMAIL102.nvidia.com (10.25.59.20) To bgmail102.nvidia.com (10.25.59.11) Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1241 Lines: 42 On 11/17/2016 5:27 AM, Alex Williamson wrote: > On Thu, 17 Nov 2016 02:16:22 +0530 > Kirti Wankhede wrote: >> @@ -931,6 +1344,24 @@ static void vfio_iommu_type1_detach_group(void *iommu_data, >> >> mutex_lock(&iommu->lock); >> >> + if (iommu->external_domain) { >> + group = find_iommu_group(iommu->external_domain, iommu_group); >> + if (group) { >> + list_del(&group->next); >> + kfree(group); >> + >> + if (list_empty(&iommu->external_domain->group_list)) { >> + vfio_sanity_check_pfn_list(iommu); >> + >> + if (!IS_IOMMU_CAP_DOMAIN_IN_CONTAINER(iommu)) >> + vfio_iommu_unmap_unpin_all(iommu); >> + >> + kfree(iommu->external_domain); > > I advised in one place that I didn't understand why we were checking > iommu->external_domain before walking the pfn_list, but we do have > several checks still in place for if(iommu->external_domain), so I > think we better be setting to NULL after we free it. > > I haven't finished my review yet, but if this ends up being the only > comment and you agree, I can add: > > iommu->external_domain = NULL; > > here on commit. Thanks, > Thanks Alex. I'm updating this patch and 11/22 as per your comment here and on 11/22. Thanks, Kirti