Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1300465ybt; Thu, 2 Jul 2020 01:51:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzItmk1EwaPEWnNWHljaLkcIN166le7ZX312lMeHdJs8bd0UxlwNfe3WSUS163WjOjyrupK X-Received: by 2002:a50:f392:: with SMTP id g18mr11293721edm.151.1593679910844; Thu, 02 Jul 2020 01:51:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593679910; cv=none; d=google.com; s=arc-20160816; b=raHEyDOXxtU1qugpbAIzr1pBO1nqipAHUn/Cgk0zYTx+Xs6bBZQ+V6rJ1leftNtxVg 9R81TXYzkfzj8tMOeFT6P468jt+2xvt9kiBmoGdpf9xrgBH7LTdUlJLJ6fYaYs6VgGfl w/+RGHPwjjETMKAR9f8IdtGv9zGParw7LZpr3Ia08pDOzLcLDSTjSkkoXAHfv5pMicRn 1y4VnSoBIfI4UIWi4K+Zpa43Ww4Hyfnkju4yRplayiK/+IPR/ZsTUhV9KRK6JmnW6zac JZjkWubYX9gm0BZLAYMk5VWkUX5Tax5jPVK3I7/6eZzHEzcDlp463sG2GsBLwZI0CCmu FDUA== 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=rL9RIKx4hz19hS1SSEqW7f8vI579//zx822fB8l/eH8=; b=vn6o8LV27IAR/xtEHRQPds9QmEAvhlpsRrkEFoCbicFAVAHzl59LuflpTqf6x8OwdF aqYXMbCWH6qHxXvbupH1UN1LSb4DLsvuaq26xt6u4KttEybfrlbQbhcq4Hza29bJuaoz 3t5Yl2V5Rn9Qdm3RxOg0A+NGKL+fM54bZ0QJhl5nUz+tcr4TQx56FI8vBTW1YP/Lzkow kC7OvHdDkhAOKYFvNUYHAA+afiKIb8ohkzlMsbrBgwezStCCH51UKTQywIb4MB5nh9Ia rsDdV9uqOXOVasHvxIfaKRQEFzdE6PyqBf/bMHPsr4p1HgU9cXRZOW3vtIOC5JC3Cg8R CwUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=IeF7uKfb; 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 f9si5848967ejl.52.2020.07.02.01.51.28; Thu, 02 Jul 2020 01:51:50 -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=IeF7uKfb; 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 S1726928AbgGBIvF (ORCPT + 99 others); Thu, 2 Jul 2020 04:51:05 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:46265 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726042AbgGBIvE (ORCPT ); Thu, 2 Jul 2020 04:51:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593679863; 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=rL9RIKx4hz19hS1SSEqW7f8vI579//zx822fB8l/eH8=; b=IeF7uKfboJ7Ykm/s+JkM1+ND6ecujg8GsBzFc+X7dUJzCloMzO0fcq8AZ6azPLF+tm3mVO 5wzKE9jQ7i/poND5d5+C3G8TQ2QNQwwerGl5COgyEBDVLKRj6zxjQihOZPr2XEXO70is5s 6J19evejIoymZ2yZ2eYWxrhxAuWpNQ0= 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-379-bmm9GuxKOKuOkDM4eXsy6Q-1; Thu, 02 Jul 2020 04:50:59 -0400 X-MC-Unique: bmm9GuxKOKuOkDM4eXsy6Q-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 32068879513; Thu, 2 Jul 2020 08:50:58 +0000 (UTC) Received: from [10.36.112.70] (ovpn-112-70.ams2.redhat.com [10.36.112.70]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4040D10098A4; Thu, 2 Jul 2020 08:50:56 +0000 (UTC) Subject: Re: [PATCH v3 7/7] iommu/vt-d: Disable multiple GPASID-dev bind To: Jacob Pan , iommu@lists.linux-foundation.org, LKML , Lu Baolu , Joerg Roedel , David Woodhouse Cc: Yi Liu , "Tian, Kevin" , Raj Ashok References: <1593617636-79385-1-git-send-email-jacob.jun.pan@linux.intel.com> <1593617636-79385-8-git-send-email-jacob.jun.pan@linux.intel.com> From: Auger Eric Message-ID: <67186ca8-6af2-7ef2-a238-49fcfa5bc398@redhat.com> Date: Thu, 2 Jul 2020 10:50:54 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <1593617636-79385-8-git-send-email-jacob.jun.pan@linux.intel.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Jacob, On 7/1/20 5:33 PM, Jacob Pan wrote: > For the unlikely use case where multiple aux domains from the same pdev > are attached to a single guest and then bound to a single process > (thus same PASID) within that guest, we cannot easily support this case > by refcounting the number of users. As there is only one SL page table > per PASID while we have multiple aux domains thus multiple SL page tables > for the same PASID. > > Extra unbinding guest PASID can happen due to race between normal and > exception cases. Termination of one aux domain may affect others unless > we actively track and switch aux domains to ensure the validity of SL > page tables and TLB states in the shared PASID entry. > > Support for sharing second level PGDs across domains can reduce the > complexity but this is not available due to the limitations on VFIO > container architecture. We can revisit this decision once sharing PGDs > are available. > > Overall, the complexity and potential glitch do not warrant this unlikely > use case thereby removed by this patch. > > Fixes: 56722a4398a30 ("iommu/vt-d: Add bind guest PASID support") > Acked-by: Lu Baolu > Cc: Kevin Tian > Cc: Lu Baolu > Signed-off-by: Liu Yi L > Signed-off-by: Jacob Pan Reviewed-by: Eric Auger Thanks Eric > --- > drivers/iommu/intel/svm.c | 22 +++++++++------------- > 1 file changed, 9 insertions(+), 13 deletions(-) > > diff --git a/drivers/iommu/intel/svm.c b/drivers/iommu/intel/svm.c > index 6c87c807a0ab..d386853121a2 100644 > --- a/drivers/iommu/intel/svm.c > +++ b/drivers/iommu/intel/svm.c > @@ -277,20 +277,16 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev, > goto out; > } > > + /* > + * Do not allow multiple bindings of the same device-PASID since > + * there is only one SL page tables per PASID. We may revisit > + * once sharing PGD across domains are supported. > + */ > for_each_svm_dev(sdev, svm, dev) { > - /* > - * For devices with aux domains, we should allow > - * multiple bind calls with the same PASID and pdev. > - */ > - if (iommu_dev_feature_enabled(dev, > - IOMMU_DEV_FEAT_AUX)) { > - sdev->users++; > - } else { > - dev_warn_ratelimited(dev, > - "Already bound with PASID %u\n", > - svm->pasid); > - ret = -EBUSY; > - } > + dev_warn_ratelimited(dev, > + "Already bound with PASID %u\n", > + svm->pasid); > + ret = -EBUSY; > goto out; > } > } else { >