Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1229950pxf; Fri, 19 Mar 2021 02:12:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyWMJN5QUw6BJs/OiqrQ6dQ9i1ukoKvomeL1TyHke2htT5fFz7e/68xE8lsxrr1+2T2OKMa X-Received: by 2002:aa7:cf95:: with SMTP id z21mr8254476edx.76.1616145148123; Fri, 19 Mar 2021 02:12:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616145148; cv=none; d=google.com; s=arc-20160816; b=mz4tH1NjEQcOjZcJouHT46fmVopeVHePqSDP+UR/fN+gc2TIBiPZhaUJ+Q3AHuzPig SGeghs/faxUdxnkGMSC1UsO51vepds9Iej0gN2k5IXDjFHhT8EfMf0OFoU6lg9SdU+w3 hYBMnwP8GUOyqGmHqwobdI3ogXKD/ojOWpObHQ/NZ/jatv1v9I1TTgZQql0EpFCsqEj0 sw6yPFyXOCBuH0SCaOzO8AhrbayeHBfl6wLTtY6kBffWMWTDf4hyHgpyiyr1joEF18Eo oQhvFW1nNvUsOS5iIKO7GzyXiM01+AwDRQ1yE5Cm/0Gm6JqjghVSNyQI2ciKVAacDNkb 23OA== 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; bh=1LKu83DFArSA7nz9uOgNsHcEsfGuH888SvfA59XEn4Y=; b=gUzBr9u6KUJ6KT/M9538fJhqeFRVjG6edkXyNmPThYkAXTgN9fXKr3CdBew9oU2S46 I60hW5WsB68JCQLVvoBUi1/ZM1lXK/1dy0pRn9CEE3RZoD9qUibrA6nB+j6AjVfkeisL 9H0SE7R6H3Xwah/ooRvNtvT/DFSr1IMuKyvycoCee+9JvZeOqUq13VRXiz09G7ZegRXb 5zxhdP2Z3GPKEETMJ/eJfRvNL8z43YUZuZLbWsSntbTkbsiZ6yHn2gfnmXuOvAvLvUsi EvOBjTdJarrenTpy+lIMj/OdsmJk6CsJDjH7o1lqHBQ6IqrnDBPWepGy+r0aOMwKzFbS heYQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bx20si3578681edb.215.2021.03.19.02.12.05; Fri, 19 Mar 2021 02:12:28 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=8bytes.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229644AbhCSJIv (ORCPT + 99 others); Fri, 19 Mar 2021 05:08:51 -0400 Received: from 8bytes.org ([81.169.241.247]:59864 "EHLO theia.8bytes.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229818AbhCSJIr (ORCPT ); Fri, 19 Mar 2021 05:08:47 -0400 Received: by theia.8bytes.org (Postfix, from userid 1000) id 6BE362DA; Fri, 19 Mar 2021 10:08:46 +0100 (CET) Date: Fri, 19 Mar 2021 10:08:43 +0100 From: Joerg Roedel To: Lu Baolu Cc: Will Deacon , Dave Jiang , iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] iommu/vt-d: Fix lockdep splat in intel_pasid_get_entry() Message-ID: References: <20210317005834.173503-1-baolu.lu@linux.intel.com> <89f87115-32dc-205e-61e0-71de0d626303@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <89f87115-32dc-205e-61e0-71de0d626303@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Baolu, On Fri, Mar 19, 2021 at 09:02:34AM +0800, Lu Baolu wrote: > This code modifies the pasid directory entry. The pasid directory > entries are allocated on demand and will never be freed. > > > What you need to do here is to retry the whole path by adding a goto > > to before the first get_pasid_table_from_pde() call. > > Yes. Retrying by adding a goto makes the code clearer. > > > > > Btw, what makes sure that the pasid_entry does not go away when it is > > returned here? > > As explained above, it handles the pasid directory table entry which > won't go away. Okay, I think the goto is a good idea anyway, in case this changes someday. Please also add a comment to this code stating that the entries are never freed. Regards, Joerg