From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) (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 BDF0726F2AF for ; Fri, 19 Dec 2025 05:42:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766122962; cv=none; b=TR4i038fqe0wPSSmq7SEi6qWTlhaUxtc1W/wOs4ZX+jbfRVTzOFktCPUtp77QeoeGQRBjSufpVvzfR0ke1CtT69MOwLSpUxKjwPoVbW8Mn1vOoyC8gCX1PhcMnhfH/iFAZBeHXONEny67t8VhpAbqGZ+xt1hkgZ4TLiM/ioMF1Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766122962; c=relaxed/simple; bh=IEnkmMkvBLHbjCpXsYVUXQfPmf3NVslrHp9Qvjpb+dw=; h=From:To:Cc:Subject:In-Reply-To:Date:Message-ID:References; b=IkpWF7QUtgPqceo490ft0B0+AQP9P8sYCZsOCXMF3IXdSUPkvOTzwCC4rOTnW/jrZpIeoyDzpQj85UZsUVMKy0EnRZTPaEh4AJGhfORBspqClSgVoLatEaztanWptTut53rwctIizAgqPU2kUmw9vmbDKtZBP791c8fCkG78CIU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TIVMHVzf; arc=none smtp.client-ip=209.85.210.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TIVMHVzf" Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-7aae5f2633dso1413563b3a.3 for ; Thu, 18 Dec 2025 21:42:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766122955; x=1766727755; darn=vger.kernel.org; h=references:message-id:date:in-reply-to:subject:cc:to:from:from:to :cc:subject:date:message-id:reply-to; bh=3YZTuXKJS0jJ/FjWVkX1S0/dpihzlaBm67evQ8OxNp4=; b=TIVMHVzf80UtOLy3yfMtE3Vgfltrpx+uPHBdjn7XLOnyzztJRO8IUwWfBcNXRW/GdL VH4hQFJ5YmfFbnuG9nmMvmsXSFhNhjf0B0m40fdz55di93/8GTJKxRDoIA+EjhGwchdM xdK471r0j2fWAA5Ragz7jdneYFW8MCn0vMcYO1W5XtEVvLit/cmVlmwMS1AWTsmxfHTO Td9XNDvoQCkssMWKSx+H4mYi5iLufhsfVWxNq87UQWlLq9yFJqAntzbHeD2jkkTcWolr qZgH3mSqEnGLtUtx1ixzYDKB84HsCJBoeUAOe2ZnBUPreP/b1TgmwzJMp4aX4/EtZrUU 0S3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766122955; x=1766727755; h=references:message-id:date:in-reply-to:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3YZTuXKJS0jJ/FjWVkX1S0/dpihzlaBm67evQ8OxNp4=; b=DqHDojdN7G5L1z99R6kygnOJiGrRS78R6DcNKJkAl1U/P6Qrwb14fifufa6IsWirDy Iq2G8Y6U0K0nOg4f0f0YUaRJUeF+WM5dkNj/sPhjYvFl2pumQSzz6F1pBphKyM+SbiV5 UIDzP4A/4gp1AScoxb8AE8lQEq8A7Dib8yWctEbRBEInklUxnNwLgE2Vjzhj550Yzyd4 6OaCYdf+z8HdD1vldp1Ln5dZFfkHLZqKI0k5dx/gVS/ZUTLJNTxXFXsi/l4UU0EzYrTr /8a9ZrOReAxUNEmDQSnDxDtZXMHwd+2YspJtgR8S0ownMm9BaEbXjLIvjkzR+DtBeKJz 7wKA== X-Forwarded-Encrypted: i=1; AJvYcCVyeadLoNQIsUocWR5vHa81ZkG07TGgsj+eKslwzzhvF5UIQA1B0KJJQMct5MscqA9TRNcLThfvKzui7dc=@vger.kernel.org X-Gm-Message-State: AOJu0YyMJRjYkqETw+nwBvrZYuq1728XP/Z8RMwWgDJgPPlJ8gdLhJna EQj7d5OsLiwjlWcUMgVYiSN62jAERWwesy3H8puQkPufHK8akJWzfLEi X-Gm-Gg: AY/fxX4ul5ECYx8TjodlO2U3yRGyPOqZF5csbj2iB2yNObe5fhb76EKYBVcaa1zJ3Ml OfXi8AwUTqLm345ej1C5EgE3D7n8/JjIPqkytS0BXy3BNC+i6aslvsnCjhzwQ5u+NQ5IUMyZTZz IwZqIYMoi0t7cLQcdf0C/gtbzdLpFU9QjIN5DrRo/2dVbTm2MaUAY2AbBumGq+xXsAUUD8S7K4K 72ShQFSxdRjAIdOsrE4KC1etMMsQCZPgkbPbHde3jxKVg1CPDG17/WWs+Zc51suTxLyWcGrvZbE /IO2eT5D4AAMS+Mos8PuvMCX7ncvKSFebdVGUOxV6QiIF71cHomumjo3zQs5UkW1A4JlMekpb5H ujEL0LTsdu+7SbNJA7NYqmzcNhjvxIEZhfPRq2EJgA2an1H41FVzaeU/u1Ga6UfCr4gQiUIdeBG KgCtO3mQ== X-Google-Smtp-Source: AGHT+IGI8fuFuucCjImuX4l87nELJyNl9OPjlv6P1lULzof6E2V8PchTbygl/w/ZX4miaVw5gIXTMA== X-Received: by 2002:a05:6a00:414b:b0:7e8:450c:61b6 with SMTP id d2e1a72fcca58-7ff6607cf9emr1880110b3a.38.1766122955457; Thu, 18 Dec 2025 21:42:35 -0800 (PST) Received: from dw-tp ([203.81.243.211]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7ff7e0a19besm1067558b3a.40.2025.12.18.21.42.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Dec 2025 21:42:34 -0800 (PST) From: Ritesh Harjani (IBM) To: Sourabh Jain , linux-kernel@vger.kernel.org Cc: Sourabh Jain , Andrew Morton , Borislav Petkov , Christophe Leroy , David Hildenbrand , Heiko Carstens , Ingo Molnar , Madhavan Srinivasan , Michael Ellerman , Muchun Song , Oscar Salvador , Thomas Gleixner , Vasily Gorbik , linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-arm64@lists.infradead.org, linux-riscv@lists.infradead.org Subject: Re: [PATCH v5] mm/hugetlb: ignore hugepage kernel args if hugepages are unsupported In-Reply-To: <20251218114154.228484-1-sourabhjain@linux.ibm.com> Date: Fri, 19 Dec 2025 09:45:06 +0530 Message-ID: <875xa3ksz9.ritesh.list@gmail.com> References: <20251218114154.228484-1-sourabhjain@linux.ibm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Sourabh Jain writes: > Skip processing hugepage kernel arguments (hugepagesz, hugepages, and > default_hugepagesz) when hugepages are not supported by the > architecture. > > Some architectures may need to disable hugepages based on conditions > discovered during kernel boot. The hugepages_supported() helper allows > architecture code to advertise whether hugepages are supported. > > Currently, normal hugepage allocation is guarded by > hugepages_supported(), but gigantic hugepages are allocated regardless > of this check. This causes problems on powerpc for fadump (firmware- > assisted dump). > > In the fadump (firmware-assisted dump) scenario, a production kernel > crash causes the system to boot into a special kernel whose sole > purpose is to collect the memory dump and reboot. Features such as > hugepages are not required in this environment and should be > disabled. > > For example, fadump kernel booting with the kernel arguments > default_hugepagesz=1GB hugepagesz=1GB hugepages=200 prints the > following logs: > > HugeTLB: allocating 200 of page size 1.00 GiB failed. Only allocated 58 hugepages. > HugeTLB support is disabled! > HugeTLB: huge pages not supported, ignoring associated command-line parameters > hugetlbfs: disabling because there are no supported hugepage sizes > > Even though the logs say that hugetlb support is disabled, gigantic > hugepages are still getting allocated, which causes the fadump kernel > to run out of memory during boot. > > To fix this, the gigantic hugepage allocation should come under > hugepages_supported(). > > To bring gigantic hugepage allocation under hugepages_supported(), two > approaches were previously proposed: > [1] Check hugepages_supported() in the generic code before allocating > gigantic hugepages. > [2] Make arch_hugetlb_valid_size() return false for all hugetlb sizes. > > Approach [2] has two minor issues: > 1. It prints misleading logs about invalid hugepage sizes > 2. The kernel still processes hugepage kernel arguments unnecessarily > And that every other architecture will have to duplicate this in their arch_hugetlb_valid_size() whenever they face the same problem. Instead like at other places, hugepages_supported() should also be checked in the following cmdlines setup functions. > To control gigantic hugepage allocation, it is proposed to skip > processing the hugepage kernel arguments (hugepagesz, hugepages, and > default_hugepagesz) when hugepages_support() returns false. > Right. Thanks for taking care of it. I guess after this patch [1] moves hugetlbpage_init_defaultsize() to mmu_early_init_devtree(), it's good to bring back these checks in the respective cmdline setup functions which was removed as part of commit [2] [1]: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=2354ad252b66695be02f4acd18e37bf6264f0464 [2]: https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c2833a5bf75b3657c4dd20b3709c8c702754cb1f LGTM. Please feel free to add: Reviewed-by: Ritesh Harjani (IBM)