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 27353C05027 for ; Thu, 9 Feb 2023 02:34:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232070AbjBICeB (ORCPT ); Wed, 8 Feb 2023 21:34:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232000AbjBICdu (ORCPT ); Wed, 8 Feb 2023 21:33:50 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E367D28843; Wed, 8 Feb 2023 18:33:49 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 634686185A; Thu, 9 Feb 2023 02:33:49 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CDBC0C433EF; Thu, 9 Feb 2023 02:33:45 +0000 (UTC) Date: Wed, 8 Feb 2023 21:33:43 -0500 From: Steven Rostedt To: John Stultz Cc: Alexei Starovoitov , Yafang Shao , 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 Subject: Re: [PATCH v2 7/7] tools/testing/selftests/bpf: replace open-coded 16 with TASK_COMM_LEN Message-ID: <20230208213343.40ee15a5@gandalf.local.home> In-Reply-To: <20230208212858.477cd05e@gandalf.local.home> References: <20211120112738.45980-1-laoar.shao@gmail.com> <20211120112738.45980-8-laoar.shao@gmail.com> <20230208212858.477cd05e@gandalf.local.home> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 8 Feb 2023 21:28:58 -0500 Steven Rostedt wrote: > And this breaks much more than android. It will break trace-cmd, rasdaemon > and perf (if it's not using BTF). This change very much "Breaks userspace!" > And requires a kernel workaround, not a user space one. 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 portion. That is: system: sched name: sched_switch ID: 285 format: field:unsigned short common_type; offset:0; size:2; signed:0; field:unsigned char common_flags; offset:2; size:1; signed:0; field:unsigned char common_preempt_count; offset:3; size: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 used 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=%s prev_pid=%d prev_prio=%d prev_state=%s%s ==> next_comm=%s next_pid=%d next_prio=%d", REC->prev_comm, REC->prev_pid, REC->prev_prio, (REC->prev_state & ((((0x00000000 | 0x00000001 | 0x00000002 | 0x00000004 | 0x00000008 | 0x00000010 | 0x00000020 | 0x00000040) + 1) << 1) - 1)) ? __print_flags(REC->prev_state & ((((0x00000000 | 0x00000001 | 0x00000002 | 0x00000004 | 0x00000008 | 0x00000010 | 0x00000020 | 0x00000040) + 1) << 1) - 1), "|", { 0x00000001, "S" }, { 0x00000002, "D" }, { 0x00000004, "T" }, { 0x00000008, "t" }, { 0x00000010, "X" }, { 0x00000020, "Z" }, { 0x00000040, "P" }, { 0x00000080, "I" }) : "R", REC->prev_state & (((0x00000000 | 0x00000001 | 0x00000002 | 0x00000004 | 0x00000008 | 0x00000010 | 0x00000020 | 0x00000040) + 1) << 1) ? "+" : "", REC->next_comm, REC->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. -- Steve