Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3270143pxb; Thu, 10 Feb 2022 17:01:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJwsiv0vk4iqiu2zmE2GVwPWg+IOdnkqnS+3GVSfbAuo6PEDh0WoX7+C1auwd8N4/c5OwCtL X-Received: by 2002:a17:907:90d5:: with SMTP id gk21mr8186984ejb.633.1644541300528; Thu, 10 Feb 2022 17:01:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644541300; cv=none; d=google.com; s=arc-20160816; b=PNyoAMOBAJwYNzONbgNK7+/S3yLA0SWh4577Cd7F3yCK2ECWQZt0/FASMnpedJnsMK aunqj6SMjdqH37KbimS7H/rMv4JPpwsJNr/TeOa9vDbR5eKdUljN99Iqz9kGwDW3tVNH VT1T0ezHYALvZ14UkbQCvY2U4x4pOJ7voNEUFBea1sOhrgijE4rPmG8fABfZJvpK8gi4 66wdcF8KHBP9UWiINBVO2Xgdt6f9EisGG9KQeodPuaV2DzSLc9FPldzMMgopy4vrn4H6 DRfBEpODb/JQYTIa7CEJIsUSzXV/NQcwXVdpTKQhIHqzi+gw5/PduulFXiH5dGtp3ugG R0xA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=PghBH6m786nkRBDWspBC4hepW6x+8miyRvZsfaw+5Vk=; b=PXwnun/ruyf98hn5SXWL4F4q8R9RumUFR8yyFqyFwlM5dcLXdKLPPSaYuXe1b+G0Ni tweOfA80bgF6mfGOHX6hfZbXgJIipHau/SBiJUUz1O0K54o+VFlolGbJIR+UmZ7QTxW8 l4aNclOugUuZHez1FOvV0tOwu5idKeXzqJNYlMt+DWdcmEl5HKSRE75ciPli7jNcQ5D1 VmuiwXvChTuxXe+IO8fnFPfBpHCrxf7RKPj8EpkZ+jGPx2RFzEeeOKAaFCiwRkrKyip1 qZ8HEAz3LRTE4Wi5qYTZG3L7sqI2ip5xV5nhhmxNV7+2IE4/0lCV7+sy89OauR8RZD+P acnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YyDEIyPf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id jg31si2520688ejc.667.2022.02.10.17.01.15; Thu, 10 Feb 2022 17:01:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YyDEIyPf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345551AbiBJXPQ (ORCPT + 99 others); Thu, 10 Feb 2022 18:15:16 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:34088 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344689AbiBJXPP (ORCPT ); Thu, 10 Feb 2022 18:15:15 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CCFE5F44 for ; Thu, 10 Feb 2022 15:15:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644534916; x=1676070916; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=Lh6tjCWAtV9Sv/IHSE2GQfvx+Z+uUWNu3HE21O/Ggpo=; b=YyDEIyPfT4zHrvVlbpaR7QvU7mc4TuNTKlSowSHhVwCmaRIdUlgc2Zr0 ++MwaAoBo8K7hfzloEoSS9t65xhxavULJDl8tkR100g02KQNThqoGSKsp 10JoINDPEMqboDh1+4c/SfvmEXBCOFpq0mf/unfCJ8nKtobbkUayCVQQv veT9mB17LdSopOzz4B39GCG/mJdFW+4iugn4G1LCUedymC0dwgucE0nDA 7xChMYrhmgYMezZsqfdhP1S/1/UoVeOyGHnPraNRZ1WDVUmmMtQN1oGFc 662juvD5MuKrv1Bmue2pnHTB3CedoZKnZWC9erOCnkafa3sVOqhiFbreX w==; X-IronPort-AV: E=McAfee;i="6200,9189,10254"; a="336037762" X-IronPort-AV: E=Sophos;i="5.88,359,1635231600"; d="scan'208";a="336037762" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 15:15:16 -0800 X-IronPort-AV: E=Sophos;i="5.88,359,1635231600"; d="scan'208";a="633862803" Received: from otcwcpicx3.sc.intel.com ([172.25.55.73]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 15:15:15 -0800 Date: Thu, 10 Feb 2022 15:15:10 -0800 From: Fenghua Yu To: Jacob Pan Cc: Thomas Gleixner , Dave Hansen , Ingo Molnar , Borislav Petkov , Peter Zijlstra , Andy Lutomirski , Tony Luck , Lu Baolu , Joerg Roedel , Josh Poimboeuf , Ashok Raj , Ravi V Shankar , iommu@lists.linux-foundation.org, x86 , linux-kernel Subject: Re: [PATCH v4 05/11] iommu/sva: Assign a PASID to mm on PASID allocation and free it on mm exit Message-ID: References: <20220207230254.3342514-1-fenghua.yu@intel.com> <20220207230254.3342514-6-fenghua.yu@intel.com> <20220209191614.5a3b42d4@jacob-builder> <20220210104904.6c6131f2@jacob-builder> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220210104904.6c6131f2@jacob-builder> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 10, 2022 at 10:49:04AM -0800, Jacob Pan wrote: > > On Wed, 9 Feb 2022 19:16:14 -0800, Jacob Pan > wrote: > > > Hi Fenghua, > > > > On Mon, 7 Feb 2022 15:02:48 -0800, Fenghua Yu > > wrote: > > > > > @@ -1047,8 +1040,6 @@ struct iommu_sva *intel_svm_bind(struct device > > > *dev, struct mm_struct *mm, void } > > > > > > sva = intel_svm_bind_mm(iommu, dev, mm, flags); > > > - if (IS_ERR_OR_NULL(sva)) > > > - intel_svm_free_pasid(mm); > > If bind fails, the PASID has no IOMMU nor CPU context. It should be safe > > to free here. > > > Actually, here we cannot tell if the bind is the first of the mm so I think > this is fine. > > Reviewed-by: Jacob Pan Thank you very much for your review, Jacob! -Fenghua