Received: by 2002:a05:7412:ba23:b0:fa:4c10:6cad with SMTP id jp35csp1445780rdb; Fri, 19 Jan 2024 22:27:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IF5MCKc9RHalHfvlDx45UrZIRS36JQ1MsUEKoM73W2BGV7fUwNMhBoKTHCJyWX9S/Masv8j X-Received: by 2002:a05:6512:3403:b0:50e:7a9c:e1f1 with SMTP id i3-20020a056512340300b0050e7a9ce1f1mr391649lfr.126.1705732021455; Fri, 19 Jan 2024 22:27:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705732021; cv=pass; d=google.com; s=arc-20160816; b=lOdzPnS4WJeQ7KTRvw+CA4FuorojfXTGBEi1U0gdwCuKr8Umi7Hc6FHieSXxMf1VvP 9r930MANFbquR5fHbcPMvUGT8eH4RSh5k+3CHgMG6lVKyGDoWjQq82kYpiYYIbMpnpB6 TTIJx3Ucpx9k7Az37Bt3WKnCK48q3+yI+SW1okUqw0aFaWWZAVs81dR5gq568RJR69r/ myfEFDE54S90ms9BV+zTnkXGFJQ6dxb96qWefAellkFHKgiBoLnk7UBcQU3n4NSyU7MO pjYpspYDhCuiWeGWPWSAUMGo5cJ6EqxZex9I06/b4+JY/fK4CgEpk/5gK9aE/yzcoQRC 1PqA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:date:message-id:from :cc:references:to:subject; bh=hp4O8xuHM0vYJOSNb2yHcCSzBRUQrvLC7JkpX9bq3YY=; fh=U7+Kl4iOc6GRDohPpdpak/XYrqxg+RT6K7OQcA7TI3I=; b=j1OCGRP2gNidtt2f2b/8hxyvdNvz9/5Fx778sjwxR71bqKGPoe0JQGpJHR+LOOSXzw o+h+eBuxGeU46e89UQWYhcVEmppsPGhjKyyCJLxZcYcVdLFqWwM0rA54ctdEGA0CNqzK z8nJ+et3fHotsumSwq5iGbsVeoFSB/TyQ/QNYa4BbL1vZpWqTQcwXaobnrEkQBw2Zlz8 ycbY15bRdPTnAOQH2iy72gsQsLl5IAqSZH7Uo6p1CtfF0PQ/IaCI7NeDDySBbx5/eekp P17yF8W4Q2+viNo6AgaZaGIwVR08a3w+ZLn9BNnsjKI071uQk20jKb5D+9/E9JKkgXcZ Pk/w== ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-31716-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id s13-20020a1709066c8d00b00a2e9f5d839fsi3861772ejr.466.2024.01.19.22.27.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Jan 2024 22:27:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-31716-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huawei.com dmarc=pass fromdomain=huawei.com); spf=pass (google.com: domain of linux-kernel+bounces-31716-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-31716-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 1FFCF1F2293F for ; Sat, 20 Jan 2024 06:27:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 332181FD8; Sat, 20 Jan 2024 06:26:54 +0000 (UTC) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (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 539ED1856; Sat, 20 Jan 2024 06:26:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705732013; cv=none; b=mOEu/Gjl3ZnTRbEm2Mwf/fAEC/6LpKJ4TKIyKZWXCGB3B8QrtqEGvKNekt6MOkA3a6f3zQYg7dcwXjZ6X26U8iG3atg7z1MXGXgpSrpZLPtiXTIm51Cc4mjLwCmuyvqxaGwTUhIHBu6/6FTKkIeyAsm/Jk4wbX2zLJerFyBhuXs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705732013; c=relaxed/simple; bh=z0u6S3vvz6Wa3U8Vbzh/1y+xQOvDrXCzXXQdLEA1UBk=; h=Subject:To:References:CC:From:Message-ID:Date:MIME-Version: In-Reply-To:Content-Type; b=LQGkY15DAJeGysjiw8c/8LngYAthrFMLyTbbmIOL6VS+ccTnt7WTM8Iq41OPBwQ14QUzpGuGuDF99CD5lWLB5s/rmNb9tTcJ4pWQmgG9Sn7DtHsyUg3+pm6spp0EL9VHW5Ffa72xV3y6FTy/HMufCIpjCzrBicl6ouGqLcY78U4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.191 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4TH60X16yFz1gxkm; Sat, 20 Jan 2024 14:25:00 +0800 (CST) Received: from canpemm500010.china.huawei.com (unknown [7.192.105.118]) by mail.maildlp.com (Postfix) with ESMTPS id 937421A0172; Sat, 20 Jan 2024 14:26:40 +0800 (CST) Received: from [10.174.178.185] (10.174.178.185) by canpemm500010.china.huawei.com (7.192.105.118) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Sat, 20 Jan 2024 14:26:40 +0800 Subject: Re: [PATCH 0/3] support '%pd' and '%pD' for print file name To: "Masami Hiramatsu (Google)" References: <20240119013848.3111364-1-yebin10@huawei.com> <20240119234356.1598e760edbfa58f5440a941@kernel.org> CC: , , , From: "yebin (H)" Message-ID: <65AB679F.9070402@huawei.com> Date: Sat, 20 Jan 2024 14:26:39 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240119234356.1598e760edbfa58f5440a941@kernel.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500010.china.huawei.com (7.192.105.118) On 2024/1/19 22:43, Masami Hiramatsu (Google) wrote: > 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, Thank you very much for your suggestion. I will re-implement this function according to your suggestion. >> 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 >> >