From patchwork Mon Jan 22 07:40:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Bin X-Patchwork-Id: 19229 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp2416661dyb; Sun, 21 Jan 2024 23:38:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IFrQfjKEZr8i4AcAyYC5Vy+6ejXUjvxBFLCGVoI7PjewoPsb59gcRCvO97RDgZnQkOAkTZr X-Received: by 2002:a05:6402:1c82:b0:55a:e519:f533 with SMTP id cy2-20020a0564021c8200b0055ae519f533mr1588301edb.23.1705909106016; Sun, 21 Jan 2024 23:38:26 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705909106; cv=pass; d=google.com; s=arc-20160816; b=Q9ZJr5Q/AggmnrWxdOUSL3Zsob4u+W9yuxxxDu4HnKejdK1aMPvEGQ9U6GJjEffqbH JirkqXMYEX6ZS7lf/YH98qAmR5Qfhfs3SFADeIHsMq9I3zPBQd9w9ZIEqvrvj26FI6rA tVPM32YBf1+Dtc9Eu2PEv/+0WNmsAmw9+0jnl6G4ecvsJummFG+uaSQ5UweaN4DIqDks NQfzVjueg7bhF0ud+7lsW2lDd13u3FKV8LgSlmakfYcEWZFNe3KFCoQ6AkvY6jtmpjr+ vVfNdAVtbjHyVYYG0/U5lvlmNe1B4pAG511rPRuzeAg8plxz+5uU5cJbkHvnxlxuZiSG r4NQ== 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-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32435-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id fi23-20020a056402551700b005588b35087asi10524062edb.307.2024.01.21.23.38.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jan 2024 23:38:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32435-ouuuleilei=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-32435-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32435-ouuuleilei=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 A06041F2309B for ; Mon, 22 Jan 2024 07:38:25 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 02BE518640; Mon, 22 Jan 2024 07:37:55 +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 X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To canpemm500010.china.huawei.com (7.192.105.118) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788775346558732704 X-GMAIL-MSGID: 1788775346558732704 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