From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) (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 0BAA833BBC5 for ; Fri, 9 Jan 2026 11:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=209.85.160.182 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767956568; cv=pass; b=Qe0FCMQW9z8sO4k3lzeS6rkK8L7jG7gULzR+Lf323PZY/sZ+duYHvR9wG7TjzLGvOGHzQ1u4Fth4nOXVZ1tRYyMgWyKhMyl/UH+WUMpaiFMs1nlFdjlmDffvAlgkPOKLO8BZf7WTrsC3NwQ2Es8IvDYoGUhJ58M6Cn+xXCuRdnk= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1767956568; c=relaxed/simple; bh=rFk7TLciArdXVmOhSyBT7/Ns+M/k6PPCPRzU7n5m4kM=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=WbGDCu+z1ei3QlEBdvWX2MGs09D0+vj8JpfiHl1eYvtHSWwad+RN8K6GmIDU80//vYOejPw7CKVRKPdNB8uVvWjnUgMeNWaKS4fXyn2YNd0uA/1nBTNk5KnsUVLKTDR80N3QkqqRsiCciw1MVYFcaH7TVb6G9/vhlTKmpRXCZjA= ARC-Authentication-Results:i=2; 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=2YQ6riMQ; arc=pass smtp.client-ip=209.85.160.182 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="2YQ6riMQ" Received: by mail-qt1-f182.google.com with SMTP id d75a77b69052e-4edb8d6e98aso445021cf.0 for ; Fri, 09 Jan 2026 03:02:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1767956566; cv=none; d=google.com; s=arc-20240605; b=dqpTNKJOw0tW1OZaPjXixELpQD4TaK/+tNbq/yeZdu3hkfDmJbHHwNP7HMU2e4wYLd xlOON35KKxFSaddU+lI5QAGUCsjBxreidCDBSvnjRTXBD1JgAE5XcsiVFy/GQN47Y03C QSilec/ErzTiN50lsnbb09+cCI7QPP740n71uLQ6ek1l94RisehceU5IRCwu+PyW92tb imd9fVDIHB5W+Ydv+UoVEwwgUvMSt6EOzZNzGaVoU+nWXI1ADnoV/5Z1IaHcLeUUn47E WIQKlegmBevtTQDV+Suh28Gu4oYXG+ot9wsRhL56zSgSrA3eO0MfdqbLy66bz7bUQUOb KY8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=jzCiSHIGOYpa7t9zzF/wcFfKhZV6nLFk0KAKRqVw7HA=; fh=ZyDmpNXQ7yZzWK00y0/0gyYQs0yx5d9Xyv7wiOAaOJg=; b=UlxN927LbLqYiNGPvC742fsCdVZnEFOL92ckKn0Q4KwECgFhR+OxlJLXJcaQBsQ2Ko xQsjf0m38ve0svtWnP08EI4A7N3PJHVmuwqGviHps/Gt/1g5SWkyDmPxEUtYWoNr2nOJ ZGsVVpt3SbErWjjIyyUIuNFp0xrN6NGZOi2UTvAhSASrcpp0/wvImT3aGYiwEhytDhjd e1V/NhogAGNa2FFuxsXT/PE2ecwo4DX2izv0ZurvVQ4ffWPL8dHE6o46g9+twPx1ifMm h2vSabftyeP7QXDV61Sh8n/vnmx3hqVh2ciWSCTzDqqK3R9yBBQCvmQZmAxqxDXTga5B yiVw==; darn=vger.kernel.org ARC-Authentication-Results: i=1; mx.google.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1767956566; x=1768561366; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=jzCiSHIGOYpa7t9zzF/wcFfKhZV6nLFk0KAKRqVw7HA=; b=2YQ6riMQwSurlT6Ik8ArklxCNMoArKWel5qSfrfXltMvkcetL3fggwJEGQNCL/+Ror LReNi0+gDAvsiKl/GUxoR7GAQwRaabE4t1hn85ABABBWpksL6D+susKDyqsGT7JMIyKI nYHPuV+QP6Ya/BvukGs3Z/KGU8hZSkt4EMZXCGQCTLsT39cNLYMjIumn5qaI1zA123MM w9L4IEaHFUmQhszGWz1nLRJeUsvryH27zgs0X0PDCWb2nTIGLPTXLchP++fQO7uVzsU8 SFqEr1IBMkY5V8RQ409eoVBvTsZt0gBYNxcTTZeTg7/H//l3mGxK0m14lqultmjOocun W4Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1767956566; x=1768561366; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=jzCiSHIGOYpa7t9zzF/wcFfKhZV6nLFk0KAKRqVw7HA=; b=dzU0U6nnypUoSW4pQu2phIiL18P3Sv2cUAM4BwuawSU0E6gdpBY0HKKQRAKzO5uyaQ 0E2fXvaQTR7bN395po5Zz+EnYWKc+I5qYTnz/PgQXCbi7yXuWuTRHTmbSoXd3/Uco54Z M63lQ+kdiYtO57pPkU04Wz1cJMNf+dk2N8VTbJHXn88sfsUL8ye+hlWeefsQcQbuKqpY oHMuS2x4WJiKyVk5OIudQzt07P2gOO1ri5GfDraBpCGbuWYDNQMLUwKicHwKJjmAThIq cBxsBYqXA8F1d+tSElaADgmGkGtAUdJ0yJXiHS6SrfRSMOsJg9hYAYr7RZlEswoVS6JL 1oXQ== X-Forwarded-Encrypted: i=1; AJvYcCUgz3J+CKWmcD3hbsPxGLt89WuGPb8e9HIgwb70cDCvjZmQi7i/yIkLKSZ92yU45tGdhX+Nj7egG2gA8M0=@vger.kernel.org X-Gm-Message-State: AOJu0YxA1wxjMIC7N3+6QErmsaEArK1DRj3MXwOBO4WGPSMc7lUyJGBu B65R4Mb2YzLTPJZMzz6XiBjaaqoI60BSZ6xqpPjlc5qjQLluZtxrx798e2hnbSKxcbZtrV1Ius2 kCLvexKveEo5VHe21OSs4Pj1zctAnv7jf6n30vzzX X-Gm-Gg: AY/fxX4ytJFOl2vcGBPSaJYDVapvBtK0YaCx6rL2pDqCBOhfvwXqwi0+jjHeJCxUNkO AVN+jMeFaOzKbzgI/sCPqeF9bnQNOLKu9k11n9Iwg0eShY9qePaypg5O4TineYz1v1AsBTr2IXu CD4s7jkranK9Eqlf9M2M6z6FaZoIwh/WZzlxGOwMGnUaPIddLRvjObKCS4mVewq/F07PppXuOqS QuM14v3en82XRq2bxIUqp3ERQWIkDWmE0+/pHG/a7E6ojuSZmU3285W7gn7qYmTYdvP1Z/F7Vtg Bak0lYDsLPhIdLTyQ50KvgbzedDUIJIZQdQuyMe1 X-Received: by 2002:ac8:5d8d:0:b0:4ed:70d6:6618 with SMTP id d75a77b69052e-4ffca3899e0mr9525541cf.10.1767956565345; Fri, 09 Jan 2026 03:02:45 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20260106162200.2223655-1-smostafa@google.com> <20260106162200.2223655-4-smostafa@google.com> In-Reply-To: From: Mostafa Saleh Date: Fri, 9 Jan 2026 11:02:33 +0000 X-Gm-Features: AQt7F2oqTpF_L8hxvj3t4iE4ZAXrurkscrS9S6zaVPP7N-l_qQbRFrZajZBoJoU Message-ID: Subject: Re: [PATCH v5 3/4] iommu: debug-pagealloc: Track IOMMU pages To: Pranjal Shrivastava Cc: Baolu Lu , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Fri, Jan 9, 2026 at 7:34=E2=80=AFAM Pranjal Shrivastava wrote: > > 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_domai= n *domain, > > > if (unmapped =3D=3D size) > > > return; > > > > > > - /* > > > - * If unmap failed, re-increment the refcount, but if it unma= pped > > > - * 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 =3D=3D size) || WARN_ON_ONCE(unmapped > size)) > > return; > > > > /* If unmap failed, re-increment the refcount. */ > > __iommu_debug_update_iova(domain, iova + unmapped, size - unmappe= d, true); > > > > ? > > > > That's nice, We could also print the message as Mostafa mentioned, like: > > if ((unmapped =3D=3D 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. > I guess both are fine, the WARN points to the line which should be simple to deduce the cause anyway. Thanks, Mostafa > Thanks, > Praan