Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp3258734pxb; Thu, 10 Feb 2022 16:40:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJyeWqr+/0BWcDwBBiirDO0lMDD8o7jinUox82cl7jvRt2+b7IqzpmnXa7GWujdcN5qgJeQQ X-Received: by 2002:a05:6402:2751:: with SMTP id z17mr10880218edd.54.1644540031299; Thu, 10 Feb 2022 16:40:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644540031; cv=none; d=google.com; s=arc-20160816; b=hbo5VyNkud7PbBRnSvUPjQ8O2KIZn3cghuFy2hCwLQ03QE8cgSDXwBcQhwaU0ngi7n Jq4t94i2kEPcvYKlzIqx/WH6WN6RyL7203VbafgqC3H2dNF9sG9rz6dyzJkWtAvKizFM WacYhhl4fTUodxKXQVvSp59nQGCNOIrIu4v0ENkXnbgwFXOzNu8eFQ0kf2oWN22N3VIP +Qb5qoQVN84kCNKpP0//V9Da9FtLfaIKd09N3XRlUeQLI1QRo0bPIKZ5npk9BSKUXmih ooq8d3DKFd71JPzQXyY+QUm+t7XjxbxAb6bXEw81riVzhIPoGS2P93RjoHQ9686ES8/9 JzIg== 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=DdC3hBSUm3zqG40p3kRk/UmPUmWLIG60TpNCJzTOaNw=; b=TBmsy5xPG/ZqeE+JXraaJeaISHtrkdlisa3ou9AsUVza5pCVSFWrrZBleZh2DB0VBF 4VflmmOx4kIGkF4hhXlEtctGi7YAWT/KQ38q6xfgD7DPmOuaaqRaKXcvTx0yV0Ht1per 6vhBpxI7pF1HT9tmuqj0eFA+eQWoxapdmD+AYnfgxDgtZ8wrx2yVy6IPg0jzJLrWl7K4 aTFa6Jzw6U9PQaxuYQ+h4sf4lvyHKvwR5iRE19u2O29nkPN02s4QMMvffOm5rxm6uorJ 5s+EzCeM3h8dByLUiS7zuC+bfnUXKcYH46Ni9NAhceOUto8glVqxpUBbnWdIo+rqHHcf /4Rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=F7tmy2vB; 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 e10si9182357ejk.368.2022.02.10.16.40.06; Thu, 10 Feb 2022 16:40:31 -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=F7tmy2vB; 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 S230175AbiBJSqJ (ORCPT + 99 others); Thu, 10 Feb 2022 13:46:09 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:36034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343524AbiBJSqH (ORCPT ); Thu, 10 Feb 2022 13:46:07 -0500 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12377F47 for ; Thu, 10 Feb 2022 10:46:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1644518768; x=1676054768; h=date:from:to:cc:subject:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rwYtZDJpiN5pbfbdwSd8f9sWHmJpVk7KWW+5mNsUYHk=; b=F7tmy2vBDwfS7DOk+vQdGY6TgPZzQVpBv/j1aZWQTjE57vwXStQV3jkU CGAy5C5nkq+WSoW4fbh54uqzfyv1Wpj5IexIj37Ovc8bGjwLodxnMKXNF 1hVJtjDvFFI4Bem10pQfc9Ygkts9KBT/Hy59rNiEj+oRUQnKRKIQBtO+/ +H0tb1xNKop3JfdLjZV5TKDOM9jNlUyKQ1wIfBIKHQLQPoEZOumN6HKiv ku7kRVWwQHunFfpaa810zCKYKQK+D6QbL10kfgQ6wbJ6QJycUvKXfaEbW x20Pv9qWEFjOz0szWcH/jqGPobwPp6Ggi1pdnx1se9WJzvuWsdmCn6IX2 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10254"; a="229531437" X-IronPort-AV: E=Sophos;i="5.88,359,1635231600"; d="scan'208";a="229531437" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 10:46:07 -0800 X-IronPort-AV: E=Sophos;i="5.88,359,1635231600"; d="scan'208";a="537402098" Received: from jacob-builder.jf.intel.com (HELO jacob-builder) ([10.7.198.157]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Feb 2022 10:46:07 -0800 Date: Thu, 10 Feb 2022 10:49:04 -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: <20220210104904.6c6131f2@jacob-builder> In-Reply-To: <20220209191614.5a3b42d4@jacob-builder> References: <20220207230254.3342514-1-fenghua.yu@intel.com> <20220207230254.3342514-6-fenghua.yu@intel.com> <20220209191614.5a3b42d4@jacob-builder> 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_PASS, 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 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 > Thanks, > > Jacob Thanks, Jacob