Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4256638rwb; Mon, 31 Jul 2023 04:18:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlGc8pFSg+auF8IOh765EiisZQ/6PV//0psjet/g0e2O69Bov0mi8Iytg+tje1Um9d61+yyV X-Received: by 2002:a17:906:76ce:b0:99b:7f52:ccd5 with SMTP id q14-20020a17090676ce00b0099b7f52ccd5mr6065583ejn.10.1690802318018; Mon, 31 Jul 2023 04:18:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690802317; cv=none; d=google.com; s=arc-20160816; b=O19W571mskj/FRvMe1hiCc0lyeQQaCJhypZoZZ6KlubwPXgNrUpa3qe7m9b/7qBvTa d6YY5S+sjUatuKAx3De9DZx1J8Qhz/I4/NMy4NJKbhu9pxtai3Z9c57lp3qHzHVJiGDo ItyjjE94WYd6x/MquYkv+yiwBq22/1AIFoWE9RSwDXZHGioXVSX1gSD7hU1/AtgEkxQT UHSd9ufO2BpQdwBeMLXGRdH5INZUh/fFqNBEV0qmwSxZQzIkwl5Uif1M/ewROz4pTnFx tRF2QJ/xIkDr6n1gc01EoABDqimOkHdaxRskul4PobWACcpLTuQ6Oic8gmNapabmhvY5 /4SA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=pFPUin3BTH5KkTUi/cDS3D3blp01XPuN4dipF/jRadY=; fh=J+pPmhBnrfe9Ark2Zrt+Du6OnSP3vgcegzW0paNGcW8=; b=wRH0n2/a29gSLaCpEf1K5dX5jnDry7MoLNaWhwLNJYvVo+zr1Agf632vKo2uzN3LrW uojbe8NwIGNCW+kShw1NqNQ8GTe/W3i79j8Nj+QfsmkW8X7ECvaMWuHj7XLCCDGYSYFk nSFtp3fXBPhWqNat+e/yNrQmnaqtSt+/D9+fPJkw8L2xhQmtakH2dkGu7X40YeQo2Zjw E5RdGS0D2Zul0IrcheuXHB70FAniZUqS2iijY1/2JrfZWwRRVsxizctwDVIrijAneI1i QAYVC9RR3YFj0dHgFgeJJetf9n+dNGqI/e9zqNyRWZR0ALNGD07BnSdKT8hy7tNxKQcE ilMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=r+YyO5OJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id u15-20020a17090657cf00b00993629dea0csi6830263ejr.134.2023.07.31.04.18.11; Mon, 31 Jul 2023 04:18:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=r+YyO5OJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232547AbjGaKWW (ORCPT + 99 others); Mon, 31 Jul 2023 06:22:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232502AbjGaKV7 (ORCPT ); Mon, 31 Jul 2023 06:21:59 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 39677E6F for ; Mon, 31 Jul 2023 03:21:36 -0700 (PDT) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id DA8E12230A; Mon, 31 Jul 2023 10:21:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1690798894; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pFPUin3BTH5KkTUi/cDS3D3blp01XPuN4dipF/jRadY=; b=r+YyO5OJsrpyOfI/QDvo4SY7B23V5QFrnhHB/lnHdQxvcScdQud7+rnYzqTu4/p7Md5vLS 865OlGDy2z/fINyOFoohZvHEhZT50I0B6pr+4dUbUFMqlO9AjwYa1YRFlYdVlXTrBRulm5 sVndnVCJOvAt5aI8SwGbxRdpI0KO4w4= Received: from suse.cz (pmladek.tcp.ovpn2.prg.suse.de [10.100.208.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 93B162C142; Mon, 31 Jul 2023 10:21:33 +0000 (UTC) Date: Mon, 31 Jul 2023 12:21:29 +0200 From: Petr Mladek To: John Ogness Cc: Jim Cromie , rostedt@goodmis.org, linux-kernel@vger.kernel.org, Vincent Whitchurch , daniel@ffwll.ch, sergey.senozhatsky@gmail.com, Simon Ser , Sean Paul Subject: Re: [RFC PATCH 1/1] tracefs: add TP_printk_no_nl - RFC Message-ID: References: <20230730222134.54547-1-jim.cromie@gmail.com> <87y1iwlc80.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87y1iwlc80.fsf@jogness.linutronix.de> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 2023-07-31 10:31:03, John Ogness wrote: > On 2023-07-30, Jim Cromie wrote: > > This variant of TP_printk() does *not* add the trailing newline. > > > > https://lore.kernel.org/lkml/20200825153338.17061-1-vincent.whitchurch@axis.com/ > > > > taught dyndbg to send pr_debug() msgs to tracefs, via -x/T flag. > > > > It "reused" the include/trace/events/printk.h console event, > > which does the following: > > > > TP_fast_assign( > > /* > > * Each trace entry is printed in a new line. > > * If the msg finishes with '\n', cut it off > > * to avoid blank lines in the trace. > > */ > > if ((len > 0) && (text[len-1] == '\n')) > > len -= 1; > > > > memcpy(__get_str(msg), text, len); > > __get_str(msg)[len] = 0; > > ), > > > > That trim work could be avoided, *iff* all pr_debug() callers are > > known to have no '\n' to strip. While thats not true for *all* > > callsites, it is 99+% true for DRM.debug callsites, and can be made > > true for some subsets of prdbg/dyndbg callsites. > > Note that the trailing '\n' in printk messages has a purpose. It > finalizes commitment of the message to the ringbuffer so that the > message cannot be extended by any LOG_CONT printk's that may come along > (from any context). Also the message is printed on consoles only when finalized. As a result, the last non-finalized message might not be visible on consoles for hours or days. > If it is not intended that a message is extended, then that message > should include a trailing '\n'. > > Grepping through the kernel, I am surprised how many messages are > missing the trailing newline when it is obvious they are not intended to > be extended. I consider these bugs. I consider this bug as well. My understanding is that this patch affects only messages printed to the ftrace buffer so that it does not affect printk() directly. But still. It creates a habit that is bad for printk(). Also relies on the fact that people are aware of this macro and use it. IMHO, it will not work in practice. Or do I miss something? Best Regards, Petr