Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp171394rdb; Sun, 21 Jan 2024 23:38:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IEniXF8J3KhJUYRSgpqVJH/bBXI29Sg3wPKiSK8B40nYQlgdM1V038WKczGYKLuWVEjAgRq X-Received: by 2002:a17:907:c908:b0:a28:88d6:5d9c with SMTP id ui8-20020a170907c90800b00a2888d65d9cmr1316621ejc.131.1705909096322; Sun, 21 Jan 2024 23:38:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705909096; cv=pass; d=google.com; s=arc-20160816; b=v36+xt6YN/4L2kf1Rs22M+5i1zV+uDWSKURvaWUZlrAD0AuRNWxCLE0HjLe548wFAO QaunDCPueg4G0uZGyy2sTIUsr1W+vxbwNJ13RRi2jVhDqNn1/8Vf0WQX8CDR8cjlfPEH HhbxwWf2ql531YPNSDZZQ2/Yhfc7yrGr/m8x2fJJXGOh9j8H7+AOweZDFwZlhWomS/Nx Ajvq8wFh0cvif5jA54B4Nr3sQk1/ZqRW0yHyMZhF53fkOWb20YvqT/YBh0BHTonhrzVd t6beWmAzP1tL04/KYBqr/tGsuJNwggk5NfGRM+VPUfEtRJ0qEBqJcoUPpk/ymMKgYMQ8 YO/A== 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:message-id:date:subject:cc:to :from; bh=EAJn306lU8xLUexxL5O4/wSSn/JmreVgmqf/ylu8z1M=; fh=Us/DORbzHj5XmgnBeJW+VlCBdo2pSXKHAejHonylCvY=; b=txY9NMwqtDnTfWfO/v8Oa5I15VJyTQaShQBq9x/YC+7hI50T7fgWo4EVLLfqf+JYXh Ckuc/9cqx5Bs93QKqeCgsqZpSKqKzimqqw3NryutEshfBFdSjvnsimknQ1UD2y8a0WL5 rVBAe7O5sH2zhUfV3hCit8Rw9i0dJ4lzmPKa87yH34BUMmh/blCJIuBu9AkKTlc6djnV YQgrhD4NXFDC1Dl+H74K+V7WOCRCd42Lt8jzrxTVC+0+eK1xgLp1USAV6jUgxhPOIxi5 d2Rmm1gUAPlVwLRds7YcfrZQZVrWvFKDhLliUNjjN+BzZIEsH3x4kjWccU7RO9Ca4VRo Uc1Q== 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-32435-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32435-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id p5-20020a1709061b4500b00a2d357afac6si8267051ejg.300.2024.01.21.23.38.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jan 2024 23:38:16 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32435-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; 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-32435-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32435-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 1928F1F22A9A for ; Mon, 22 Jan 2024 07:38:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F296117BDB; Mon, 22 Jan 2024 07:37:53 +0000 (UTC) Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 2317D16410; Mon, 22 Jan 2024 07:37:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705909073; cv=none; b=WTJM4q6GYXmG+FokHZIMlJqsaqcrdh0WlurCKV2g8r6g97trtMG+SDHJ2kJb5P1jtjBET/QBQwt9GcwM3pepo5DLKAhX2LwGgo9qAB4YMOpzWGjtB0CjOgVKFIuGelUc5GV/sdqpPZiKC/9fkpMiQqhwsMZRUQWOFdsyo9DD72Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705909073; c=relaxed/simple; bh=dwg7fEKyPCidxs40PwHs/24PyKN/EeAm2a7dSGR0l+E=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=mBF3ixqccjF3NI/EO0Oa6zOdQQVjFBGnFh9Yt4oV/8CtSBflGvKVFiyfSY5aJRI1FYI2yyeaK58t6gBHzWTulrAcmUzliZPPs1tre7/kWrsZSCRkqKyprUALN3YE3az6vmCwqfZncRdDcaAcwc6amxU3HHIc6498IxLZRtmyCYY= 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.188 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.174]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4TJMW6168HzbcFx; Mon, 22 Jan 2024 15:37:22 +0800 (CST) Received: from canpemm500010.china.huawei.com (unknown [7.192.105.118]) by mail.maildlp.com (Postfix) with ESMTPS id 40E80140428; Mon, 22 Jan 2024 15:37:44 +0800 (CST) Received: from huawei.com (10.175.127.227) 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; Mon, 22 Jan 2024 15:37:38 +0800 From: Ye Bin To: , , , CC: , Subject: [PATCH v2 0/7] support '%pd' and '%pD' for print file name Date: Mon, 22 Jan 2024 15:40:08 +0800 Message-ID: <20240122074015.4042575-1-yebin10@huawei.com> X-Mailer: git-send-email 2.31.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500010.china.huawei.com (7.192.105.118) 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. Diff v2 vs v1: 1. Use "%pd/%pD" print format instead of "pd/pD" print format; 2. Add "%pd/%pD" in README; 3. Expand "%pd/%pD" argument before parameter parsing; 4. Add more detail information in ftrace documentation; 5. Add test cases for new print format in selftests/ftrace; Ye Bin (7): string.h: add str_has_suffix() helper for test string ends with specify string tracing/probes: add traceprobe_expand_dentry_args() helper tracing/probes: support '%pd' type for print struct dentry's name tracing/probes: support '%pD' type for print struct file's name tracing: add new type "%pd/%pD" in readme_msg[] Documentation: tracing: add new type '%pd' and '%pD' for kprobe selftests/ftrace: add test cases for VFS type "%pd" and "%pD" Documentation/trace/kprobetrace.rst | 6 +- include/linux/string.h | 20 +++++ kernel/trace/trace.c | 2 +- kernel/trace/trace_kprobe.c | 6 ++ kernel/trace/trace_probe.c | 45 +++++++++++ kernel/trace/trace_probe.h | 3 + .../ftrace/test.d/kprobe/kprobe_args_vfs.tc | 79 +++++++++++++++++++ 7 files changed, 159 insertions(+), 2 deletions(-) create mode 100644 tools/testing/selftests/ftrace/test.d/kprobe/kprobe_args_vfs.tc -- 2.31.1