From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 2A21637C105 for ; Wed, 7 Jan 2026 15:28:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767799705; cv=none; b=A0hiB/5cuUZXl5+Vz7rV8eCDPhTVrWZk9K9V36Njs0eIKw+E7eoItX8O7GgLlRXE+c4hZjc8IVHz/6ZTtI5kVmo5ZLq5QwKgzg7CzQ+a7IOGrLtPOmLqQe+lqbw/Nn4JSb+7iGwkNvMS7dQHSmaDKuyAPrdqITUu/9yjx+Av7bY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767799705; c=relaxed/simple; bh=bEdTzVsCTnds/QEJ72cMK55QulTPOUsoFiergEmO5Ts=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=lXBizfC4VLRldkTOIL0kie2Lf3Mf6+ZcMkAMpHcIqr7b0oSQ/1EMQuRma7onIsv2rNcMK94pqYRfTqLkwWnwZRyaGRFR/z/9+t5LUFWYce0p3LlykLh//C55hQ1L55M9KWM0nYYm+w3GLjtNlxwZzAu9+4waIhU0A/o9RWBhWMI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=0N1HSlPV; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="0N1HSlPV" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-29f02651fccso90915ad.0 for ; Wed, 07 Jan 2026 07:28:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1767799702; x=1768404502; 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=zr78093NHGdBXXu/mjsoeuNUSxyi1KCAaesy3wXMOKA=; b=0N1HSlPVpv+Fr3aqLDvT9XoUw+QC+z94mafQdQ3XaMvea2G8y10r1OB72BFrx6nwr+ KoehJRy1+fAOAd/mo3UDXFUCx5+/ysvqYeMGVbaX7rfEf+HX+wcGrXF5pd1MVNUoaHFX tvJ/lc/kIiXRyqsaODLlGUPj1cSfe5ANhtrRFyog1I6fP3hHxM9PK68U+SGAKTHzhjq3 pmtisReOrQA3KX+CRCiZORq6MkWhgLWRKOEcUH2JYu5xI8QSs3b92wqIObTInWM31cJf Y1EtTo5RFRXFefWgfYF97oksTdP47ZfRtf1Uofdp7Hk1Axiop4ImUnUHdpg/5pgrqTzd I1Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767799702; x=1768404502; 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=zr78093NHGdBXXu/mjsoeuNUSxyi1KCAaesy3wXMOKA=; b=MYrOTUwDIndSUavczXX4l4ROZVnwKS45GmZVFgJ/bJkBQRfnJoKTGZW8eUlO1q00yN bMzkxXcaZO+yMPPf9jafe0qYG100ZhNhK0Nfk071CrbllOKqDFyBJER0QixvC84yvPBb Cif5rAA2o3MUNwBarSqZFB6Q+ENlUYNZ2skzsWGlCe6e6NI7/4RWC97tvHWsh08YKWOT O3zZcODrGIG5Vg/Ish2VLn4pLnxLgCTkCP8IShlrGDnoNTxfuSaC1ymtrj+EjpgdJfPG qstUTv6TmZ8dE8otNHArmi+adqm2RhbaC85DvjXDDTy2y6UemJRehFsnGgM9Od6030a7 bymg== X-Forwarded-Encrypted: i=1; AJvYcCXzM+orie/bPGRONmXo242djuWoS6R+dt9sW5WpV3dUZfN0u1gpTJ+9polBkOtM3+zb4TnHoTqtPeMKEnY=@vger.kernel.org X-Gm-Message-State: AOJu0YzjqvVDM2OKJsU5G0prhi+yGxNgU+eb03XzwQ16/G5Zrgk9U3gI Rt2ajGscPvkQbYRIcdk/VILtWjrVGFe/mmgBkNxxuP7+bU1KkgGYMKwgd/i6XHMUIA== X-Gm-Gg: AY/fxX53RCaUHdvOTUoUJrVimaHTmmxJYqThKIaZUE0u30LoArDF0dkUhLbq6Ehb0Ek k2+g7Ikyq9GCz/GZOUUvsP54J0xFkdgKyPDLODapvIPyBol3GThBnL72G42oHvth/bpuRY81HUl 57MuLRfEQ9JTJ6M4Vwn7Kf2xsSi2W6XSJCXm++0nhq4MBDncf2hJVQfWy/NylWjpugCFdWMXeCZ 2wnvEWG3FQPg09l2mi56kgxiZE6i8PDDb5schVTiVdB6P8BmYtBgzwgAf00RJGhxvl9JqlPdef8 RZ5aHyX+kZHtDZVsE31xZ8pKCIBRPqYyz4QZ54FvHzWPt7PEF72ut0lucadbzll4VaH/swXQG35 PY1zsNL4ThkzifyR5ARCTU0ObR/g+kbdbXMaytr7BOPewtDwJ0z2QrntHjRUGAqIVA/qbsdX4zi px6A0ixxJkndedQQ2nVXg/gCxAwPE1pGeBmLJQAKSNb7xfJszW X-Received: by 2002:a17:902:ea01:b0:295:28a4:f0b3 with SMTP id d9443c01a7336-2a3edab5490mr2722885ad.0.1767799701484; Wed, 07 Jan 2026 07:28:21 -0800 (PST) Received: from google.com (222.245.187.35.bc.googleusercontent.com. [35.187.245.222]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a3e3c5ce06sm53630535ad.44.2026.01.07.07.28.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Jan 2026 07:28:20 -0800 (PST) Date: Wed, 7 Jan 2026 15:28:13 +0000 From: Pranjal Shrivastava To: Mostafa Saleh Cc: linux-mm@kvack.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, corbet@lwn.net, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com, akpm@linux-foundation.org, vbabka@suse.cz, surenb@google.com, mhocko@suse.com, jackmanb@google.com, hannes@cmpxchg.org, ziy@nvidia.com, david@redhat.com, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, rppt@kernel.org, xiaqinxin@huawei.com, baolu.lu@linux.intel.com, rdunlap@infradead.org Subject: Re: [PATCH v5 2/4] iommu: Add calls for IOMMU_DEBUG_PAGEALLOC Message-ID: References: <20260106162200.2223655-1-smostafa@google.com> <20260106162200.2223655-3-smostafa@google.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: <20260106162200.2223655-3-smostafa@google.com> On Tue, Jan 06, 2026 at 04:21:58PM +0000, Mostafa Saleh wrote: > Add calls for the new iommu debug config IOMMU_DEBUG_PAGEALLOC: > - iommu_debug_init: Enable the debug mode if configured by the user. > - iommu_debug_map: Track iommu pages mapped, using physical address. > - iommu_debug_unmap_begin: Track start of iommu unmap operation, with > IOVA and size. > - iommu_debug_unmap_end: Track the end of unmap operation, passing the > actual unmapped size versus the tracked one at unmap_begin. > > We have to do the unmap_begin/end as once pages are unmapped we lose > the information of the physical address. > This is racy, but the API is racy by construction as it uses refcounts > and doesn't attempt to lock/synchronize with the IOMMU API as that will > be costly, meaning that possibility of false negative exists. > > Signed-off-by: Mostafa Saleh > --- > drivers/iommu/iommu-debug-pagealloc.c | 28 +++++++++++++ > drivers/iommu/iommu-priv.h | 58 +++++++++++++++++++++++++++ > drivers/iommu/iommu.c | 11 ++++- > include/linux/iommu-debug-pagealloc.h | 1 + > 4 files changed, 96 insertions(+), 2 deletions(-) > Reviewed-by: Pranjal Shrivastava Thanks