From patchwork Fri Jan 19 01:38:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Bin X-Patchwork-Id: 189372 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp734147dyb; Thu, 18 Jan 2024 17:37:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IG1yWe8KCwNclChjEMBADzFEfWFYz0bfPeg3XKC3+wkkk8oad+mra+1j9qVD0ByN1OpugsM X-Received: by 2002:a0c:e40f:0:b0:680:857:1bd9 with SMTP id o15-20020a0ce40f000000b0068008571bd9mr1465031qvl.82.1705628221279; Thu, 18 Jan 2024 17:37:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705628221; cv=pass; d=google.com; s=arc-20160816; b=kPZwPS/7KkbAgN2w77rYB95tLsPJn/SGNdkuqnLMTUk34oJzU5WvrJRBB30ipNnSzt aYVsfO41DZJPJWMKvFbDRx6OEhgLybD+afUbD93s5ubNFwSSkJb4ff8vbdUUb+gRs7V2 89E1o/BrC/9TS60X1N+yffULvUNvrtUXpvrNU0+UipWcz4u926BLujc7pr1qGBsR4nVN boFYWpFg9SNIUUjhRXgee1S5b8LlfkgEDm1b9rTUXDHCWvUJ1MtV3V3HGkpX6M0/y7fJ jL6jpXrj/UvOOY/E37aDz2YW3aq5lnuRJcZGjVYCkYUKR36eVm5BsT1Idbw1AlCGx2b0 SfIw== 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 :date:subject:cc:to:from; bh=mB3qy6uaaNqhA7Jj75BSZCwK3GeJXR+T54RmoHlqzyM=; fh=Us/DORbzHj5XmgnBeJW+VlCBdo2pSXKHAejHonylCvY=; b=iQgtPBQJCte6Bsqj6neya4PgOuwGai5MgtjK5gDw6h3KvvLzlZcB/F5LyRvGcP+mpv Z3F5I3g6bSryFXkf0YncAF41E429j2EzvyjWBi1rwPWRVxBNDAttxgGFvQbBrn1WnKTz WOPKOD1ad5Vi1Z/N/y519udOgrd2TJJZggLHwVrK+Nd8rAg1g1CddXTHiTSz7oeFXKuY ixnUIn8RrpV2/RWXtCOr8IOynVxCTdLfXDJSo73k8j2nk8xQ5xy6J3Qllyz08CJRw8Hh hFMDugGMd9uo+sCuH3k73SHpkxBSHqf8MU0gcxEuTb7yAF7GnQmfmcOzNl3X+3YcFdIs EwXw== 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-30686-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30686-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d4-20020a0cdb04000000b0067eec318cb1si4273834qvk.288.2024.01.18.17.37.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 17:37:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30686-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; 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-30686-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30686-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 187981C215AC for ; Fri, 19 Jan 2024 01:37:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 096C0523C; Fri, 19 Jan 2024 01:36:22 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (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 EC54BECE; Fri, 19 Jan 2024 01:36:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705628180; cv=none; b=mL2Aa8oGG7Arg+B0ODLwYrGtZJXlxv9fwVpFPiMmruRUkeDqwKRygUsNhiCorU5DZZcpExd2Pr5GMaxZVbknr71jOl3OeD0evrtmpulhPQYevEjx7VfmlVvQEwOJ7WHYM+y+FXW/WevKdwWePemDr8UWtYvmsiSAgFhczS0226s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705628180; c=relaxed/simple; bh=K1XydoNo9p2aYOEQJT2vpbYUCm3g6AGCAQTIxql3fBM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gEkXP+1dDjuZRGFsfXGu3/xrYkkp2DFCY7hDozlfcTV33egpVDWFCCT9X/IeLDOmgmen9Ilau/h+rHfR0cScZAsmwcfQDpJAfH1GYsZF4S49DKdiBwrVgavCDjsLIICtUoya91a9SVaK9hyq1t0/wd8apPc6NowBngX++FWcMlA= 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.190 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.44]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4TGMbv5TBDz29kHW; Fri, 19 Jan 2024 09:34:35 +0800 (CST) Received: from canpemm500010.china.huawei.com (unknown [7.192.105.118]) by mail.maildlp.com (Postfix) with ESMTPS id 566181404F1; Fri, 19 Jan 2024 09:36:15 +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; Fri, 19 Jan 2024 09:36:14 +0800 From: Ye Bin To: , , , CC: , Subject: [PATCH 1/3] tracing/probes: support '%pd' type for print struct dentry's name Date: Fri, 19 Jan 2024 09:38:46 +0800 Message-ID: <20240119013848.3111364-2-yebin10@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240119013848.3111364-1-yebin10@huawei.com> References: <20240119013848.3111364-1-yebin10@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500010.china.huawei.com (7.192.105.118) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788480817838659380 X-GMAIL-MSGID: 1788480817838659380 Similar to '%pd' for printk, use 'pd' for print struct dentry's name. Signed-off-by: Ye Bin --- kernel/trace/trace_probe.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c index 4dc74d73fc1d..460f98b85b1c 100644 --- a/kernel/trace/trace_probe.c +++ b/kernel/trace/trace_probe.c @@ -11,6 +11,7 @@ */ #define pr_fmt(fmt) "trace_probe: " fmt +#include #include #include "trace_btf.h" @@ -86,6 +87,8 @@ static const struct fetch_type probe_fetch_types[] = { "__data_loc char[]"), __ASSIGN_FETCH_TYPE("symstr", string, string, sizeof(u32), 1, 1, "__data_loc char[]"), + __ASSIGN_FETCH_TYPE("pd", string, string, sizeof(u32), 1, 1, + "__data_loc char[]"), /* Basic types */ ASSIGN_FETCH_TYPE(u8, u8, 0), ASSIGN_FETCH_TYPE(u16, u16, 0), @@ -1090,6 +1093,25 @@ static int __parse_bitfield_probe_arg(const char *bf, return (BYTES_TO_BITS(t->size) < (bw + bo)) ? -EINVAL : 0; } +static char* traceprobe_expand_dentry(const char *argv) +{ + #define DENTRY_EXPAND_LEN 7 /* +0xXX() */ + char *new_argv; + int len = strlen(argv) + 1 + DENTRY_EXPAND_LEN; + + new_argv = kmalloc(len, GFP_KERNEL); + if (!new_argv) + return NULL; + + if (snprintf(new_argv, len, "+0x%lx(%s)", + offsetof(struct dentry, d_name.name), argv) >= len) { + kfree(new_argv); + return NULL; + } + + return new_argv; +} + /* String length checking wrapper */ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size, struct probe_arg *parg, @@ -1099,6 +1121,7 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size, char *t, *t2, *t3; int ret, len; char *arg; + char *org_arg = NULL; arg = kstrdup(argv, GFP_KERNEL); if (!arg) @@ -1182,6 +1205,16 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size, parg->count); } + if (!strcmp("pd", parg->type->name)) { + char *temp; + + temp = traceprobe_expand_dentry(arg); + if (!temp) + goto out; + org_arg = arg; + arg = temp; + } + code = tmp = kcalloc(FETCH_INSN_MAX, sizeof(*code), GFP_KERNEL); if (!code) goto out; @@ -1243,6 +1276,10 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size, goto fail; } } + + if (!strcmp(parg->type->name, "pd")) + code++; + /* If op == DEREF, replace it with STRING */ if (!strcmp(parg->type->name, "ustring") || code->op == FETCH_OP_UDEREF) @@ -1321,6 +1358,7 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size, kfree(tmp); out: kfree(arg); + kfree(org_arg); return ret; } From patchwork Fri Jan 19 01:38:47 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Bin X-Patchwork-Id: 189374 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp734238dyb; Thu, 18 Jan 2024 17:37:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IG+yuvtKeUfmDaAxigohjmiXSuBBJwfzfBaVUQCocFmaKTPDudIG9s4ab9L3AAEVsnpkMg6 X-Received: by 2002:a50:fb83:0:b0:55a:6a:8655 with SMTP id e3-20020a50fb83000000b0055a006a8655mr1073984edq.66.1705628234213; Thu, 18 Jan 2024 17:37:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705628234; cv=pass; d=google.com; s=arc-20160816; b=iuMqOAVs1dBiaqeuskIyVtA+Hf8IWARhJjYOFYhmAu1hO/73lRk24qHBqM+BXAYcMW sJzt4+VDMWpcv2xm96qoiqnYk1T4LFBpa0oV/xU4G3KzgVR7/ATICVyF64n/uCBqcBuS YzPQhvx7tnAbt9eEdChToqwzeCDET8mkLkawvxiQErrOKTr6Vrb+Qr58VHHpB3jVUW4z mJxrM7I27a1nThPrnz5P2ZJ2PzCyGevPPIql2ykVBy3gtNWIdbIwMr35L9H0d7+OCm2+ aJ056twcDfioNLNS+YJJcDGSjrlyyPvm2UHoXZ7KRdSuM83XAvt+sLXN20NhCrn5/ZGe XJ9g== 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 :date:subject:cc:to:from; bh=wfgHjHtmw0px4uSXCu15VJZAOYdqfEfqQw6KwQLKsFY=; fh=Us/DORbzHj5XmgnBeJW+VlCBdo2pSXKHAejHonylCvY=; b=sAZfskmQTh1+XYJifIo8xYzq/N6zpviIDMYSAMo7dtmDcpklcvJXbZcWvHa2740gHJ vmdb46uJlZLw3fpcNY42zFLnadN3pQnCNYAl7ccXjulby/puOaE3qJSnilKwCwCPgyIx BDd6qtWZNqF6xq9e/aONAQ+e2lxYf+PpjsT9KMiE0xc/aAI58vclB/pb9WmWDqCOYa0Z eyNS7R0s4Wfr5eS8aNrJIEeqpKxEYUyaokNQE8Z3wj2PYH1rBtCFovXsX48CVr98TAt8 Z5mIT6skPinmFcLHNfSkoYI5TLRKcodENXaG6ucZoU0bxU9G0SVwPzK9xVhf7rz15k31 5vYQ== 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-30688-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30688-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. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id cm16-20020a0564020c9000b00559ef78e8fdsi1623281edb.685.2024.01.18.17.37.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 17:37:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30688-ouuuleilei=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-30688-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30688-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 CD2FA1F2222F for ; Fri, 19 Jan 2024 01:37:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C6B4879C5; Fri, 19 Jan 2024 01:36:22 +0000 (UTC) Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) (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 48B24ED9; Fri, 19 Jan 2024 01:36:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.190 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705628181; cv=none; b=IcLK54/OOoCcLycL+qf+i3rF+eABVCAjG03V1lpg8W/83nQLGcrM7q9c+NbVSUOjGJ7+YDvKf2mp3P/OvrAwt5UcTx5T8LqX3raogkQdOox8q60+qLSezbH9SGzEr/XuaUqB3EXD38+g2EVgklPFW055Jzm2hroae1owk8wJZu4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705628181; c=relaxed/simple; bh=9v9m7nPcfnEvdIhqDenml4Or78lsJCXEaQSzOCTjMqs=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qKhtvSkchW48cYhzLHdf6tbnioT54wMRkc+YbCP8TtRMl7KMmT0Uo1jw7E0lo6gTY0Tf170ABdxi7NX9uPBltX4xRTBb+HfuT8KYVmqXW3px82ObpkfJQFqvMXnk/ZF1pWGQ/PDZ/4CsS36pTFMZOLcmn4/YDrUe6OtGFe2OuBU= 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.190 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.88.234]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4TGMcx0wGTz1xmR9; Fri, 19 Jan 2024 09:35:29 +0800 (CST) Received: from canpemm500010.china.huawei.com (unknown [7.192.105.118]) by mail.maildlp.com (Postfix) with ESMTPS id C0304140113; Fri, 19 Jan 2024 09:36:15 +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; Fri, 19 Jan 2024 09:36:15 +0800 From: Ye Bin To: , , , CC: , Subject: [PATCH 2/3] tracing/probes: support '%pD' type for print struct file's name Date: Fri, 19 Jan 2024 09:38:47 +0800 Message-ID: <20240119013848.3111364-3-yebin10@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240119013848.3111364-1-yebin10@huawei.com> References: <20240119013848.3111364-1-yebin10@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500010.china.huawei.com (7.192.105.118) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788480830854416093 X-GMAIL-MSGID: 1788480830854416093 Similar to '%pD' for printk, use 'pD' for print struct file's name. Signed-off-by: Ye Bin --- kernel/trace/trace_probe.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c index 460f98b85b1c..400a1dd52c39 100644 --- a/kernel/trace/trace_probe.c +++ b/kernel/trace/trace_probe.c @@ -12,6 +12,7 @@ #define pr_fmt(fmt) "trace_probe: " fmt #include +#include #include #include "trace_btf.h" @@ -89,6 +90,8 @@ static const struct fetch_type probe_fetch_types[] = { "__data_loc char[]"), __ASSIGN_FETCH_TYPE("pd", string, string, sizeof(u32), 1, 1, "__data_loc char[]"), + __ASSIGN_FETCH_TYPE("pD", string, string, sizeof(u32), 1, 1, + "__data_loc char[]"), /* Basic types */ ASSIGN_FETCH_TYPE(u8, u8, 0), ASSIGN_FETCH_TYPE(u16, u16, 0), @@ -1093,18 +1096,26 @@ static int __parse_bitfield_probe_arg(const char *bf, return (BYTES_TO_BITS(t->size) < (bw + bo)) ? -EINVAL : 0; } -static char* traceprobe_expand_dentry(const char *argv) +static char* traceprobe_expand_dentry_file(const char *argv, bool is_dentry) { #define DENTRY_EXPAND_LEN 7 /* +0xXX() */ + #define FILE_EXPAND_LEN 15 /* +0xXX(+0xXXX()) */ char *new_argv; - int len = strlen(argv) + 1 + DENTRY_EXPAND_LEN; + int len, ret; + len = strlen(argv) + 1 + (is_dentry ? DENTRY_EXPAND_LEN : FILE_EXPAND_LEN); new_argv = kmalloc(len, GFP_KERNEL); if (!new_argv) return NULL; - if (snprintf(new_argv, len, "+0x%lx(%s)", - offsetof(struct dentry, d_name.name), argv) >= len) { + if (is_dentry) + ret = snprintf(new_argv, len, "+0x%lx(%s)", + offsetof(struct dentry, d_name.name), argv); + else + ret = snprintf(new_argv, len, "+0x%lx(+0x%lx(%s))", + offsetof(struct dentry, d_name.name), + offsetof(struct file, f_path.dentry), argv); + if (ret >= len) { kfree(new_argv); return NULL; } @@ -1205,10 +1216,11 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size, parg->count); } - if (!strcmp("pd", parg->type->name)) { + if (!strcasecmp("pd", parg->type->name)) { char *temp; - temp = traceprobe_expand_dentry(arg); + temp = traceprobe_expand_dentry_file(arg, + parg->type->name[1] == 'd'); if (!temp) goto out; org_arg = arg; @@ -1277,7 +1289,7 @@ static int traceprobe_parse_probe_arg_body(const char *argv, ssize_t *size, } } - if (!strcmp(parg->type->name, "pd")) + if (!strcasecmp(parg->type->name, "pd")) code++; /* If op == DEREF, replace it with STRING */ From patchwork Fri Jan 19 01:38:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Bin X-Patchwork-Id: 189373 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2bc4:b0:101:a8e8:374 with SMTP id hx4csp734167dyb; Thu, 18 Jan 2024 17:37:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IGzm3aKRww42ZSY26bNBmKJREOPQPCa4Mf4WF3IXCPBMvkCUUrPXFm5aUy2Whq664qt6Qqr X-Received: by 2002:a05:6214:400c:b0:683:29e6:9171 with SMTP id kd12-20020a056214400c00b0068329e69171mr280266qvb.51.1705628224070; Thu, 18 Jan 2024 17:37:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705628224; cv=pass; d=google.com; s=arc-20160816; b=NIKlF7YTWVbEBJZBjOfPAo61iL7reu5gpA8iuJUusRMgy5A2vhhamRs1fT8OyAlZcI 6Gg7BY2P3XuLs3FB5iXymvLvUUWjp8xcZ3PQ2DTV4gf47RZZqrHd8yBgQ8kkUFelNNpi Qz+FfgzX/79f8h5RzHgnm1meWIilzQX3ZAm9YMWsf4irV76EkGjXn4ec2xtbuB6Dyns8 KbfGILboK+uoAyizWNY3JbUf7I0xRyTEgyJscnQ4PlFMNWJkVdaezyFHNoJNt6HdNYw1 fRObGdEZv0aoQAUHSmRNmZtSOWD7xxNq76f03t6N35+V7yIslAMxIdH4/EYCEriMW6OS 5z+Q== 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 :date:subject:cc:to:from; bh=R5x93yB3/qsru5o4ySzkfQhNeMAI92LolmpvOe1vva8=; fh=Us/DORbzHj5XmgnBeJW+VlCBdo2pSXKHAejHonylCvY=; b=CSzWemMUxLOXPL0eMji+OgjTs3ZQvwWcSwvvoCZRB5zwkKpmxlFTSv9wTPsFprU0T5 BX4ZVVZvlTTzBmVzh/H5HNco23SNBVS0061eoXr4Ps487J4DGMe/LpfpdaeRfglZYQAh 7a2qYeyahOFBC2I3tFhDKcKhQnl3UKXEC0s21PndK9/+R4jS7RTcbLOo/dICRSJf2sWg Dix5k0kiLx9VGgIuh2r8SuYd13yDhTfe9Jb4/fRQBQupYThwsb4OmYxrp8czg5xAz/gC PJq4VSsEdJEJaRygeryc+R4gbIlUdFuK2Af9sMqvaEZI7LCj5x1qo4wAZphfzjCtq4x4 vVBA== 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-30687-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30687-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a3-20020a0cca83000000b00681b44eed98si864223qvk.136.2024.01.18.17.37.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jan 2024 17:37:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-30687-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; 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-30687-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-30687-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id D654F1C225AF for ; Fri, 19 Jan 2024 01:37:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2375F5664; Fri, 19 Jan 2024 01:36:22 +0000 (UTC) Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) (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 B1F25EDF; Fri, 19 Jan 2024 01:36:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.35 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705628180; cv=none; b=Cm3io+4BMM6tvXu1j4CkV1ew1a8w9qnQc54NyC30/ar4gEI0L0vBN1W9HenkEzzXbZFs3R3vjw13zz9aLQLgeDblU5pWndfKnh/NlXJjVDIdlF6LCtmbqPwfnUd+wm/Zs79eqWs02bi7lm4g42SMc6qNs7gJa98vpITcmXRYi5k= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705628180; c=relaxed/simple; bh=gvMic+SUaGsheZzeoA0LsnGF1GeRG6IfE+uPM9oLPYI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=tTeHpfek5Rbn/nKQFAhOy9Va5bseWzLWOqSROJNaTgkjvHGrQUvyFlDv828v0tiCJAmp99Z64QW/ee8x4LD48IX/weZxqgGfGxylk70GGzXeJ3hMBrwFFJjgXPp+JjdI3EPHw6FrJAneZ5GpzgI9TQS0zdtJcVmVKUnBICNYKKY= 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.35 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.88.163]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4TGMbw2BPpz1V4MQ; Fri, 19 Jan 2024 09:34:36 +0800 (CST) Received: from canpemm500010.china.huawei.com (unknown [7.192.105.118]) by mail.maildlp.com (Postfix) with ESMTPS id 3585418001A; Fri, 19 Jan 2024 09:36:16 +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; Fri, 19 Jan 2024 09:36:15 +0800 From: Ye Bin To: , , , CC: , Subject: [PATCH 3/3] Documentation: tracing: add new type 'pd' and 'pD' for kprobe Date: Fri, 19 Jan 2024 09:38:48 +0800 Message-ID: <20240119013848.3111364-4-yebin10@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20240119013848.3111364-1-yebin10@huawei.com> References: <20240119013848.3111364-1-yebin10@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To canpemm500010.china.huawei.com (7.192.105.118) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1788480820674907992 X-GMAIL-MSGID: 1788480820674907992 Similar to printk() 'pd' is for print dentry's name, and 'pD' is for print file's name. Signed-off-by: Ye Bin --- Documentation/trace/kprobetrace.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Documentation/trace/kprobetrace.rst b/Documentation/trace/kprobetrace.rst index bf9cecb69fc9..c46c5d0a25e6 100644 --- a/Documentation/trace/kprobetrace.rst +++ b/Documentation/trace/kprobetrace.rst @@ -58,7 +58,8 @@ Synopsis of kprobe_events NAME=FETCHARG : Set NAME as the argument name of FETCHARG. FETCHARG:TYPE : Set TYPE as the type of FETCHARG. Currently, basic types (u8/u16/u32/u64/s8/s16/s32/s64), hexadecimal types - (x8/x16/x32/x64), "char", "string", "ustring", "symbol", "symstr" + (x8/x16/x32/x64), VFS layer common type(pd/pD) for print + file name, "char", "string", "ustring", "symbol", "symstr" and bitfield are supported. (\*1) only for the probe on function entry (offs == 0). Note, this argument access