From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 5927984FA7; Fri, 23 Feb 2024 20:01:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708718512; cv=none; b=nhXg+lbnARdtFay6Xa3PAsWCXHb7JSheGP1aoQV6Q0o9xAm7z8lFaSkixJbp3DCbxcc09t4Q00dgbwInVq187tPsbIYwMLC8/m7L7b2w0pEEmvaEssjB2tzWJt8ITbo8So/tJJ+41N6fLefdYdfJL9GzNlNTMtcscTu/Ct0m6IU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708718512; c=relaxed/simple; bh=qKShU0yRSF7Qai1aRFfijNm4QP3IVl+XveltCGlIK9M=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=u4SblV6STNVFKFHJnI4BdZ+gPsBpTKcvzBKj+lFhT5knxP4Jth6uDgUfy6ItaZTqxVN0TQLSYNf9uZl4SE8tLhr1XdrbB8zXvHE4jN3oSVIivELMoqPdZcGC7yOK83NmQ5IubAAnKiOAXT8gGpLm61MYf3+RNVkDxDlczDS1nJs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 84C71C433F1; Fri, 23 Feb 2024 20:01:46 +0000 (UTC) Date: Fri, 23 Feb 2024 15:03:39 -0500 From: Steven Rostedt To: Kent Overstreet Cc: Jeff Johnson , LKML , Linux Trace Kernel , Masami Hiramatsu , Mathieu Desnoyers , Linus Torvalds , linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org, linux-block@vger.kernel.org, linux-cxl@vger.kernel.org, linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, virtualization@lists.linux.dev, linux-rdma@vger.kernel.org, linux-pm@vger.kernel.org, iommu@lists.linux.dev, linux-tegra@vger.kernel.org, netdev@vger.kernel.org, linux-hyperv@vger.kernel.org, ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, ath11k@lists.infradead.org, ath12k@lists.infradead.org, brcm80211@lists.linux.dev, brcm80211-dev-list.pdl@broadcom.com, linux-usb@vger.kernel.org, linux-bcachefs@vger.kernel.org, linux-nfs@vger.kernel.org, ocfs2-devel@lists.linux.dev, linux-cifs@vger.kernel.org, linux-xfs@vger.kernel.org, linux-edac@vger.kernel.org, selinux@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-erofs@lists.ozlabs.org, linux-f2fs-devel@lists.sourceforge.net, linux-hwmon@vger.kernel.org, io-uring@vger.kernel.org, linux-sound@vger.kernel.org, bpf@vger.kernel.org, linux-wpan@vger.kernel.org, dev@openvswitch.org, linux-s390@vger.kernel.org, tipc-discussion@lists.sourceforge.net, Julia Lawall Subject: Re: [FYI][PATCH] tracing/treewide: Remove second parameter of __assign_str() Message-ID: <20240223150339.2249bc95@gandalf.local.home> In-Reply-To: References: <20240223125634.2888c973@gandalf.local.home> <0aed6cf2-17ae-45aa-b7ff-03da932ea4e0@quicinc.com> <20240223134653.524a5c9e@gandalf.local.home> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-edac@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 23 Feb 2024 14:50:49 -0500 Kent Overstreet wrote: > Tangentially related though, what would make me really happy is if we > could create the string with in the TP__fast_assign() section. I have to > have a bunch of annoying wrappers right now because the string length > has to be known when we invoke the tracepoint. You can use __string_len() to determine the string length in the tracepoint (which is executed in the TP_fast_assign() section). My clean up patches will make __assign_str_len() obsolete too (I'm working on them now), and you can just use __assign_str(). I noticed that I don't have a string_len example in the sample code and I'm actually writing it now. // cutting out everything else: TRACE_EVENT(foo_bar, TP_PROTO(const char *foo, int bar), TP_ARGS(foo, bar), TP_STRUCT__entry( __string_len( lstr, foo, bar < strlen(foo) ? bar : strlen(foo) ) ), TP_fast_assign( __assign_str(lstr, foo); // Note, the above is with my updates, without them, you need to duplicate the logic // __assign_str_len(lstr, foo, bar < strlen(foo) ? bar : strlen(foo)); ), TP_printk("%s", __get_str(lstr)) ); The above will allocate "bar < strlen(foo) ? bar : strlen(foo)" size on the ring buffer. As the size is already stored, my clean up code uses that instead of requiring duplicating the logic again. -- Steve