All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Srivatsa S. Bhat" <srivatsa@csail.mit.edu>
To: Borislav Petkov <bp@alien8.de>
Cc: Yazen Ghannam <yazen.ghannam@amd.com>,
	Borislav Petkov <bp@kernel.org>,
	linux-edac <linux-edac@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] EDAC/mce_amd: Do not print a stray newline
Date: Tue, 14 Jul 2026 15:58:52 +0530	[thread overview]
Message-ID: <alYPZGTBJUDR936n@csail.mit.edu> (raw)
In-Reply-To: <20260713232219.GAalVzK0UQ9rxlIWmT@fat_crate.local>

On Mon, Jul 13, 2026 at 04:22:19PM -0700, Borislav Petkov wrote:
> On Mon, Jul 13, 2026 at 02:44:02PM -0400, Yazen Ghannam wrote:
> > On Sat, Jul 11, 2026 at 08:16:48PM -0700, Borislav Petkov wrote:
> > > From: "Borislav Petkov (AMD)" <bp@alien8.de>
> > > 
> > > With error records which don't have FRU text, an empty newline is
> > > printed like this:
> > > 
> > >   [28014.094610] mce: [Hardware Error]: Machine check events logged
> > >   [28014.094674] [Hardware Error]: Corrected error, no action required.
> > >   [28014.094687] [Hardware Error]: CPU:11 (19:44:1) MC0_STATUS[-|CE|MiscV|AddrV|-|-|SyndV|CECC|-|-|-]: 0x9c20400001010135
> > >   [28014.094724] [Hardware Error]: Error Addr: 0x000000019ba9a974
> > >   [28014.094732] [Hardware Error]: IPID: 0x001000b000000000, Syndrome: 0x000000081a1f2505
> > > 
> > >   [28014.094744] [Hardware Error]: Load Store Unit Ext. Error Code: 1
> > >   [28014.094748] [Hardware Error]: cache level: L1, tx: DATA, mem-tx: DRD
> > > 
> > > Move the \n into the last printk() call where it belongs.
> > > 
> > > Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
> > 
> > Reviewed-by: Yazen Ghannam <yazen.ghannam@amd.com>
> 
> Yeah, Sashiko has a point:
> 
> https://sashiko.dev/#/patchset/20260712031648.486110-1-bp%40kernel.org
> 
> So we want the error records to be compact and fit in a block so that you can
> recognize them easier and thus not print each thing with a newline.
> 
> But those things are not unconditional so you cannot always know.
> 
> I need to think of a slick scheme what to do here.
>

Do you mean something other than moving the newline print into an else
block like this?

---
 drivers/edac/mce_amd.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c
index bd252cb3c38e..60d1a62e1a95 100644
--- a/drivers/edac/mce_amd.c
+++ b/drivers/edac/mce_amd.c
@@ -870,12 +870,16 @@ amd_decode_mce(struct notifier_block *nb, unsigned long val, void *data)
 				memcpy(&frutext[0], &err->vendor.amd.synd1, 8);
 				memcpy(&frutext[8], &err->vendor.amd.synd2, 8);
 
-				pr_emerg(HW_ERR "FRU Text: %s", frutext);
+				pr_emerg(HW_ERR "FRU Text: %s\n", frutext);
 			}
+		} else {
+			/*
+			 * Explicit line termination to handle nested
+			 * conditional prints correctly.
+			 */
+			pr_cont("\n");
 		}
 
-		pr_cont("\n");
-
 		decode_smca_error(m);
 		goto err_code;
 	}
-- 
2.43.0


Regards,
Srivatsa
Microsoft Linux Systems Group

  reply	other threads:[~2026-07-14 10:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-12  3:16 [PATCH] EDAC/mce_amd: Do not print a stray newline Borislav Petkov
2026-07-13 18:44 ` Yazen Ghannam
2026-07-13 23:22   ` Borislav Petkov
2026-07-14 10:28     ` Srivatsa S. Bhat [this message]
2026-07-14 13:04       ` Yazen Ghannam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alYPZGTBJUDR936n@csail.mit.edu \
    --to=srivatsa@csail.mit.edu \
    --cc=bp@alien8.de \
    --cc=bp@kernel.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=yazen.ghannam@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.