Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp68518rbb; Fri, 23 Feb 2024 12:02:01 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW0Ea4AGA+wwRU1ILNoXjOJW9PmOZqdnRl7q4hBFs4HRICkkRO9CtMzgVVzI6sD8A2MJu1Dtt9bZwTJbfUpAgmQb7f2TjdtTgaZJmWWNg== X-Google-Smtp-Source: AGHT+IGvoML9Kx6gtB9IEGEPmVt700opsuCEJ3i2m/pdZuUr+MFvaD5QMYMA2czPOldgBneOFN6c X-Received: by 2002:a05:620a:3b95:b0:785:c078:9fd2 with SMTP id ye21-20020a05620a3b9500b00785c0789fd2mr909109qkn.25.1708718521113; Fri, 23 Feb 2024 12:02:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708718521; cv=pass; d=google.com; s=arc-20160816; b=zkZt+KVhfIvw16/G6+VIHeiFwjLGygZp0sxPSXKXrtus4RKe+t8sO3TKHW4YHLk+n6 zSCWn7Cig0bhLqidfmvY7TSir3bEIzr+HWtzIiAd+mHofRuxYRu3xhp8Kkrhl8xH5gXd IlMjdVHAroEGS92CgOUYjSFJz9weaO7INr5WxPte5lvxhSoVJPy3rjl1kdMbnvgu0B8P fMez1D8H0hFh8NNgznq/yNNRJkwpcuIeh3v0/wdATIYYJ1I8SU6Zin410YN/mOasrkEl OeKRExVRj4Xr/Y4KqBGZWdEIPEvTtDuPzuXrRC3Z8BEzhMs9dq1RMKFMI+hjoHxhWp4E Gv8A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=DU2NoxvEkiqB91Rg1/kTiKe/8v9P5M7YGnkA7Gr32Yc=; fh=P0acuNBGG9PtrTZXqCqdi+RgzLDf9ZMVIwodS4DLTnI=; b=slOjTIHfXDeXaYqT/0D9ev5k4fpX/Ah6vx6yVwoD4NDnnrvqikz3cGB3I48pZ/cnIP kAq6xUBb8FjxqIK75fA3ZV9pCG1ROdP9ZUnuhzDmV6KQTzA5t12Gx1OZV2CRJYYDTxq8 qjeT/oKsKb4ETJZCpD1/yz0haCiB/qmeHMzpY3yB9VsEiqqLOEtAd0U5LkLmbUk8KRMu LZYYYIrjAbToPVVQObsSypSYLyrm0PTLwRWk+xNb/dx3iIplVikgixWHwyEWQ77rCI9D MuCyMYQAWN+kTnne2Abw95w6QsI6oM4Gg2Cd6ozxYRV4OI+JRYyahb/j7WrSKFuQcEL3 kAww==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-nfs+bounces-2067-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2067-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id xq2-20020a05620a5ca200b007877dda7e93si7666872qkn.520.2024.02.23.12.02.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Feb 2024 12:02:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-nfs+bounces-2067-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-nfs+bounces-2067-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-nfs+bounces-2067-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D61361C23117 for ; Fri, 23 Feb 2024 20:02:00 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 05561146E64; Fri, 23 Feb 2024 20:01:53 +0000 (UTC) X-Original-To: linux-nfs@vger.kernel.org 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-nfs@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