Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp1164921ybz; Thu, 16 Apr 2020 04:14:38 -0700 (PDT) X-Google-Smtp-Source: APiQypIV8zhwr6bxCvr1m58iF4ApJZb+a190Jpcgfu2UOr8lgW+F7f52deImP4s9E6RT9+oCFz6i X-Received: by 2002:a17:907:20f7:: with SMTP id rh23mr8951118ejb.71.1587035678673; Thu, 16 Apr 2020 04:14:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1587035678; cv=none; d=google.com; s=arc-20160816; b=lOlinoGyEM+qULx2sagPAHGpdNabzoWbi1GfQ6Ae+nSCHlOmqDejnPGYdA+2o//nMU 82MjnaZdMAu7SoA2cVVqty/niAQqJ7MswN3W8Ma/KQXa8xT37EvUNYujNPHUJrWMf+WJ 8znV5e302kC36NBRPqOSNqzm1TEyFQxX1UTiuw12gwKm1Z6SMdrSyaVpvW20ROmA8jII qkM9hPpYbS5yfqzde8kU7yIBcS0BAyGDyh7RFTyRu4Mo9s/ZLp5iDnLGrLy2JiYyrnMf 8ZQ7BY6LhJ04OVvDASFpF765o9I1kiF//1s6rsskI8zElPljtslwDmsnuEDaNQzR1aFv sFaA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=663Ng6YS73plx9PBQ6c4/yXjrAwiTI7oew+JgnDni+g=; b=pFYxDcWsej4i2QQP+nmpCYOTKkihTNR2+TD6G9mJSsnnZ37Uacyi3q3in5fosO+Wxc X3vmu+Rycwat9TmoUptftACnLbUnqPtZkqQaohF3zSkPPx/OHX9JB8lHAW4d8b+QIaDf iRU4W2z9DYxEmGqMEkafME7U1mVHYIDtlUtsjTnlhIQAFIoSjbb18v7ekN/Tx8OZySIc Zr5cDCOKIz3jf8lWGgKmnLPmEx/HJeu9IswuPFDaDJGb38m73bJYqIekFCMQ9S1mwkko 6SBaMVOVRw9Y6kGMlpw7dZKvAZjDfmXb115Tk255lhgNwYDgthqFoAq8yc0LCOl+c5+s uZTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EnRMAWgD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c8si1099079edn.240.2020.04.16.04.14.14; Thu, 16 Apr 2020 04:14:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EnRMAWgD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2506183AbgDPLJH (ORCPT + 99 others); Thu, 16 Apr 2020 07:09:07 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:35715 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2506026AbgDPLEc (ORCPT ); Thu, 16 Apr 2020 07:04:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587035070; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=663Ng6YS73plx9PBQ6c4/yXjrAwiTI7oew+JgnDni+g=; b=EnRMAWgDBRo47YvKNCgcyA9M9UPLdbjAkR82PikdQJID6FKK1pPa3h/zEm9ZaWR/oPn3eM YVKvutQEX8eEoUytV4WYF8BuSfRjxtS8UnVQO4RiYvsvz/oNVbH91Vj0i16B9NCzMijEPq DKS2CXGnCZxNclQ6p2ngC+mBA8SliqE= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-490-8WfVj1OmOPmB33JsuWl5mw-1; Thu, 16 Apr 2020 06:46:16 -0400 X-MC-Unique: 8WfVj1OmOPmB33JsuWl5mw-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 94445107ACC4; Thu, 16 Apr 2020 10:46:14 +0000 (UTC) Received: from [10.36.115.53] (ovpn-115-53.ams2.redhat.com [10.36.115.53]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C98402719A; Thu, 16 Apr 2020 10:46:08 +0000 (UTC) Subject: Re: [PATCH v11 05/10] iommu/vt-d: Add bind guest PASID support To: Jacob Pan Cc: Lu Baolu , iommu@lists.linux-foundation.org, LKML , Joerg Roedel , David Woodhouse , Jean-Philippe Brucker , Yi Liu , "Tian, Kevin" , Raj Ashok , Alex Williamson , Christoph Hellwig , Jonathan Cameron , Yi L References: <1585939334-21396-1-git-send-email-jacob.jun.pan@linux.intel.com> <1585939334-21396-6-git-send-email-jacob.jun.pan@linux.intel.com> <20200410140604.403cb5b2@jacob-builder> From: Auger Eric Message-ID: Date: Thu, 16 Apr 2020 12:46:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.4.0 MIME-Version: 1.0 In-Reply-To: <20200410140604.403cb5b2@jacob-builder> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jacob, On 4/10/20 11:06 PM, Jacob Pan wrote: > Hi Eric, > > Missed a few things in the last reply. > > On Thu, 9 Apr 2020 09:41:32 +0200 > Auger Eric wrote: > >>> + intel_pasid_tear_down_entry(iommu, dev, >>> svm->pasid); >> intel_svm_unbind_mm() calls intel_flush_svm_range_dev(svm, sdev, 0, >> -1, 0); Don't we need to flush the (DEV-)IOTLBs as well? > Right, pasid tear down should always include (DEV-)IOTLB flush, I > initially thought it is taken care of by intel_pasid_tear_down_entry(). > >>> + /* TODO: Drain in flight PRQ for the PASID >>> since it >>> + * may get reused soon, we don't want to >>> + * confuse with its previous life. >>> + * intel_svm_drain_prq(dev, pasid); >>> + */ >>> + kfree_rcu(sdev, rcu); >>> + >>> + if (list_empty(&svm->devs)) { >>> + /* >>> + * We do not free the IOASID here >>> in that >>> + * IOMMU driver did not allocate >>> it. >> s/in/as? > I meant to say "in that" as "for the reason that" ok sorry > >>> + * Unlike native SVM, IOASID for >>> guest use was >>> + * allocated prior to the bind >>> call.> + * In any case, if the free >>> call comes before >>> + * the unbind, IOMMU driver will >>> get notified >>> + * and perform cleanup. >>> + */ >>> + ioasid_set_data(pasid, NULL); >>> + kfree(svm); >>> + } >> nit: you may use intel_svm_free_if_empty() > True, but I meant to insert ioasid_notifier under the list_empty > condition in the following ioasid patch. ok Thanks Eric > > > Thanks, > > Jacob >