Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2443983pxb; Wed, 9 Feb 2022 19:48:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQqirNYThXy8rjn0TFVmD4B0Gsaya5gfC7U+Jth3oqpkpXsQOg56HJAzB9nRzex9aKF0y+ X-Received: by 2002:a17:902:f60a:: with SMTP id n10mr5909552plg.1.1644464934937; Wed, 09 Feb 2022 19:48:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644464934; cv=none; d=google.com; s=arc-20160816; b=cGgowZ1w08/DzM0UiktS4FCC3fd1bZFjQOAp/Mx3D58KkP4qJMrjkDIIALRxv+9xTr MYCQ5gDJ9AOeaYoHgqeM8H5/pef8XL7c+8JaLgTCJ9UFJdcYF0CychxTYCxCC5xuYe2J eUO/Aajirs4TCs8b4SvLxSJ9hNzcdoKCqrEcrcnWAXeQG2GxSERCB+vBwGqBmJtgcdgJ fTgcy2slkbivHxQltAVDhgxkTaDws81Js9sDvCYfdADM6To2bS4FFgifXRTCbq/QBWqj yuJ13R2/NzIeIqRGq3s+qJ29WJxgk3juA384SMaSchm6T4+zstmdcGCqsSarvGE3eCup 9Clg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=GK954c2xk3b8DVoc53pZ/c1oGZCWmkW8sIlVZszl/CE=; b=Q8KaV4n49hRfzWTdAxYHPyd8MuID4RP2xNaEUKoStjuSLG2isZCsfTTuGU0Gp/FwAy ihPBSC4ZgGEpOLgHcjmBwOPl/FwWNjJ6CT8tbQQOdOhponGFphYIKat8Xe6Ef1msQ6/H nLUr8NAqLANHowaNxnR8tgz3glD5uvaUKPmqwPJciJAtMisUBybUUb1lcd+jdS5Th0As xrn5COCTb7wCyZvZ5wxSHH7SJIyFl9Q+4RwQ+sfcguMqQ2tljl0IeshHa0kVeWtodIHy ImGu+4LxnHnA1k2QlGxmO4+ZjcASWV0OF79kTtJXZWdlAJSrhqn2HLA+rt9d+Sd9rqEj TPJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=h3zM5Tec; 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 ng9si378692pjb.26.2022.02.09.19.48.42; Wed, 09 Feb 2022 19:48:54 -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=h3zM5Tec; 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 S231808AbiBJDNQ (ORCPT + 99 others); Wed, 9 Feb 2022 22:13:16 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:48370 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229710AbiBJDNO (ORCPT ); Wed, 9 Feb 2022 22:13:14 -0500 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 25F191EAE1 for ; Wed, 9 Feb 2022 19:13:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644462797; x=1675998797; h=date:from:to:cc:subject:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ZcyIvusHwZnfRVfKt2PwWs6i0TMwMkq3rmt+VlQRRGM=; b=h3zM5TecLiM1PKMjh/F6EWB2LAoFjoKcUEmnOm1VuuxkcDBTDwizmkVs zcdUnBS9d7xig1SXcJ+tVaGpxDY4ogBB3+TrMMwH2Izr98sya21seIxnS Sf5ZL8J8BZzh2ncKM2fm8u31Al5PoVXzRQqcOEuvh9lZw+2vZZ52dfW5h 6lWs8EHlFQms2eZ4nTYe9z+cfXDL3OvnQK/iRvdBdAHrLzZmKSCq9iJ9O AAghwDr1YjCAYO0McOpZJoT0d9AVyYGfXNsT9ytU9mirhAkRvw4dddpua iFE9AZoi+kGtbqggMZgVhKPlbAjNYTT3Muu9FL1zT7kxxnW76MjJK9t6Y A==; X-IronPort-AV: E=McAfee;i="6200,9189,10253"; a="335813000" X-IronPort-AV: E=Sophos;i="5.88,357,1635231600"; d="scan'208";a="335813000" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2022 19:13:16 -0800 X-IronPort-AV: E=Sophos;i="5.88,357,1635231600"; d="scan'208";a="485527252" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.7.198.157]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Feb 2022 19:13:16 -0800 Date: Wed, 9 Feb 2022 19:16:14 -0800 From: Jacob Pan To: Fenghua Yu 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" , jacob.jun.pan@linux.intel.com Subject: Re: [PATCH v4 05/11] iommu/sva: Assign a PASID to mm on PASID allocation and free it on mm exit Message-ID: <20220209191614.5a3b42d4@jacob-builder> In-Reply-To: <20220207230254.3342514-6-fenghua.yu@intel.com> References: <20220207230254.3342514-1-fenghua.yu@intel.com> <20220207230254.3342514-6-fenghua.yu@intel.com> Organization: OTC X-Mailer: Claws Mail 3.17.5 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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 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. Thanks, Jacob