From nobody Thu Sep 24 16:08:15 2026 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 68B2C539780; Tue, 22 Sep 2026 11:11:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790075496; cv=none; b=ANIPLqlyu3UQAL677NYrUbre1amdCeaQ7epX0tZWXPH4P3aSJyPYO/aOAawDPPg8sd13eRHOE990HLUWzGw1TvLIavb5g7SKrd2gIVJ5/MIOWcagTm8QO5S6otb4G5YNOoMWjCQ6s8r4eZ3iHoTpEsY/WcNxD6gUUxLkAZCzpmo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790075496; c=relaxed/simple; bh=5S6MUznLH75Jss5kdf0PUS+wJu4hxhEgCLybtSZMQwc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Qk4YSelkF6FlGCupxPthYQxdeajRXM7g/sFgn8VTWW0s4wz9JwYlbRG+7a3NJmAaKPUZGOa4bGcR/qN1eiTMKwO6NvVQAC3+ST/1rPVQ0a3nt6TYtXbMHuxqrhHb4opqgtDhbUjfDfSvFaUnTA39jVGVMUEHIN4JIct5E7WaXYQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=TRIwI8Cc; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="TRIwI8Cc" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=qA7dfiffc1SQrgx0PMDdq80QiWLJs4sQqoBp176OMyQ=; b=TRIwI8CcUYcHPG/ITbh8DLM1z7 ccvTVaSKARlBscj61y2mRdUNiAO6bau7a5MJQ2bB+JB0yI+Pb41yb2+vhVeajZWaVb9LTsed7Zl6n j4CUKtAQiTgpg13B3ixpgEhnfAHzu77Akq3VhSEcngWNp99tIMcpc9E2Hrb99NVAuoqwhquBw3yRs hWbSsM1GKdhLpEORHUlqKNzNE/lt5jHcbG6H75mytvXANn10Eeg7MMa3gqhV+lHLhw5rSDyoctGqF 6ewm8slKEC3SnJtf9BSTwLA6TqD20MMX0p3G0uDU3EixGvdz1W0mXQtPkWsyXjv6jYPBPZiqrI7hZ yuxI8phQ==; Received: from authenticated-user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1x8yPL-002wIp-1V; Tue, 22 Sep 2026 11:11:31 +0000 From: Breno Leitao Date: Tue, 22 Sep 2026 04:11:08 -0700 Subject: [PATCH 1/2] x86/mce: Spell the long long conversions in __print_mce() as %llx 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-Transfer-Encoding: quoted-printable Message-Id: <20260922-b4-mce-print-v1-1-500205689e54@debian.org> References: <20260922-b4-mce-print-v1-0-500205689e54@debian.org> In-Reply-To: <20260922-b4-mce-print-v1-0-500205689e54@debian.org> To: Tony Luck , Borislav Petkov , Thomas Gleixner , Ingo Molnar , Dave Hansen , x86@kernel.org, "H. Peter Anvin" Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-f8e9d X-Developer-Signature: v=1; a=openpgp-sha256; l=1557; i=leitao@debian.org; h=from:subject:message-id; bh=5S6MUznLH75Jss5kdf0PUS+wJu4hxhEgCLybtSZMQwc=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqsmJb34TybzhSalKZ+SoKULGkbWQGT0cvSiR+P 2Xw9Xn+yDaJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCarJiWwAKCRA1o5Of/Hh3 bQLqD/95Dd3UTR8IToNKFUbcZwwiLMN3sMtZEyN0YepQqAMIzkFnFJYzx/xnB5ExGk2JzP5/7oA 1kcN3F+P/T5Tse2jBsnVdn+hUq08zoHFor/HoMkUYkibSpvjOeKR+L1oaDx0fRAaZ1PfI8y4Jcv 8V9TUNZHUcy28TpEmo7Mg+37DgujiWC9WdYIz1YTd5NojfcTlojOBEeSE/+gAtX197U7BctyAzJ PfxKIJSKdSkF9PlKpRlZuUOmglE+nYm79EwXvUCnjePx8Ebom8T5DKY+iYHeDUThP6bMRnDqL5O aEOcVWnls8N8ES/sOfVJYOspIqU3nhnfpuraYszzBgZlZKJoofPUP0GdjiqkA0mHGSgbptdFQsG rQscAaBXr/lLzfoBC+24zZ6HxCiC3nm0sLesgV6vsAhY6HbRw6/ehjdDJpR1iiFq4X1DnC1ZoKY wOlD3MH/xu2bSNAXtOD2NFvrj+PyA5/J5G9YSVqaQt/lq/xhRlLVEW9MWwPxAPT8TwKisw74zqF ZPkTpVgBxLTt7Sf7zS18sq5mroVS9djfHBQYr4FMrQn0phgEs8uliwTQ28VUkCKWSb9ANzBWbMr ZxGDIFtxgVAGLQxtbfMpbIrCIDswemaKVu7u+HMJJrEQLMjYfCL+zsnXMnmm4x87p60OefRXosh hkWsyysNikrqbJQ== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao __print_mce() mixes %Lx and %llx for the same u64 fields. Kernel vsnprintf() treats the two identically, format_decode() maps both to sizeof(long long): ['l'] =3D { 0, sizeof(long), sizeof(long long) }, ['L'] =3D { 0, sizeof(long long) }, but checkpatch flags %Lx, and the rest of the function already uses %llx. Use %llx throughout, and while touching the RIP call, align its continuation lines with the open parenthesis. No change to the printed output. Signed-off-by: Breno Leitao --- arch/x86/kernel/cpu/mce/core.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 9bba1e2f03af7..4b457c6bed8f5 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -177,15 +177,15 @@ static void __print_mce(struct mce_hw_err *err) { struct mce *m =3D &err->m; =20 - pr_emerg(HW_ERR "CPU %d: Machine Check%s: %Lx Bank %d: %016Lx\n", + pr_emerg(HW_ERR "CPU %d: Machine Check%s: %llx Bank %d: %016llx\n", m->extcpu, (m->mcgstatus & MCG_STATUS_MCIP ? " Exception" : ""), m->mcgstatus, m->bank, m->status); =20 if (m->ip) { - pr_emerg(HW_ERR "RIP%s %02x:<%016Lx> ", - !(m->mcgstatus & MCG_STATUS_EIPV) ? " !INEXACT!" : "", - m->cs, m->ip); + pr_emerg(HW_ERR "RIP%s %02x:<%016llx> ", + !(m->mcgstatus & MCG_STATUS_EIPV) ? " !INEXACT!" : "", + m->cs, m->ip); =20 if (m->cs =3D=3D __KERNEL_CS) pr_cont("{%pS}", (void *)(unsigned long)m->ip); --=20 2.53.0-Meta From nobody Thu Sep 24 16:08:15 2026 Received: from stravinsky.debian.org (stravinsky.debian.org [82.195.75.108]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9849539789; Tue, 22 Sep 2026 11:11:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=82.195.75.108 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790075500; cv=none; b=es8pLRvFHTIwl0ma21diP40VaCYly4DuxtDHkdeByLzLuCQgeGwaC4Po/+MScyicF7gk3gxxGUxKMK7+ZpdeF0q8DRQ4YQPKzNxwE6RLPWB8V0WUIN6ewH/uBgdD5NTvkHKC0rHOAIziFSpmNpcmhbQFiIMJ83e5nUHaocNTXNg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790075500; c=relaxed/simple; bh=PuFn5EVoIugP5oqCsgBSKrLOapMi+vi77A5ZCQf1e1g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RS3HgVeS9eAONmyjcY5yNmd6pItyuXgThSH33N9DDibbWt6my0g17Gt2X/TAYJqLap3gtAHxWhHclXp+8qSLgXzPqjdtdF0zYk4nXIW74m9+o7kUa+B7GMfuGyZ8SZmodCBIVs4JodnXROxTNlVG/H5iBuHw1PTFxKZ0kFQItfU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=debian.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b=tj9bklGg; arc=none smtp.client-ip=82.195.75.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=debian.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=debian.org header.i=@debian.org header.b="tj9bklGg" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.stravinsky; h=X-Debian-User:Cc:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Content-ID:Content-Description; bh=jstZxs+CbxYZLumdK9kxauT5ptHPDAOWGF+VgHM45Zw=; b=tj9bklGguyyMhHCx7rwdaqNqXX pcO1bUqTmK7KXhBk3AEH5EwburR2rV314t7Isa3nmlqIzWvq05wRGpsO9i6YLWWlr9fmkonYTtIbk xtb5/rD0oH/GORggksNFu44s02bZp/qKSnrl7ivpzQRRwLV7cfCfx/CK0Zn0zJQSoB3nNaWYE8elT hykSxMuGFf9vY8xRUjl5WcXG0CxUUMPFMaUpTZtFDBiPimi29STVvvFcIghIP311rUxH1+zoGH4Z9 s+Gqz6bPoigCUW7cFp3VtFExTv6S59VSTo7cJ9Pf0ZKCCisAh36HtFoV9FB2Ki+BAZKSZbRact0CQ eLZo+mHQ==; Received: from authenticated-user by stravinsky.debian.org with esmtpsa (TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim 4.96) (envelope-from ) id 1x8yPP-002wIv-1P; Tue, 22 Sep 2026 11:11:35 +0000 From: Breno Leitao Date: Tue, 22 Sep 2026 04:11:09 -0700 Subject: [PATCH 2/2] x86/mce: Print each MCE record line in a single printk() 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-Transfer-Encoding: quoted-printable Message-Id: <20260922-b4-mce-print-v1-2-500205689e54@debian.org> References: <20260922-b4-mce-print-v1-0-500205689e54@debian.org> In-Reply-To: <20260922-b4-mce-print-v1-0-500205689e54@debian.org> To: Tony Luck , Borislav Petkov , Thomas Gleixner , Ingo Molnar , Dave Hansen , x86@kernel.org, "H. Peter Anvin" Cc: linux-edac@vger.kernel.org, linux-kernel@vger.kernel.org, Breno Leitao , kernel-team@meta.com X-Mailer: b4 0.16-dev-f8e9d X-Developer-Signature: v=1; a=openpgp-sha256; l=4533; i=leitao@debian.org; h=from:subject:message-id; bh=PuFn5EVoIugP5oqCsgBSKrLOapMi+vi77A5ZCQf1e1g=; b=owEBbQKS/ZANAwAIATWjk5/8eHdtAcsmYgBqsmJbqjf5yadaICTd/DNlNDdvXoxybqFC6X64p wWjfI0uh7mJAjMEAAEIAB0WIQSshTmm6PRnAspKQ5s1o5Of/Hh3bQUCarJiWwAKCRA1o5Of/Hh3 bV9FEACxL27dKhmjmwJs9C/1VFMKTrulpIMHN+/M5mTcswK6MuRr7x75fH1r7K3e5r2s/hN1ddk 1q6qJJenru9HqrcB3B6V7qUCfj7JuQtaZR5vxPp3INU2tycwo3yGykgCaIsyReORKhz6VblnPCb TDBMy4kZHpsxBPHMOEwL1Co9pZ7IxH1PtC832nRC7hsc/isKX0BihzucRHABNpjDyt/LEz5QWo6 RGn4BG7HZmZhYFyWZHzGbHgyk0/RAIHvXGBBlub4LgnBKNMTXPTtMUpJ3Ui7YfRABmf1R4iYcNS spqDwXKQ6ULN0sN+Vwz8Nb+IB5C88b9AcB/Jc7i1FfAV9H5OWjD/0Ye8qFJyko0yZ1PVJY+kr86 9kAH2tPg/M0uJtR3CQQFAHq1GbfLJb6XgPQc2tO9VMh3HHgZnZMbuQAs8xvQ6zMa5F6/8sDPfjR CciUajfF7pOgWaNx9Ubpe9A3mA+tNSxYB2yEYjnv7o4OQIpE3Srd+aQz1pSlN4cyeloURR1YOwf uGpFzUT2J4yxV+qaEDtK2jCoQ0AjMu3cIMekiO6dQ8eq/T/RBzB4WpKUgsHxlShUmR25y9rzChS fm3qV9EFIcy7TrCpSFMRqN0NNU+YjFyVGku4gp9qO3H5/Phe8EyimK8SyeY1s0aRRycBgDYfe4E 0jLG8N5h2an9w5Q== X-Developer-Key: i=leitao@debian.org; a=openpgp; fpr=AC8539A6E8F46702CA4A439B35A3939FFC78776D X-Debian-User: leitao I am looking at a bunch of MCE recently, and I found __print_mce() assembles two of its four output lines from pr_cont() pieces. A continuation only appends to the previous record when the newest entry in the printk ring buffer has the same caller_id, so a printk from another CPU in between breaks the line in two. The tail then loses both prefixes, because pr_cont() does not apply pr_fmt() and HW_ERR is only in the format string of the first piece. Injecting an error while the other CPUs write to /dev/kmsg: [ 1.869789] mce: [Hardware Error]: TSC d00792e9 [ 1.869794] ADDR deadb000 MISC 8c00004000010090 Anything collecting on "mce:" drops that second line. Concurrent printk is the norm for a fatal machine check. Every CPU in the socket logs the same package-level bank at once, and with firmware-first the GHES NMI handler prints in parallel, kernel message becomes hard to read. For instance, on a recent 60-CPU Sapphire Rapids host a fatal PCU error got as far as [57223.636282] [ T635877] mce: [Hardware Error]: RIP !INEXACT! 10: before GHES panicked. The "TSC ..." and "PROCESSOR ..." lines never arrived, taking the timestamp, the socket and APIC ids and the running microcode revision with them. Build the variable part into a seq_buf and print it in one go, make the full message either sent or not. Also, printing all messages with the same HW_ERR suffix. Needlessly to say, the output is unchanged, trailing space included, and mce-inject gives identical records with and without this. Signed-off-by: Breno Leitao --- arch/x86/kernel/cpu/mce/core.c | 44 ++++++++++++++++++++++++++++----------= ---- 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/arch/x86/kernel/cpu/mce/core.c b/arch/x86/kernel/cpu/mce/core.c index 4b457c6bed8f5..6e9516731fceb 100644 --- a/arch/x86/kernel/cpu/mce/core.c +++ b/arch/x86/kernel/cpu/mce/core.c @@ -46,6 +46,7 @@ #include #include #include +#include =20 #include #include @@ -173,9 +174,14 @@ void mce_unregister_decode_chain(struct notifier_block= *nb) } EXPORT_SYMBOL_GPL(mce_unregister_decode_chain); =20 +/* 8 fields, widest is "SYND1 " plus 16 hex digits and a space. */ +#define MCE_AUX_LEN (8 * (sizeof("SYND1 ") + 16 + 1)) + static void __print_mce(struct mce_hw_err *err) { struct mce *m =3D &err->m; + char aux[MCE_AUX_LEN]; + struct seq_buf s; =20 pr_emerg(HW_ERR "CPU %d: Machine Check%s: %llx Bank %d: %016llx\n", m->extcpu, @@ -183,35 +189,45 @@ static void __print_mce(struct mce_hw_err *err) m->mcgstatus, m->bank, m->status); =20 if (m->ip) { - pr_emerg(HW_ERR "RIP%s %02x:<%016llx> ", - !(m->mcgstatus & MCG_STATUS_EIPV) ? " !INEXACT!" : "", - m->cs, m->ip); + const char *inexact =3D ""; + + if (!(m->mcgstatus & MCG_STATUS_EIPV)) + inexact =3D " !INEXACT!"; =20 + /* The space after '>' is part of the existing output. */ if (m->cs =3D=3D __KERNEL_CS) - pr_cont("{%pS}", (void *)(unsigned long)m->ip); - pr_cont("\n"); + pr_emerg(HW_ERR "RIP%s %02x:<%016llx> {%pS}\n", + inexact, m->cs, m->ip, + (void *)(unsigned long)m->ip); + else + pr_emerg(HW_ERR "RIP%s %02x:<%016llx> \n", + inexact, m->cs, m->ip); } =20 - pr_emerg(HW_ERR "TSC %llx ", m->tsc); + seq_buf_init(&s, aux, sizeof(aux)); + + seq_buf_printf(&s, "TSC %llx ", m->tsc); if (m->addr) - pr_cont("ADDR %llx ", m->addr); + seq_buf_printf(&s, "ADDR %llx ", m->addr); if (m->misc) - pr_cont("MISC %llx ", m->misc); + seq_buf_printf(&s, "MISC %llx ", m->misc); if (m->ppin) - pr_cont("PPIN %llx ", m->ppin); + seq_buf_printf(&s, "PPIN %llx ", m->ppin); =20 if (mce_flags.smca) { if (m->synd) - pr_cont("SYND %llx ", m->synd); + seq_buf_printf(&s, "SYND %llx ", m->synd); if (err->vendor.amd.synd1) - pr_cont("SYND1 %llx ", err->vendor.amd.synd1); + seq_buf_printf(&s, "SYND1 %llx ", + err->vendor.amd.synd1); if (err->vendor.amd.synd2) - pr_cont("SYND2 %llx ", err->vendor.amd.synd2); + seq_buf_printf(&s, "SYND2 %llx ", + err->vendor.amd.synd2); if (m->ipid) - pr_cont("IPID %llx ", m->ipid); + seq_buf_printf(&s, "IPID %llx ", m->ipid); } =20 - pr_cont("\n"); + pr_emerg(HW_ERR "%s\n", seq_buf_str(&s)); =20 /* * Note this output is parsed by external tools and old fields --=20 2.53.0-Meta