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 9CD412DCF61 for ; Wed, 10 Dec 2025 13:08:29 +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=1765372111; cv=none; b=prsziPXUG3a6RBYWoI6KwB/ib+iZWDhvUo6wsTSqP6HMSRgvbse8TC8Z9yT4eZLdS/rX6GCyjsncP1OIrYJ9rghqRVopWtN+Tg6c4gI8NiEMNEFVKFkcuQgrzL/lScFJBL6Tb2gGEMdVe+vYGp+uhvvhtfQVtY11FXHAPHbJ0XA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765372111; c=relaxed/simple; bh=pIR0uZLMbV6ssFC5SPF0a/JhxJ4FY5lw5XQUItnv2rs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=bOH+ppjsc3e2Lx4qFngtgdpnKBtSVZP4c6C3ICNBWMnTWDWMXdm3k6CJAbqjCWqAamU0xHKoo2J+ddLsOEHPBsNxkENeNwrfwUe8AU9dDoaGpUR5BWESShtHH4kCTqIHebARsSI8IGyk+p/v0KqNHhRT4Z9Q+u/ofbTpZ/WeDJk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=Y+0JCZ8F; arc=none smtp.client-ip=209.85.128.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="Y+0JCZ8F" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4779a4fc95aso5334615e9.1 for ; Wed, 10 Dec 2025 05:08:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1765372108; x=1765976908; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=L6DrxmtZ1j/LJ3/Zh0trS4qWDOWjVZb85UkVHGcjdYY=; b=Y+0JCZ8FTii15V8wJRCLU9YuZgTtGPGTkGnh8YpuAYF+ecWxZujo5Dd4+msNZV/aa0 OL1dSzr1OAyBqk+WBESeYR9oEffJdQd04gyzGCFSTfbbjCddnBIiWd9KIiob3VFlzzON iIa54B9/tPxIAWSTlvUuC84txEDLx8UezLIzXwxcm51sm6bkVR3EZ7oZJ5YdAw4FfOo+ wHz5a2pf3bc34Sw8FghkGzS7Zvyp7TB1f175w06p2Z6rpHBIf6HIgZ/YwZJ51CvHmbNP Y8EqmMDQYLyQxDEorHLE1PkZhBHtR38f9bB1xoyC8OZA5RnklGtsW1fnuMWzNTnTRRCC J4lQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765372108; x=1765976908; h=in-reply-to: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=L6DrxmtZ1j/LJ3/Zh0trS4qWDOWjVZb85UkVHGcjdYY=; b=gIV4WgmAgEH8tHlV6dOSQI1vd+bcnkAMzjyOMB+VQKEAp+aGjmzYXXkTADl4iy1i7j /QFPtnq7cyCCGhLt5r/jeBZSCbzQAbualzTPz8crPJzbQjHinTohBcnvyaTv0avtw5jN hq+4CeEiR7mEIlcQJps2kBH5gD7zwlKf6SZ0b3j2txWw/Uk+Foz18Q8BsdHYU2Sev7tj OD1RREOJLX4jMJAquXANIsrrhjJAGmBk1KoActtMn9neH1ojHNBmsygld4HZ7ZbGqSpi kwbRIXcres+wN5pGTa9y47fu7y+c5MWPxJ2pVxFEl6Q7RWT8XErPz/XVHnKl+P/4JMAY jnsg== X-Forwarded-Encrypted: i=1; AJvYcCXLhC6i7iTncdjt2RKnxAodcdJ8BVYYnyCzvaXq3wwLlc0W40Xsy6J9eZVJPdoatfA4XtPiAUJ/6kLyvYU=@vger.kernel.org X-Gm-Message-State: AOJu0Ywg04Q9sr1LRHQGoZ7MdmSr+Oflb2DM1kkHp80b3c/PtTgltOrD aY/v1ldhtOTgGOmfQYXFc/RRn9essDTp4rgkU9keIg/32+pLhwU7Lr1PhBwpYt07kuE= X-Gm-Gg: ASbGnctRiZ2uN+GeOmYaDQHfsqk2fG2BUOKCKAhgLHkSLuz60btxA19+OrjQjRp2MuP ciCKbM7CLM7q2P4lj/c513tIKk3Bd8FIouWsgeg1fdv4tqML/S1tEJU1vHP8rQbA+mIVLOViLU/ +/KMNO2FL7ENnqJe7MTnOO6E4agYjx9YVYrdkM8AQgFteUWjKesRWpRrtdGAY9GGp2vEPu2MsT7 crl4X2xAakNVL9neGs1d71ELFf3VDkcZvllSfLi5gvg5f2xJli+g5l6sMU/RnbtbTFPUTaTkyS6 +f3ppZu+dhD9/0YhcCV9q08l8WfUxWL++XTNbyETOVNjL+RdLU1VJY+6ibJjKWl2/mw5K3pkas3 8cHw6MnMsV/PU1cCSXf+dkK/EeeTxJgaHyj+ojIp6OkeXFXlF6FquBZ/YkQtwYweFZ+t081h5DM BFpGSKvDpi4s+TKg== X-Google-Smtp-Source: AGHT+IFgTDSb/0yZ0vLeqUylP0HfpAuRjb0VxalxCz5aD9r+7OLDuimv4TQXi2MZmwXz9Fs7Y0VH4w== X-Received: by 2002:a05:600c:4c15:b0:47a:8383:f2b2 with SMTP id 5b1f17b1804b1-47a8383f3d4mr14490015e9.17.1765372107773; Wed, 10 Dec 2025 05:08:27 -0800 (PST) Received: from pathway ([176.114.240.130]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47a82d127a0sm42825445e9.3.2025.12.10.05.08.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Dec 2025 05:08:27 -0800 (PST) Date: Wed, 10 Dec 2025 14:08:25 +0100 From: Petr Mladek To: Aaron Tomlin Cc: Greg KH , Lance Yang , sean@ashe.io, linux-kernel@vger.kernel.org, mhiramat@kernel.org, akpm@linux-foundation.org, John Ogness Subject: Re: [PATCH 1/2] hung_task: Consolidate hung task warning into an atomic log block Message-ID: References: <20251209041218.1583600-1-atomlin@atomlin.com> <20251209041218.1583600-2-atomlin@atomlin.com> <2025120902-residence-maggot-c5f4@gregkh> 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=us-ascii Content-Disposition: inline In-Reply-To: On Tue 2025-12-09 17:14:40, Aaron Tomlin wrote: > On Tue, Dec 09, 2025 at 03:56:58PM +0900, Greg KH wrote: > > > "%s\n" forces an unconditional newline, causing a spurious blank line when > > > the flag isn't set, right? > > > > The first \n should not be there, this should be all one line. > > Hi Greg, > > I agree. This will be resolved in a subsequent patch. I am not sure what exactly is requested here. But a multiline message defined on a single line would be a mess. I mean that printk("aaaa\nbbbbb\ncccccc\n") is hard to follow, in compare with printk("aaaa\n" "bbbbb\n" "cccccc\n"); IMHO, the only motivation to keep printk() message on a single line is that it helps grepping. But the "\n" breaks the grepping anyway. > > If you have multiple lines wanting to be printed, use multiple pr_err() > > calls. > > Unfortunately, sequential pr_err() calls risk having their lines separated > by other log messages, rendering the warning incoherent. The single-call > implementation is necessary to ensure the entire message is atomically > written. With the "printk" maintainer hat on, I am a bit afraid to go this way. printk() is not designed for huge text blobs. Especially: + A single record is flushed to a console atomically, often under spin lock with IRQs disabled. Too long messages might cause soft lockups on slow serial consoles. [*] + A single record can't be wrapped at the end of the data buffer. Instead, the remaining space gets unused and the message is stored from the beginning of the buffer. So, bigger messages might cause more unused space. Note that this limitation simplified the already complicated lock-less code. Instead, the caller ID should allow to sort the messages by a post processing, see CONFIG_PRINTK_CALLER. [*] The single message does not make a big difference in this case because the hung task report is done from atomic context. And it is an emergency message so that even nbcon console drivers try to flush it immediately. Best Regards, Petr