Message ID | 1682414197-13173-1-git-send-email-alan.maguire@oracle.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp3274992vqo; Tue, 25 Apr 2023 02:21:05 -0700 (PDT) X-Google-Smtp-Source: AKy350YYg7t/hG0LnI1Uh4NY3SOvPEzdHy+07k5QgAIGFEZOBg7s2EUiOpWo2wUkfHsiXfCW5VJY X-Received: by 2002:a17:903:230d:b0:1a9:3b64:3747 with SMTP id d13-20020a170903230d00b001a93b643747mr17889599plh.17.1682414465289; Tue, 25 Apr 2023 02:21:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682414465; cv=none; d=google.com; s=arc-20160816; b=jmokbhQS98V6EzZ3134IwvOkij2smkwZ8gdrnBQv5Zfts2u4nQY7thil6KHeESBadj C40hTE94FL8Vo36U7ZOyiJsJeBPkmb6LMDjitzUvIz7wRVdws7wney7qtrkmITIrnmml 4+23Ka3FfayL6fbcHk2BvFB/gm5Uea3trEXUJSOyBJ9xMrZJkGFo2M6d6eTy6ABf4ukM 1e7/hdDxKxuJyQP+M0m7WKZOlJYhLI2q+2qMEsfjMs5d18eAug5seG5iysf6hR0/mnDi 709kXf9qXa7z8r5+FUKW34vCsJgn9EKMkDI9hQaN8NmTYOGJ87WdeMvMidSp+UTsMHN3 BHhQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from :dkim-signature; bh=Iwmnk6jemfDA0DsukXRfx0JJvZc9lihQgqmhxRnNZys=; b=k+jDjzsewa2pf32fcNvJFaWITCTB+rQ7WzTWqsRm1ti4qr/ZRvqfbA0HqWRDQy7SU1 PaFjGAsrHjRpAWsDeQvSsQ4oD/Dm9rvxztMyOoyyruBhD+8ENseBiQI4f4TtXa1wS9aU CgSOzGFPGz3Uz2sqx/2Gvd15Jo6BGyxMVSJ6uwsgNN9f3EOpscJh5EA59TJmcCQ8vTEy CZT0pcJCQeRdbxbjKi9KI23+Q206n4BtEjW1Jn+1DN7XtObhV5RH0sucZbTkFhVSDKO9 ZPFoAZW2mJBSS4aaDmnaTFRwLJYytMoZoKE2dRl8RmcbbEI5su1acTDm5kZvW/eRAyqY FKSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=M0PTmqi8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b16-20020a170902e95000b001a6f661f6absi13177668pll.470.2023.04.25.02.20.53; Tue, 25 Apr 2023 02:21:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=M0PTmqi8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233662AbjDYJQv (ORCPT <rfc822;zxc52fgh@gmail.com> + 99 others); Tue, 25 Apr 2023 05:16:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230491AbjDYJQu (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 25 Apr 2023 05:16:50 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABE7D1990; Tue, 25 Apr 2023 02:16:48 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33P0hubY031057; Tue, 25 Apr 2023 09:16:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id; s=corp-2023-03-30; bh=Iwmnk6jemfDA0DsukXRfx0JJvZc9lihQgqmhxRnNZys=; b=M0PTmqi877pQHTATqTSa56VT01zFtPJeom+dJ23/l13uM971UE+tTumhtzOnYscu+f6K BfttEa4eTx9oTQUks1jT8sMDRHESQgmMyjqL7A1qql8/oAxnQO5XiyXqmn/rXIlfeZZD bsQI6OwS66Wyizem5ZpHNNow5J+PVwmLYtwajFRgDdXB0ZxIX9JF/JTfmT7v76c1lhji wlSmfCWfiRAIisN+mjp/8ZZBLt4bY9oz2wXsgT1REfHbzZegkP+VzYF+chWl+6JodIRz JWZKFPi2BKvk6Oz3us9qNuK5E2TFCy6Vy9TuNRC0Z85+59WIsu0molkBWz4jVOKCE3t8 jg== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3q47mcvw50-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Apr 2023 09:16:42 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 33P812Bx024915; Tue, 25 Apr 2023 09:16:41 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3q461cdwbd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 25 Apr 2023 09:16:41 +0000 Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 33P93LCP024482; Tue, 25 Apr 2023 09:16:41 GMT Received: from myrouter.uk.oracle.com (dhcp-10-175-181-126.vpn.oracle.com [10.175.181.126]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3q461cdwa1-1; Tue, 25 Apr 2023 09:16:40 +0000 From: Alan Maguire <alan.maguire@oracle.com> To: rostedt@goodmis.org, mhiramat@kernel.org Cc: corbet@lwn.net, shuah@kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org, Alan Maguire <alan.maguire@oracle.com> Subject: [PATCH tracing 0/3] tracing: support > 8 byte filter predicates Date: Tue, 25 Apr 2023 10:16:34 +0100 Message-Id: <1682414197-13173-1-git-send-email-alan.maguire@oracle.com> X-Mailer: git-send-email 1.8.3.1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-25_03,2023-04-21_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 suspectscore=0 malwarescore=0 mlxscore=0 spamscore=0 adultscore=0 phishscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2304250082 X-Proofpoint-GUID: H9pAMddPxafTDDtF7HRUPqL9esPPsQqF X-Proofpoint-ORIG-GUID: H9pAMddPxafTDDtF7HRUPqL9esPPsQqF X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764139430288959449?= X-GMAIL-MSGID: =?utf-8?q?1764139430288959449?= |
Series |
tracing: support > 8 byte filter predicates
|
|
Message
Alan Maguire
April 25, 2023, 9:16 a.m. UTC
For cases like IPv6 addresses, having a means to supply tracing predicates for fields with more than 8 bytes would be convenient. This series provides a simple way to support this by allowing simple ==, != memory comparison with the predicate supplied when the size of the field exceeds 8 bytes. For example, to trace ::1, the predicate "dst == 0x00000000000000000000000000000001" ..could be used. Patch 1 provides the support for > 8 byte fields via a memcmp()-style predicate. Patch 2 adds tests for filter predicates, and patch 3 documents the fact that for > 8 bytes. only == and != are supported. Changes since RFC [1]: - originally a fix was intermixed with the new functionality as patch 1 in series [1]; the fix landed separately - small tweaks to how filter predicates are defined via fn_num as opposed to via fn directly [1] https://lore.kernel.org/lkml/1659910883-18223-1-git-send-email-alan.maguire@oracle.com/ Alan Maguire (3): tracing: support > 8 byte array filter predicates selftests/ftrace: add test coverage for filter predicates tracing: document > 8 byte numeric filtering support Documentation/trace/events.rst | 9 +++ kernel/trace/trace_events_filter.c | 55 +++++++++++++++- .../selftests/ftrace/test.d/event/filter.tc | 62 +++++++++++++++++++ 3 files changed, 125 insertions(+), 1 deletion(-) create mode 100644 tools/testing/selftests/ftrace/test.d/event/filter.tc
Comments
On Tue, 25 Apr 2023 10:16:34 +0100 Alan Maguire <alan.maguire@oracle.com> wrote: > For cases like IPv6 addresses, having a means to supply tracing > predicates for fields with more than 8 bytes would be convenient. > This series provides a simple way to support this by allowing > simple ==, != memory comparison with the predicate supplied when > the size of the field exceeds 8 bytes. For example, to trace > ::1, the predicate > > "dst == 0x00000000000000000000000000000001" > > ..could be used. Nice! And I also would like to use something like "dst == ipv6(::1)" because it seems easy to make a mistake on the number of zeros. Can we add such type casting feature to the filter? Thank you, > > Patch 1 provides the support for > 8 byte fields via a memcmp()-style > predicate. Patch 2 adds tests for filter predicates, and patch 3 > documents the fact that for > 8 bytes. only == and != are supported. > > Changes since RFC [1]: > > - originally a fix was intermixed with the new functionality as > patch 1 in series [1]; the fix landed separately > - small tweaks to how filter predicates are defined via fn_num as > opposed to via fn directly > > [1] https://lore.kernel.org/lkml/1659910883-18223-1-git-send-email-alan.maguire@oracle.com/ > > Alan Maguire (3): > tracing: support > 8 byte array filter predicates > selftests/ftrace: add test coverage for filter predicates > tracing: document > 8 byte numeric filtering support > > Documentation/trace/events.rst | 9 +++ > kernel/trace/trace_events_filter.c | 55 +++++++++++++++- > .../selftests/ftrace/test.d/event/filter.tc | 62 +++++++++++++++++++ > 3 files changed, 125 insertions(+), 1 deletion(-) > create mode 100644 tools/testing/selftests/ftrace/test.d/event/filter.tc > > -- > 2.31.1 >
On 25/04/2023 15:32, Masami Hiramatsu (Google) wrote: > On Tue, 25 Apr 2023 10:16:34 +0100 > Alan Maguire <alan.maguire@oracle.com> wrote: > >> For cases like IPv6 addresses, having a means to supply tracing >> predicates for fields with more than 8 bytes would be convenient. >> This series provides a simple way to support this by allowing >> simple ==, != memory comparison with the predicate supplied when >> the size of the field exceeds 8 bytes. For example, to trace >> ::1, the predicate >> >> "dst == 0x00000000000000000000000000000001" >> >> ..could be used. > > Nice! > And I also would like to use something like "dst == ipv6(::1)" because > it seems easy to make a mistake on the number of zeros. > > Can we add such type casting feature to the filter? > that's a great idea; what would be the most consistent ftrace syntax for this do you think? I noticed that hist triggers append a modifier to the field name so would something like "dst.ipv6 == ::1" make sense maybe? Thanks! Alan > Thank you, > >> >> Patch 1 provides the support for > 8 byte fields via a memcmp()-style >> predicate. Patch 2 adds tests for filter predicates, and patch 3 >> documents the fact that for > 8 bytes. only == and != are supported. >> >> Changes since RFC [1]: >> >> - originally a fix was intermixed with the new functionality as >> patch 1 in series [1]; the fix landed separately >> - small tweaks to how filter predicates are defined via fn_num as >> opposed to via fn directly >> >> [1] https://lore.kernel.org/lkml/1659910883-18223-1-git-send-email-alan.maguire@oracle.com/ >> >> Alan Maguire (3): >> tracing: support > 8 byte array filter predicates >> selftests/ftrace: add test coverage for filter predicates >> tracing: document > 8 byte numeric filtering support >> >> Documentation/trace/events.rst | 9 +++ >> kernel/trace/trace_events_filter.c | 55 +++++++++++++++- >> .../selftests/ftrace/test.d/event/filter.tc | 62 +++++++++++++++++++ >> 3 files changed, 125 insertions(+), 1 deletion(-) >> create mode 100644 tools/testing/selftests/ftrace/test.d/event/filter.tc >> >> -- >> 2.31.1 >> > >
On Tue, 25 Apr 2023 18:15:03 +0100 Alan Maguire <alan.maguire@oracle.com> wrote: > that's a great idea; what would be the most consistent ftrace syntax > for this do you think? I noticed that hist triggers append a modifier > to the field name so would something like > > "dst.ipv6 == ::1" Yeah, I think just having ":" in the name without quotes can help the filter know that it's a ipv6 id. Hmm, although we may want to do the same for mac addresses. But we can determine the difference by the field size. If it's 6 bytes, it's a mac, if it's 128 bits, then ipv6. -- Steve
On 25/04/2023 18:20, Steven Rostedt wrote: > On Tue, 25 Apr 2023 18:15:03 +0100 > Alan Maguire <alan.maguire@oracle.com> wrote: > >> that's a great idea; what would be the most consistent ftrace syntax >> for this do you think? I noticed that hist triggers append a modifier >> to the field name so would something like >> >> "dst.ipv6 == ::1" > > Yeah, I think just having ":" in the name without quotes can help the filter > know that it's a ipv6 id. > > Hmm, although we may want to do the same for mac addresses. But we can > determine the difference by the field size. If it's 6 bytes, it's a mac, if > it's 128 bits, then ipv6. > good idea! so what about the following - 16 byte field with ':'; convert from IPv6 address before memcmp()ing - 6 byte field with ':'; convert from MAC address before memcmp()ing - 4 byte field with '.'; convert from IPv4 address before memcmp()ing - 0x prefix, any other size; basic memcmp ? Thanks! Alan > -- Steve >
On Wed, 26 Apr 2023 09:51:00 +0100 Alan Maguire <alan.maguire@oracle.com> wrote: > - 16 byte field with ':'; convert from IPv6 address before memcmp()ing > - 6 byte field with ':'; convert from MAC address before memcmp()ing > - 4 byte field with '.'; convert from IPv4 address before memcmp()ing > - 0x prefix, any other size; basic memcmp Sure. -- Steve
On Wed, 26 Apr 2023 09:51:00 +0100 Alan Maguire <alan.maguire@oracle.com> wrote: > On 25/04/2023 18:20, Steven Rostedt wrote: > > On Tue, 25 Apr 2023 18:15:03 +0100 > > Alan Maguire <alan.maguire@oracle.com> wrote: > > > >> that's a great idea; what would be the most consistent ftrace syntax > >> for this do you think? I noticed that hist triggers append a modifier > >> to the field name so would something like > >> > >> "dst.ipv6 == ::1" > > > > Yeah, I think just having ":" in the name without quotes can help the filter > > know that it's a ipv6 id. > > > > Hmm, although we may want to do the same for mac addresses. But we can > > determine the difference by the field size. If it's 6 bytes, it's a mac, if > > it's 128 bits, then ipv6. > > > > good idea! so what about the following > > - 16 byte field with ':'; convert from IPv6 address before memcmp()ing > - 6 byte field with ':'; convert from MAC address before memcmp()ing > - 4 byte field with '.'; convert from IPv4 address before memcmp()ing > - 0x prefix, any other size; basic memcmp This looks good to me :) Thanks! > > ? Thanks! > > Alan > > > -- Steve > >