From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D4762354AEC for ; Wed, 14 Jan 2026 11:12:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.49 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768389170; cv=none; b=U1BZrD9Cs7VGRvY6TTRcMSoOknfMZWZBMQniD6wnhlw4A1mFjRbaPO8hwuQUjD2Xc0QsX3jCnEFtoeK4tfJSU0OhMG1bMR1n6gd/sJrQBv0wHWnNbx+LHxLBVtt//bbTv0TafrbOzM3bnRP+ZKSDGn1pVGk1D2nSlS9KWLvnZLo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768389170; c=relaxed/simple; bh=YiiIXB4m376SMBEYw0oDLToDNFi4w0vs0fNtZFVXXAg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bvfMrMf7a75FnxW4HcoyuPBhub7L5vr7FG3SjvK0uxPYBNpjTLEJjK+kHDI5br/ovQqouCznTmxyVQ/zce2ltEaSUPdOB/Cc7CQs65j+0EJV+j1CmWNQxaCehB6fbPPMUiR2K1zpygQzAkhAijR0J7CY3+fkgqCU92Lu6jPb8QY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=lwSZd0mv; arc=none smtp.client-ip=209.85.218.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="lwSZd0mv" Received: by mail-ej1-f49.google.com with SMTP id a640c23a62f3a-b8708930695so573422166b.3 for ; Wed, 14 Jan 2026 03:12:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1768389167; x=1768993967; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=xuErrEDD6LEKFLnxAkiNejSn6LYGgcXZoCz48zROcO0=; b=lwSZd0mvbl9mFD9pVd/uyKMynBIjF4fJbSb8XCYsyZyOlXVqbBfY+SRFxwdmAguGAv KDxX3j7xkBRtc7i0LH3cbOBLaota8dlUomSVMPPDUZjcdAOkXu8+xU/jlhVs7aBwEDF6 RQaLJyH+g/bIWl81TaB7Lng7j4xcbNLccRln4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768389167; x=1768993967; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xuErrEDD6LEKFLnxAkiNejSn6LYGgcXZoCz48zROcO0=; b=h51TMYWo3DVzMT0SCl+Ti/Pguavw3wd1bewhK11JAwUbUw2pYYZOkb4Gf0DYqEJUG2 fzqAmuV44pzU49ZqGoCEEkmZEcG0ybCdrLt6+OF/Zh7Cg2rh5WHuSbNi2CR/NALesoui Qa2VsMSXpOhvp1RihKIY3Kho4FbfgExk4MWz44ljFAKi+tsHnW3hF/QIp9k7e3Jo5Xiw Q/DJUFuN7Hdx1KdgfV6BQfA1UP9sY4sTMP09ppD0/FskA2UyCLxkH6pHQJiv5vhqBh0j j8RXf6RUHXC/36/E3R+fttXHqBY9mdw1Ao0EX/SlY2Mj5RwG6TvyWseFJJeED2d21zyh GkSw== X-Forwarded-Encrypted: i=1; AJvYcCXrX6xFFaC+yUPikvMzmHLquuCGQuqr2A3NpmJGN3G+GumL9AsHKDUJNSLHsRtaulphqVrE2VrDr1nfnvM=@vger.kernel.org X-Gm-Message-State: AOJu0Yyq/m/PnRM96PqTJ4XknOzvSZq+hdYrRZ/csneZbt1X/LsyQPC7 RaVW1RlttUctZJToPbekG+fuvFgBNdJYwyXWCpeUj7fy2it6RQTLxdQxUo+//6fODg== X-Gm-Gg: AY/fxX6bVnOf02zvUBPv96RTuw9ZpF4658j+rEiKUCqSC30kptzHpZTo2idDPXt8wux CjUar5pTcBr8qjp0erCJzfSeW1d7wXltXJC8adJ0RSK/JBRgmQvM0V5NVin0G9qFNiC89KoC0cd wagqy1iaU1p3Tv+9qm1K7fhezf5spwCgTWCEvcuz8DE/cMjzMJ7xkseORjQJRRHH4IalDd/zeJQ FtA8HwE6xzFc8wQ2rhIL44nSIWTxU8YWt7Liyz7huH7CHFAEdb0TkgvJPpHqEfAXOBPD2EXv7DM oYauc1/hf3gGNV4ICNOstYX2hwM8f/XSSD+Z6AnoOk1zUliO/85ZHomXvADiFb0+FZdEe+9SPKJ UPF1a9h+ALGJrNYOALf2JzzMhNZC8s9Wd4tKdR1AWIUNki5WDw2iG++jq1wuzj8ByXNo8+w/nCi 0PYFtmIOv0TufYzvtBMkLF X-Received: by 2002:a17:907:6d19:b0:b87:892:f43f with SMTP id a640c23a62f3a-b876108019emr184539366b.29.1768389167032; Wed, 14 Jan 2026 03:12:47 -0800 (PST) Received: from mitya-t14-2025 ([2a02:a31b:20c3:6680:8f9d:1786:e151:a9f5]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-b842a563f0esm2532511266b.60.2026.01.14.03.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Jan 2026 03:12:46 -0800 (PST) Date: Wed, 14 Jan 2026 12:12:40 +0100 From: Dmytro Maluka To: Baolu Lu Cc: Joerg Roedel , Will Deacon , Robin Murphy , Kevin Tian , Jason Gunthorpe , Samiullah Khawaja , iommu@lists.linux.dev, linux-kernel@vger.kernel.org, "Vineeth Pillai (Google)" , Aashish Sharma Subject: Re: [PATCH 2/3] iommu/vt-d: Clear Present bit before tearing down PASID entry Message-ID: References: <20260113030052.977366-1-baolu.lu@linux.intel.com> <20260113030052.977366-3-baolu.lu@linux.intel.com> <8e232d7f-9436-401e-9abc-308492a1fcbf@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8e232d7f-9436-401e-9abc-308492a1fcbf@linux.intel.com> On Wed, Jan 14, 2026 at 01:38:13PM +0800, Baolu Lu wrote: > On 1/14/26 03:34, Dmytro Maluka wrote: > > On Tue, Jan 13, 2026 at 11:00:47AM +0800, Lu Baolu wrote: > > > + intel_pasid_clear_entry(iommu, dev, pasid, fault_ignore); > > Is it safe to do this with iommu->lock already unlocked? > > Yes, it is. The PASID entry lifecycle is serialized by the iommu_group- > >mutex in the iommu core, which ensures that no other thread can attempt > to allocate or setup this same PASID until intel_pasid_tear_down_entry() > has returned. > > The iommu->lock is held during the initial transition (P->0) to ensure > atomicity against other hardware-table walkers, but once the P bit is > cleared and the caches are flushed, the final zeroing of the 'dead' > entry does not strictly require the spinlock because the PASID remains > reserved in software until the function completes. Ok. Just to understand: "other hardware-table walkers" means some software walkers, not hardware ones? Which software walkers are those? (I can't imagine how holding a spinlock could prevent the hardware from walking those tables. :))