Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp1046142rdb; Fri, 19 Jan 2024 06:44:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IHIOPDkHyMyaA8Hwqqs95wpSfHwo/jK1R8e8H5fYtEx/ALYydX+rGlfVvcNJZmYWddzMIBb X-Received: by 2002:a05:6871:c407:b0:210:96c3:14c6 with SMTP id ch7-20020a056871c40700b0021096c314c6mr2304123oac.66.1705675453827; Fri, 19 Jan 2024 06:44:13 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705675453; cv=pass; d=google.com; s=arc-20160816; b=vCfTbApyRuKzfP74HfP7UcXjUqzO5ggJdK9Yt25MfsFKDPnT+ZHi+QOc7+B0D5hU/r TGUWKRfXi5ctMfWb0Ip/6PUhYhVXdzMx0TxNWdw7TOdxVNbfPXv51xjZd9M9rvUJiVL+ Iy1RyKlFD7Rrxphb3ccbJi7qq0/gUSpRdqo/Tn6wP7p+OZ19FHXVvTbVQlkoJc2WGDlR pcdCb5FsfUo9HOK0BbUncz3JimTvFo+b6ZDqLv6q4WTdkrAz4aixrO9QiFlaD96fm2kf e5MNR2XGkedkrX03Fbuzc9YaUb451rZvcgjG1xCNoVW8YSFDcXFdadRhXqh8/N7RROjo f1vA== 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:dkim-signature; bh=YepEHZAMRSPWE6SnPe3fIoB4C2rs18mjUPtUGO97QJU=; fh=Cg71qZKzR4YfOJF8hZF4uwq7cJbJuaEt0vZOj81Q828=; b=jEqqOGiGAOOT3clIbUS5BExWTZkZyZZyJ4oJbGJCrsIgG5yU4aGTWlva6artZ556Xx O4oFxIOvXKjBznbFBvhfD7YeP39JCFtjboBQtRAEpapyPjp0Je7izOsbIzYTd0OSQ1Iv MtVcsp1GVCsDm9afFqhH1184wsLu3JAUpYKOMCfP8LHqruUoe7Y1zKXaKDOZGOkdjhtv rtDA8q9Z2KMYNIN5hKLlnSPitomEVOyR1F1dHPfYepUSA4CeZsbtwbj9eQ5hhYeyFQ9f spOmWIzONUPjBbougbhiik/gkIBztzAhcBMW62rz5QH/ZW1DrozhEc52zYsJRrZD25FQ RIsg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U7z2tB1H; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-31267-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31267-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id o14-20020a63f14e000000b005c688ef7549si3475136pgk.98.2024.01.19.06.44.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 06:44:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31267-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=U7z2tB1H; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-31267-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31267-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 798C9B230E5 for ; Fri, 19 Jan 2024 14:44:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 37CD653E1E; Fri, 19 Jan 2024 14:44:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="U7z2tB1H" 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 5DF2853E05; Fri, 19 Jan 2024 14:44:00 +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=1705675441; cv=none; b=oTd6WTgr2sUDEl0z7NSj7NzawpSDO/4uXwLqVtpzThAN2XeeZ7o12d6v3CqMk+GwIrzksGeVK/zhICDwVY+JkzbfduQ2Uvcky2Tws3odT6HC2XlWvi6pMRF6kLbStNeVnM59uuYeO1rvn322QXYM1k9GA8IAqaAdpwVKHWdb6nE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705675441; c=relaxed/simple; bh=giuelcDxoe3oEfiTmrX+KQXnevAJ1smfRGB8PM+8Adg=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=mpn/GnjEaHF8LiMEx06lNgfSJYCK160Of0bu/dSsSPSqWwVfObCf0RlBwqpJqlPBKAO4bq3w0bJ/STWqXa53IW1kd9PI5+e4e0qJTngzTxEhhAz/OFV+1nK6sj5hTjwq+5lOaidL9CCrVXlqFQ1IA2mrV4MJ72ymXZ5+KHHthJ8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=U7z2tB1H; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0CEDAC43390; Fri, 19 Jan 2024 14:43:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705675440; bh=giuelcDxoe3oEfiTmrX+KQXnevAJ1smfRGB8PM+8Adg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=U7z2tB1HM2Mscia1BP49rUvb2Pm0QJAEwzhItzgbUvZolkTju6FMB9KMN01GKaNqX zzEUKyWstHcd8bQAnYDjk6xdowuYUfc8KdPcUG2rZ+DTd2DCTxHmFTQDdRoDVbhRZ1 MvS/6PBFmgj8EryvmC67XeZMP/oG6dmtOnkntl48QkIKwclBz93F6VzjUYmkCOZKB0 UEC7p82/eeVs6hZIMvg+Man3IS1LhKr23s5w957zvZQ+hdbFW7eUC3fxCryAjRfDyv HfGjKqFJMPEK+7pz/nvrQgrDlY496wS5GA0EnC8fJZDtF7DMrDo3eXtyX8Ivm2HdcR B1CQ5hOYhIj9Q== Date: Fri, 19 Jan 2024 23:43:56 +0900 From: Masami Hiramatsu (Google) To: Ye Bin Cc: , , , Subject: Re: [PATCH 0/3] support '%pd' and '%pD' for print file name Message-Id: <20240119234356.1598e760edbfa58f5440a941@kernel.org> In-Reply-To: <20240119013848.3111364-1-yebin10@huawei.com> References: <20240119013848.3111364-1-yebin10@huawei.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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-Transfer-Encoding: 7bit On Fri, 19 Jan 2024 09:38:45 +0800 Ye Bin wrote: > During fault locating, the file name needs to be printed based on the > dentry/file address. The offset needs to be calculated each time, which > is troublesome. Similar to printk, kprobe supports printing file names > for dentry/file addresses. Hi Ye, Thanks for your proposal! Generically, I think this type of hack is not good for the tracing because there are already some ways to do that. e.g. - Use perf probe to specify dentry->name:string or file->name:string - Use BTF to specify in the same way (but only for function entry) And those are more obvious what it does. However, if this is implemented in more generic syntax, it will be acceptable. For example, type specifying with "arg1:printfmt(%pD)" will be more generic because it is apparently one of the printfmt and output string. Or, maybe we can just allow to use ":%pD" as a fetch type (start with '%' means the printfmt) Also, could you update readme_msg[] in kernel/trace/trace.c if you add a type, and add a testcase of selftests/ftrace, for this feature? Documentation should also be updated with more syntax information. Thank you, > > Ye Bin (3): > tracing/probes: support '%pd' type for print struct dentry's name > tracing/probes: support '%pD' type for print struct file's name > Documentation: tracing: add new type 'pd' and 'pD' for kprobe > > Documentation/trace/kprobetrace.rst | 3 +- > kernel/trace/trace_probe.c | 50 +++++++++++++++++++++++++++++ > 2 files changed, 52 insertions(+), 1 deletion(-) > > -- > 2.31.1 > -- Masami Hiramatsu (Google)