From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 BD6972E973A for ; Tue, 25 Nov 2025 09:42:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764063772; cv=none; b=VeBe50q7qvPC/5T3XBntC0pUy+LRcA7gWZH5954DwQRGsLw3Y32OoaiZsGe+DCw4PzVF7vm/EIG71bq9a9yCxubNct3k8YHLt160XJRNovZ+dbxggdlDjo0waPnbmpmFNvI7GQA0vpVGVL7pM6X2dHjQBq3NAftNrRxEkbC+Ys0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764063772; c=relaxed/simple; bh=pYU70KDOQGpxoP29DuTiODNRi+qhfpeRaagOh+suD7s=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=XmBGk/3D4G7M0SN5VLZFsj7NiVVtpduAiwlzlezrXS9bPZZumIZjBnXMTFnmoRWDN2jj1U8UO4Qy3+N2Zxbln2l8MNO0M1qUBhsMt8buiANWgzgDEMRcKdNUxz2fSF1MSFGjRDvce4cCYPGx4fnMFA8nKnsqQ9+ouEj/d1PNUWY= 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=mAH61eZ3; arc=none smtp.client-ip=209.85.128.44 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="mAH61eZ3" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4779a4fb9bfso47685e9.0 for ; Tue, 25 Nov 2025 01:42:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1764063768; x=1764668568; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=gCXHGSoCQLbBnbJkgfyqXAP9QKSn53WdyAoVSewwZH8=; b=mAH61eZ38FQNZf9NYAcvlfwKw9jH2snY4fdJNhUegPonBan5i/SdVkW1Q2BmXSHIDQ e21K+7juYh1MdFiiS33Tf3+RuTC+C0t8hEWPLADFu5I3EKokAwX/eL01nuGb8/sIGhXd X+lYj/5gi/nNmvDcdRLT3rqUROJEFhevfoEoiK933Eq/dQBRnIsgLiT8zztEBkqa0x5Z eqW5k/ak2kAbFUi8E4aJ83Z2NaWzcTDcNmmHz8/brWTqvsKybjVEobPMHYLXBLJpzcPO 3ea7o7m5vH+Ih5TvmMD/5eMSK+UrjL4g8BDjh+K6VuzHr2NCDL4noKelI2jxtVKgfzKV yFlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764063768; x=1764668568; h=in-reply-to:content-transfer-encoding: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=gCXHGSoCQLbBnbJkgfyqXAP9QKSn53WdyAoVSewwZH8=; b=YMV4n0czWbu8K5/lbrOzA4ah8kDNTvXymoPsjnIjWa6MKOyNNnDFvBhIvf67+YBjxs MXzARqiMNE8CqE3Qrsy8OH/Ow/ZCjmXwqy9o5xmKQb0lE/QYu06hhB63NKqhz1tHr70U +w60z7srx7/cgOf8D7+oE8YKxqeMPAO2HieAM/HlE6h2U9ccQPc2db4KhDH65RwS7Qut kyDvWLEGuaiGGdRPAdttxbAgRsciFAg/AKsZ1b/G5qM9OpkWkVR580gpq4DczTigwu+n wnfKMYf6iR6vMG/3eFRnyOnrAsEuQhdmFE4ZPXeQYkKzB6DxTslp56fZTe7Z7zGBDSgE iz7g== X-Forwarded-Encrypted: i=1; AJvYcCXnaDxnT8QMEcKl0vx8VtcgDss6r9z5Z8gNdEgecviVqpbXW8GjYwF1sA77OSC6TXCUJtIB2wEo9JgmcO0=@vger.kernel.org X-Gm-Message-State: AOJu0YwL3I/87ikTh4lXzboiL5ohnZrih0JV7S853haafic+Fx1FxeyJ /Twh8RiO52no5/42eopBg1houfbbJEmklEeY8x8T/gbo6Ngs2IOHnfP65gvr/z6H1g== X-Gm-Gg: ASbGncvbHk21S8zE8q6ATgB2ZqseDCjZkGv08GqrbLQi5I6CJZkfg3D9kiZCKxdA5O5 CsvxoM5hm6/4gw6X1RXn4NtYJLhkbkG43gxhszAxKJJq6FX/UefnqWRjD2SkUWKg1kc6F1PY46j pQ+MoXHNMQpdne6Si9sFC1FTZLgf5kjU96KIZTrYLfhxFJMVPhBT82lXpmt7Cbnio241eq/PcPM FOi0btvuF1Q1bYXWW5O7U+4R6HIlB4TxRL/Y5XDhvSfTC7QjJujfW2+ikxHly2iXGUJq99HFmJF Cm+qXjvy7FavNfd+nJvQ4X9le2bjYdOpU1NmZBdeD9cztYjfjor54rBR4YdAN2Ek91hyCZ0egfg zBCCAOi8aeudRr2XHC36w54BE/6PX6XLby9kvlGTLgyX4qH/6WxqjX8Z8/vbqFbRChKS6QbE5e/ Ge9MTN8iAePuCmTBaGJunN3P/oQUmuprubXbyMaWNq8GjLkGne8pH0E7sjS3HE X-Google-Smtp-Source: AGHT+IEnhOrLJGeXT6QUokA3QYFoyH54rP3priqnpDd397EAHhk3ibEBNXSKphd8QyA5DX/xXbjC9w== X-Received: by 2002:a05:600c:3582:b0:477:95a8:2562 with SMTP id 5b1f17b1804b1-479068fa210mr331535e9.13.1764063767841; Tue, 25 Nov 2025 01:42:47 -0800 (PST) Received: from google.com (54.140.140.34.bc.googleusercontent.com. [34.140.140.54]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-479052d95absm11951115e9.5.2025.11.25.01.42.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 25 Nov 2025 01:42:46 -0800 (PST) Date: Tue, 25 Nov 2025 09:42:43 +0000 From: Mostafa Saleh To: Randy Dunlap 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 Subject: Re: [PATCH v3 1/4] drivers/iommu: Add page_ext for IOMMU_DEBUG_PAGEALLOC Message-ID: References: <20251124200811.2942432-1-smostafa@google.com> <20251124200811.2942432-2-smostafa@google.com> <7854489b-bc9e-4bb9-a19d-cff96badc180@infradead.org> <5d7a305e-d6b6-49dc-ab1d-bddd1339d4a7@infradead.org> 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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <5d7a305e-d6b6-49dc-ab1d-bddd1339d4a7@infradead.org> On Mon, Nov 24, 2025 at 05:31:12PM -0800, Randy Dunlap wrote: > I missed one other thing: > > On 11/24/25 3:13 PM, Randy Dunlap wrote: > > > > > > On 11/24/25 12:08 PM, Mostafa Saleh wrote: > >> Add a new config IOMMU_DEBUG_PAGEALLOC, which registers new data to > >> page_ext. > >> > >> This config will be used by the IOMMU API to track pages mapped in > >> the IOMMU to catch drivers trying to free kernel memory that they > >> still map in their domains, causing all types of memory corruption. > >> > >> This behaviour is disabled by default and can be enabled using > >> kernel cmdline iommu.debug_pagealloc. > >> > >> Signed-off-by: Mostafa Saleh > >> --- > >> .../admin-guide/kernel-parameters.txt | 6 ++++ > >> drivers/iommu/Kconfig | 19 +++++++++++ > >> drivers/iommu/Makefile | 1 + > >> drivers/iommu/iommu-debug-pagealloc.c | 32 +++++++++++++++++++ > >> include/linux/iommu-debug-pagealloc.h | 17 ++++++++++ > >> mm/page_ext.c | 4 +++ > >> 6 files changed, 79 insertions(+) > >> create mode 100644 drivers/iommu/iommu-debug-pagealloc.c > >> create mode 100644 include/linux/iommu-debug-pagealloc.h > >> > >> diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt > >> index 6c42061ca20e..dddf435a1c11 100644 > >> --- a/Documentation/admin-guide/kernel-parameters.txt > >> +++ b/Documentation/admin-guide/kernel-parameters.txt > >> @@ -2557,6 +2557,12 @@ > >> 1 - Bypass the IOMMU for DMA. > >> unset - Use value of CONFIG_IOMMU_DEFAULT_PASSTHROUGH. > >> > >> + iommu.debug_pagealloc= > > Please note what format the option parameter value takes and possible values, > like iommu.passthrough above here in the kernel-parameters.txt file. I see, I was following the kernel's “debug_pagealloc”. Although, the implementation understands “={0,1}”, I can add something as: Format: { "0" | "1" } 0 - Sanitizer disabled. 1 - Sanitizer enabled, expect run-time overhead. To make it more clear. Thanks, Mostafa > > >> + [KNL,EARLY] When CONFIG_IOMMU_DEBUG_PAGEALLOC is set, this > >> + parameter enables the feature at boot time. By default, it > >> + is disabled and the system behave the same way as a kernel > > > > behaves > > > >> + built without CONFIG_IOMMU_DEBUG_PAGEALLOC. > >> + > >> io7= [HW] IO7 for Marvel-based Alpha systems > >> See comment before marvel_specify_io7 in > >> arch/alpha/kernel/core_marvel.c. > > > > > > -- > ~Randy >