lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240207225632.159276-3-avadhut.naik@amd.com>
Date: Wed, 7 Feb 2024 16:56:32 -0600
From: Avadhut Naik <avadhut.naik@....com>
To: <x86@...nel.org>, <linux-edac@...r.kernel.org>
CC: <bp@...en8.de>, <tony.luck@...el.com>, <linux-kernel@...r.kernel.org>,
	<yazen.ghannam@....com>, <avadnaik@....com>
Subject: [PATCH 2/2] x86/MCE: Add command line option to extend MCE Records pool

Extension of MCE Records pool, based on system's CPU count, was undertaken
through the previous patch (x86/MCE: Extend size of the MCE Records pool).

Add a new command line parameter "mce-genpool-extend" to set the size of
MCE Records pool to a predetermined number of pages instead of system's
CPU count.

Signed-off-by: Avadhut Naik <avadhut.naik@....com>
---
 .../admin-guide/kernel-parameters.txt         |  2 ++
 arch/x86/kernel/cpu/mce/genpool.c             | 22 ++++++++++++++++---
 2 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt
index 3a1fa1f81d9d..62e7da4d9fda 100644
--- a/Documentation/admin-guide/kernel-parameters.txt
+++ b/Documentation/admin-guide/kernel-parameters.txt
@@ -3135,6 +3135,8 @@
 
 	mce=option	[X86-64] See Documentation/arch/x86/x86_64/boot-options.rst
 
+	mce-genpool-extend=	[X86-64] Number of pages to add to MCE Records pool.
+
 	md=		[HW] RAID subsystems devices and level
 			See Documentation/admin-guide/md.rst.
 
diff --git a/arch/x86/kernel/cpu/mce/genpool.c b/arch/x86/kernel/cpu/mce/genpool.c
index aed01612d342..d6e04fa5ee07 100644
--- a/arch/x86/kernel/cpu/mce/genpool.c
+++ b/arch/x86/kernel/cpu/mce/genpool.c
@@ -22,6 +22,7 @@
 #define MCE_POOLSZ	(2 * PAGE_SIZE)
 #define CPU_GEN_MEMSZ	256
 
+static unsigned int mce_genpool_extend;
 static struct gen_pool *mce_evt_pool;
 static LLIST_HEAD(mce_event_llist);
 static char gen_pool_buf[MCE_POOLSZ];
@@ -123,10 +124,14 @@ int mce_gen_pool_extend(void)
 	int ret = -ENOMEM;
 	u32 num_threads;
 
-	num_threads = num_present_cpus();
-	len = PAGE_ALIGN(num_threads * CPU_GEN_MEMSZ);
-	addr = (unsigned long)kzalloc(len, GFP_KERNEL);
+	if (mce_genpool_extend) {
+		len = mce_genpool_extend * PAGE_SIZE;
+	} else {
+		num_threads = num_present_cpus();
+		len = PAGE_ALIGN(num_threads * CPU_GEN_MEMSZ);
+	}
 
+	addr = (unsigned long)kzalloc(len, GFP_KERNEL);
 	if (!addr)
 		goto out;
 
@@ -159,6 +164,17 @@ static int mce_gen_pool_create(void)
 	return ret;
 }
 
+static int __init parse_mce_genpool_extend(char *str)
+{
+	if (*str == '=')
+		str++;
+
+	get_option(&str, &mce_genpool_extend);
+	return 1;
+}
+
+__setup("mce-genpool-extend", parse_mce_genpool_extend);
+
 int mce_gen_pool_init(void)
 {
 	/* Just init mce_gen_pool once. */
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ