Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp968394ybb; Fri, 10 Apr 2020 14:01:51 -0700 (PDT) X-Google-Smtp-Source: APiQypLWKX0hIFXgfEsv7VW3YiKXs8BDclcGPw3HDLwixBCSPmCQjAKijkaXA8PU13vK9oz/G6uM X-Received: by 2002:ac8:d0b:: with SMTP id q11mr1004269qti.83.1586552511096; Fri, 10 Apr 2020 14:01:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586552511; cv=none; d=google.com; s=arc-20160816; b=xUBUnXoW9pHpOcEyn+pnuwG7ZB1LSIrzPtXVY7069+J8PVYcLMr0sXEGy2lUgyqzch rJZGpeVsql0DULIUjTEug2YU59Kv2utD+Q4Gl+knGo62OQUu/iTD3kzAiSKq3+AX0FKT iOC6VH9vhxNTRuoiYA+eE8KMQPt76xUY6TgFrdEO+NzHGqWq4TUXLd1Y+kdaj7HIcugm sNkoPkKEh3gojTiwNUfwFy8gqwsQtZDocJKF59FDsFKXGvAYrehMA1ur6CdpCzuZXf7r ro0bVxDmVfEsxaT1WAfN36IyjLBtVGeJMxKsy4Xl6RoLxMbbkkaZBw1/SMlsCxrGROBG diMQ== 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:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:ironport-sdr:ironport-sdr; bh=De3S2aFOMwLleT0PTabdSknuzuYu+Tcg3WZswg9F7W4=; b=A9+hzaFBjIp+35riTpz8+LFPQonH41k/Dq8rLQBtGFo8iThCYovQtOzufdzWT9EScy zSkpxLA0zWtlrz/VUvhTSYy53yp8NaH2eQbhq5WFvir8fWnTZujvSGSaTpmy9h917aqe zIGKLekZ7pH8T8gcGVgQ2wxDXVxvJTm3RPAAIN444b8lYISlgs29gu5mKMsReEIRbvDY GqNLVYF89aILHUCKEP0yagONwjdilUvYtMKzfiieqhK7y/tbjL0gODvRTNa3wIWmtgaK AxZEbkHwRjloRRqfe0DNMZSY6jrlEVnx/smT3PHo1INF5djO0YpRpWIVAAorVMqUBUqV SG1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k10si1940797qkh.109.2020.04.10.14.01.35; Fri, 10 Apr 2020 14:01:51 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726669AbgDJVAN (ORCPT + 99 others); Fri, 10 Apr 2020 17:00:13 -0400 Received: from mga14.intel.com ([192.55.52.115]:62407 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726626AbgDJVAN (ORCPT ); Fri, 10 Apr 2020 17:00:13 -0400 IronPort-SDR: /6Jpw9AjGqv0HfoXe12urdgNlo3fNMB+cC6dJbUyuYgpQf4Y4SAlFuKlLhITyKAzABTCGGcrgP C1oCBkrvuJJQ== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2020 14:00:12 -0700 IronPort-SDR: hw8vPaWSQRseTrREmDo4wEHF8666mtcHFEvvy/V5KhBxJx+IhmwkOEeDDxYKUMPmn9738D0XY4 XhMcrt1ZGmBg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,368,1580803200"; d="scan'208";a="331278002" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.7.199.155]) by orsmga001.jf.intel.com with ESMTP; 10 Apr 2020 14:00:12 -0700 Date: Fri, 10 Apr 2020 14:06:04 -0700 From: Jacob Pan To: Auger Eric 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 , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH v11 05/10] iommu/vt-d: Add bind guest PASID support Message-ID: <20200410140604.403cb5b2@jacob-builder> In-Reply-To: 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> Organization: OTC X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.30; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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" > > + * 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. Thanks, Jacob