Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4140177rwb; Mon, 31 Jul 2023 01:55:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlFfkqAybep16lNQmRK5bDmY939P/6U9RoWjTQHYRGDNOQESEy7Ex0Vh28Zulh4o9efCetEj X-Received: by 2002:a05:6a20:1450:b0:132:cd2d:16fd with SMTP id a16-20020a056a20145000b00132cd2d16fdmr8897945pzi.38.1690793735901; Mon, 31 Jul 2023 01:55:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690793735; cv=none; d=google.com; s=arc-20160816; b=i2Ilol9057n3Tm3pOWXl0sUH0asiH/Ytvqh2fFuxdpHeutZeAjGAx7LRrzpT/lX8Gj xM140VmQlK+t9i+I/mo8YNofmnIhdN7vzmqsubFOzx4GGS1WwaiGtDNT+xMQAV/synSc aN6a/z4wd/URVNwbRa8lHyYZ2JoQobMN1IqOubPZ4g/BeCIy3PVjYF/FBm1g8X7MZ+Rp JyfmynAhDN0o4SHfsRCxtOsUceW29RgKEwJEmrjRnaSF4Sms4ltQhncWiR2bV3fEhIpC L6SA75M8g/ag+KyK2HqL+36Rb5iODxN12MXRVxYXRkdw2q+bnbzeLzuR+WPANkUsmdW4 6TiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=btPZwdfFcfW7yh8HaTQzyWkQr5OvNAFfLD2Y4vZIGU0=; fh=BRtnDp3SGaXDmh9as1uhX4yuXeAg8r7WU2Xs8JBa9Xc=; b=kemYcLAQTklvLGxvOnb9TGIgqxhXqnklRBjhQck23/PfNyEMZwI/EnrzRb5JvsEVaK m9Nbw+cXkBoit4/1FG/kv++cnqQAyyS4VzTK7Lc7kHxrPzvs0rQsf8PBhJ84umOTurny Xh7k3jKGz5coscLToE0QImHCPn/nHFfnfP4Yr8GKEYngkyuh1ws/YIKMTPl39aEf3nVq y+Kr97ThpF/96g2JxkRBOn9aqKXIx0XKMKQNe4kaptPr24kppo5cmadF/JHk4Xt++b2y qjpA0TAnttIgj9lNxtSXAZjeLGw8qTy/aos+9ZtHncZnFvhMUREabu15QOtK+WDsrvJG ny8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=1XREGsUu; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=a4z1VuoM; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c15-20020a056a000acf00b0067a0b355523si7131918pfl.116.2023.07.31.01.55.23; Mon, 31 Jul 2023 01:55:35 -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=@linutronix.de header.s=2020 header.b=1XREGsUu; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=a4z1VuoM; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229983AbjGaIZf (ORCPT + 99 others); Mon, 31 Jul 2023 04:25:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230026AbjGaIZL (ORCPT ); Mon, 31 Jul 2023 04:25:11 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65F5312D for ; Mon, 31 Jul 2023 01:25:07 -0700 (PDT) From: John Ogness DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1690791904; h=from:from:reply-to:subject:subject: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=btPZwdfFcfW7yh8HaTQzyWkQr5OvNAFfLD2Y4vZIGU0=; b=1XREGsUusEzIKE58IrOHwr0/UFTSXTZMgu2OOhYwEkfb8zmSKEQcPa+8o81QclfcsJn6Rk P8pW3ZxjexRmAPIlCnS41RyUy12tMzszmMBc5+qkkpo+edgNht7p+0NAYsNeLfPq+trkY6 sxEqBygcRvC5z99pDEHdSGHPCLtvNt0nKX3ExiuWHnTULa7tFwAoloDyuWRucvZ+38Bird oLZsUuTQvTCevR5z4xDa8r7KL6uscDECOHolRz9fZsFOjT/sWEHu87BDP5tB+6oWHoTU/G BPmzzBpns5xosiUbw9m76dhMqpabvamH+o0Vp7/QdhNUC57joKiHUWqNIT7KQw== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1690791904; h=from:from:reply-to:subject:subject: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=btPZwdfFcfW7yh8HaTQzyWkQr5OvNAFfLD2Y4vZIGU0=; b=a4z1VuoM8pLOhMODcNrM8PA/KSmGCXLRVhfDjj6n9s5vO4XMrnCqtY2jIuuw2IWFolcgu6 GXj8Fx8yjoQ6gyCQ== To: Jim Cromie , rostedt@goodmis.org, linux-kernel@vger.kernel.org Cc: Jim Cromie , Vincent Whitchurch , daniel@ffwll.ch, pmladek@suse.com, sergey.senozhatsky@gmail.com, Simon Ser , Sean Paul Subject: Re: [RFC PATCH 1/1] tracefs: add TP_printk_no_nl - RFC In-Reply-To: <20230730222134.54547-1-jim.cromie@gmail.com> References: <20230730222134.54547-1-jim.cromie@gmail.com> Date: Mon, 31 Jul 2023 10:31:03 +0206 Message-ID: <87y1iwlc80.fsf@jogness.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-3.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,INVALID_DATE_TZ_ABSURD, RCVD_IN_DNSWL_MED,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 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). 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. John Ogness