From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f173.google.com (mail-pl1-f173.google.com [209.85.214.173]) (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 BC8502EDD57 for ; Fri, 9 Jan 2026 07:34:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767944085; cv=none; b=aFELptJw9um7jK8QkHbqa8gBQKLuXByzHB8ULcrd6etDaD9Ebyo+9SdhVAfsYWtUdzxWpNbzKCPqXHV+dEO2GarOZshurutfay3kDIXAfHIjBCKqTfzfjIT5eNmw9FIKt0L7knuXCnsdn15oWRRKxI5kIW3XY3/syLgVVy7ly48= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767944085; c=relaxed/simple; bh=mQNQDvbKwm8YPQMvUQmrODeUWbj93d6ac4BYkM5iRJo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XmM7vaIO2H1wP9Sa9+HGv1ELlzygjjqtHVtngezmI5NH3Si72veh3jINTUo49DASbRq8Uv09ZKUuMp3zsiP+r+YaN/e7/LjN0n1dEpBwihTLAOVdfSG+9ArpKjIFXKB5KNgME4vb5zJN/efE1i6H5BBOzurNs5pdnnNRzqnSAfs= 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=lJ22hgpI; arc=none smtp.client-ip=209.85.214.173 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="lJ22hgpI" Received: by mail-pl1-f173.google.com with SMTP id d9443c01a7336-2a35ae38bdfso37715ad.1 for ; Thu, 08 Jan 2026 23:34:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1767944082; x=1768548882; 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=nXFThduoh/FW3X3hmcDPgZVUcXZLVLfg8hOMDEL1+OI=; b=lJ22hgpIL7NdHgLtTdZqYos1vlk1LC3oxTYeHA+ZrRHYxS7OZ6hNZM67Kag7vKFU9E psF5Tu9HiaLLeIat7smu+0q3PvwfHO4xkttnEeqkvErCKzkg9Z6/HMAj5Dt8p0I+at+D NJzo50KAJTLHxzfv+/VC4P+vFS9T1coK0DdRq/bZ3xCjpvEfK8Rgx2STluQ0Wz8kxb1j rjzfCMx72oy+gViRp8nxZICuUlqtciRr6icFsZ5kjwHd63UYIwDyMQEE90XhXJ243NAR nB+FvIYnb4FXHzeYzfuxA9KQvd2fUsghJEGwhpIpkVFbwX9yY8CvWjmp6Rgbj0gB/7PR BTVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767944082; x=1768548882; 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=nXFThduoh/FW3X3hmcDPgZVUcXZLVLfg8hOMDEL1+OI=; b=qq/uxiU5ABeeHCamxMxQm3BC9J/1wCsQ243ikdXZ35b5THianeBJSjzKgcvt4iDm2N F4L+tkzRpNlwg1PGkWj/B3/f9x3gHg1EG4GxBEOKaJQ8PddPjBGtCU2B3tZBMdTODoYZ 8q35YP2KlL7AXXfJXU6o4YnGHOASvD6Kvnq8Z8rWMoK8Ci61n04oKaTvVf4R3K3hSlN6 IcVdBc+hGpUOjkOUOfC7z+1f0vhkZKNiSoECubgtQwpRjOOnLfJ7oaTKVaaphWOseFeH 9BkUJ6HpL/GoWhHfvj6S3N7+Qw4BN+yotYMQFuzDfhNlbiCZPmo+ePjUl58JagaJVw2e esow== X-Forwarded-Encrypted: i=1; AJvYcCXbkE6BzvpjqH8YuLqm7BCEBBk7clP7Ot3bAytnPdhnWO/cfHvTGwr9td7ZdCvtG4oCJZCIl4XcdzCGWn4=@vger.kernel.org X-Gm-Message-State: AOJu0Yx6rNLfQbklb5yKCPIhuU0JkQHJJqAT2Js+M+FPQbqrk4DSMD7a 6BenJACXyc5wKDmpIKYTkn9kgSskiVeXnASFyvjM3eupIxg4tV5oMpQXHLB8J0M6HA== X-Gm-Gg: AY/fxX5h/Co3J8ANXTUBYkSIQf0fSiNKQxJ0WTWMB0HDMkF/jqoUKUa5QtDLlIa7z9K He365L/i8k5p6JSoeuGxgwPUpwLGk3t79eCsCa2XdGD1/1NioOV28mr/Iu788Bt4ef30YCWYnXG WNip51+hnPtQqIbAwH8+GiXmRguhPQgG8e1s+kIA8BPXfHITQxOeV236voJGbbqGZA4ouPgGzD8 L4QJZS5cYYveou9bZJ/ZRPXLWUDGKBYSJOiOw2qeL7hsZxwgOlh80XSC4QItTkObVCLS4ss8ndB 5qtbYvg8AECOgjTNztvQbs2OPFeRuxvnKCKJMH5LjIZEd/h06vo3CC4eQlt/EVHhr1wNN35wW/n 2F/RgPuiQPgdXzIVtmnbRq6Cy4a+8RetDXqZGxLGNzIeEUpik6OgINVjhLhtuvJjDugb22cFk6x 4s/RyLZ3yUhLrdyMif6kn29F7BuEsBlA1g4+J2R+pfHH3Axm1S X-Received: by 2002:a17:903:228b:b0:2a1:3cda:8e98 with SMTP id d9443c01a7336-2a409adbb36mr2245665ad.20.1767944081624; Thu, 08 Jan 2026 23:34:41 -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-2a3e3c3a560sm96327345ad.21.2026.01.08.23.34.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Jan 2026 23:34:40 -0800 (PST) Date: Fri, 9 Jan 2026 07:34:33 +0000 From: Pranjal Shrivastava To: Baolu Lu Cc: Mostafa Saleh , 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, rdunlap@infradead.org Subject: Re: [PATCH v5 3/4] iommu: debug-pagealloc: Track IOMMU pages Message-ID: References: <20260106162200.2223655-1-smostafa@google.com> <20260106162200.2223655-4-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: On Fri, Jan 09, 2026 at 11:28:32AM +0800, Baolu Lu wrote: > On 1/8/26 19:33, Mostafa Saleh wrote: > > I have this, it should have the same effect + a WARN, I will include > > it in the new version > > > > diff --git a/drivers/iommu/iommu-debug-pagealloc.c > > b/drivers/iommu/iommu-debug-pagealloc.c > > index 5353417e64f9..64ec0795fe4c 100644 > > --- a/drivers/iommu/iommu-debug-pagealloc.c > > +++ b/drivers/iommu/iommu-debug-pagealloc.c > > @@ -146,16 +146,12 @@ void __iommu_debug_unmap_end(struct iommu_domain *domain, > > if (unmapped == size) > > return; > > > > - /* > > - * If unmap failed, re-increment the refcount, but if it unmapped > > - * larger size, decrement the extra part. > > - */ > > + /* If unmap failed, re-increment the refcount. */ > > if (unmapped < size) > > __iommu_debug_update_iova(domain, iova + unmapped, > > size - unmapped, true); > > else > > - __iommu_debug_update_iova(domain, iova + size, > > - unmapped - size, false); > > + WARN_ONCE(1, "iommu: unmap larger than requested is > > not supported in debug_pagealloc\n"); > > } > > > > void iommu_debug_init(void) > > How aobut > > if ((unmapped == size) || WARN_ON_ONCE(unmapped > size)) > return; > > /* If unmap failed, re-increment the refcount. */ > __iommu_debug_update_iova(domain, iova + unmapped, size - unmapped, true); > > ? > That's nice, We could also print the message as Mostafa mentioned, like: if ((unmapped == size) || WARN_ON_ONCE(unmapped > size, "iommu: unmap larger than requested is not supported in debug_pagealloc\n")) An explicit "This is unsupported" warning makes it clear IMHO. If a driver triggers this, at least we know the sanitizer state isn't supported. Thanks, Praan