Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 94DB8C636D4 for ; Sun, 12 Feb 2023 03:39:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229618AbjBLDjc (ORCPT ); Sat, 11 Feb 2023 22:39:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbjBLDja (ORCPT ); Sat, 11 Feb 2023 22:39:30 -0500 Received: from mail-qv1-xf2b.google.com (mail-qv1-xf2b.google.com [IPv6:2607:f8b0:4864:20::f2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B35511658; Sat, 11 Feb 2023 19:39:29 -0800 (PST) Received: by mail-qv1-xf2b.google.com with SMTP id o42so3935109qvo.13; Sat, 11 Feb 2023 19:39:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1676173168; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=k38DlK0t/XHGBmKF/8ZrTC+4DU+EC3G+T7TmyTsfFvU=; b=Eesg2pr21Hk2/SFlRpaZz6BWSDuCQ/lAmubyFyhQpXpmWUFBZwA3RMRmFl4R6kupMj zIqimSmEfd8SJuRPncA7f70MIq1bYExvI5pTFbun6JKUsJZNcHRDzXvBezdU8A9IDOz9 S/KAxSCZfrwTD5epNKzAWf4XGqBE3lI9zOWH4r6myy1F/Kog4Mqu8l/+/0KMs42gMcw/ lunbSDYZj9MoJlmDA53Ub0uurhNXOzNtd70JVU5mY0X5OckxLpdhMHkEmh8xii43dAr3 ygFaw3kr1WSJiBYhv54OykPyCEASrCTnFAVWBt63tz1F0o3QWH6d4N8+M7w8JgbFaoUx uYxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1676173168; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=k38DlK0t/XHGBmKF/8ZrTC+4DU+EC3G+T7TmyTsfFvU=; b=qbsu6bKhIeYAVtJYQqP5w8TRDZKs8gJ+P0IbQXR4/uzkSS2OWUh1YkUpuNGnNFdCOF vqdGktXV05onwQRNlwIluhe/t4YgNAIiBk9RJL+U/IWODIQbWf/+T/WgRYiSIqIjRsCC gWqOPzhEPMixvJbLQoSPo5MyQ4S+WsK/+hxiVD1o7OVWUg3Sv4LtLn31Qx5Vjto1BMZC G8EKK1nGsmAUEbjx7ZLexoGagTcczbXHF2EvbkrLI9hTxBUuN9oiMJU9Z8eXvewbBno/ szB+fGh0gRhkihSGfAhkn9l+ooEUB6hNMhsElTeI6laiOnxuoIZsWxzLOmojSZknnIe3 rZuQ== X-Gm-Message-State: AO0yUKUwznrQUQpPhFrsJSWTqhy3H3xFZ87mqOZwyQgfrgwv05YP2DCg frlm5TiISg5FSL9Y9Ipq/H9kHExfn3qfwc+oS5E= X-Google-Smtp-Source: AK7set++fC5LRuz2dH+ErgwVb2ke3N2snEdx0tgAkIr73gknu4wwZoOPtJOeV6iq468KODoVusgaflTPhY0FFMyRNq4= X-Received: by 2002:a0c:b306:0:b0:537:6777:b744 with SMTP id s6-20020a0cb306000000b005376777b744mr1598861qve.58.1676173168615; Sat, 11 Feb 2023 19:39:28 -0800 (PST) MIME-Version: 1.0 References: <20211120112738.45980-1-laoar.shao@gmail.com> <20211120112738.45980-8-laoar.shao@gmail.com> <20230208212858.477cd05e@gandalf.local.home> <20230208213343.40ee15a5@gandalf.local.home> <20230211140011.4f15a633@gandalf.local.home> In-Reply-To: <20230211140011.4f15a633@gandalf.local.home> From: Yafang Shao Date: Sun, 12 Feb 2023 11:38:52 +0800 Message-ID: Subject: Re: [PATCH v2 7/7] tools/testing/selftests/bpf: replace open-coded 16 with TASK_COMM_LEN To: Steven Rostedt Cc: John Stultz , Alexei Starovoitov , Andrew Morton , Network Development , bpf , "linux-perf-use." , Linux-Fsdevel , linux-mm , LKML , kernel test robot , kbuild test robot , Andrii Nakryiko , David Hildenbrand , Mathieu Desnoyers , Arnaldo Carvalho de Melo , Andrii Nakryiko , Michal Miroslaw , Peter Zijlstra , Matthew Wilcox , Al Viro , Kees Cook , Petr Mladek , Kajetan Puchalski , Lukasz Luba , Qais Yousef , Daniele Di Proietto , Linus Torvalds Content-Type: multipart/mixed; boundary="0000000000004c630c05f4787a16" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --0000000000004c630c05f4787a16 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Sun, Feb 12, 2023 at 3:00 AM Steven Rostedt wrote: > > On Wed, 8 Feb 2023 21:33:43 -0500 > Steven Rostedt wrote: > > > OK, so it doesn't break perf, trace-cmd and rasdaemon, because the enum= is > > only needed in the print_fmt part. It can handle it in the field portio= n. > > > > That is: > > > > > > system: sched > > name: sched_switch > > ID: 285 > > format: > > field:unsigned short common_type; offset:0; size:2; s= igned:0; > > field:unsigned char common_flags; offset:2; size:1; s= igned:0; > > field:unsigned char common_preempt_count; offset:3; s= ize:1; signed:0; > > field:int common_pid; offset:4; size:4; signed:1; > > > > field:char prev_comm[TASK_COMM_LEN]; offset:8; size:16; = signed:0; > > ^^^^^^^^^^^^^^ ^^ > > is ignored is u= sed > > > > > > field:pid_t prev_pid; offset:24; size:4; signed:1; > > field:int prev_prio; offset:28; size:4; signed:1; > > field:long prev_state; offset:32; size:8; signed:1; > > field:char next_comm[TASK_COMM_LEN]; offset:40; size:16; = signed:0; > > field:pid_t next_pid; offset:56; size:4; signed:1; > > field:int next_prio; offset:60; size:4; signed:1; > > > > print fmt: "prev_comm=3D%s prev_pid=3D%d prev_prio=3D%d prev_state=3D%s= %s =3D=3D> next_comm=3D%s next_pid=3D%d next_prio=3D%d", REC->prev_comm, RE= C->prev_pid, REC->prev_prio, (REC->prev_state & ((((0x00000000 | 0x00000001= | 0x00000002 | 0x00000004 | 0x00000008 | 0x00000010 | 0x00000020 | 0x00000= 040) + 1) << 1) - 1)) ? __print_flags(REC->prev_state & ((((0x00000000 | 0x= 00000001 | 0x00000002 | 0x00000004 | 0x00000008 | 0x00000010 | 0x00000020 |= 0x00000040) + 1) << 1) - 1), "|", { 0x00000001, "S" }, { 0x00000002, "D" }= , { 0x00000004, "T" }, { 0x00000008, "t" }, { 0x00000010, "X" }, { 0x000000= 20, "Z" }, { 0x00000040, "P" }, { 0x00000080, "I" }) : "R", REC->prev_state= & (((0x00000000 | 0x00000001 | 0x00000002 | 0x00000004 | 0x00000008 | 0x00= 000010 | 0x00000020 | 0x00000040) + 1) << 1) ? "+" : "", REC->next_comm, RE= C->next_pid, REC->next_prio > > > > ^^^^^^^ > > > > Is what requires the conversions. So I take that back. It only breaks > > perfetto, and that's because it writes its own parser and doesn't use > > libtraceevent. > > Actually, there are cases that this needs to be a number, as b3bc8547d3be= 6 > ("tracing: Have TRACE_DEFINE_ENUM affect trace event types as well") made > it update fields as well as the printk fmt. > It seems that TRACE_DEFINE_ENUM(TASK_COMM_LEN) in the trace events header files would be a better fix. > I think because libtraceevent noticed that it was a "char" array, it just > defaults to "size". But this does have meaning for all other types, and I > can see other parsers requiring that. > > -- Steve --=20 Regards Yafang --0000000000004c630c05f4787a16 Content-Type: application/octet-stream; name="TASK_COMM_LEN.diff" Content-Disposition: attachment; filename="TASK_COMM_LEN.diff" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_le0u4tol0 ZGlmZiAtLWdpdCBhL2luY2x1ZGUvdHJhY2UvZXZlbnRzL2Jsb2NrLmggYi9pbmNsdWRlL3RyYWNl L2V2ZW50cy9ibG9jay5oDQppbmRleCA3ZjRkZmJkLi45N2NmNmMyIDEwMDY0NA0KLS0tIGEvaW5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