Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5830285rwb; Tue, 1 Aug 2023 08:27:13 -0700 (PDT) X-Google-Smtp-Source: APBJJlFUgXmu52/HSlP3BNUAdeSQOqCEBCPnNoHWAcKC2KFjGD7MZgkm6alaM3GXsd14gtGJKk1K X-Received: by 2002:a17:902:bd4b:b0:1b8:8af0:416f with SMTP id b11-20020a170902bd4b00b001b88af0416fmr12639695plx.1.1690903633478; Tue, 01 Aug 2023 08:27:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690903633; cv=none; d=google.com; s=arc-20160816; b=fa0D1auXnrYL16IYFHpAAsXi4bzJBtY1JbwkpeOn01Al1k1HzXsczzXTqe8JUVhPfQ nS4YL8gyjAZe7g3sPwoUMDPD1Eiuxep9lIrioovZMvcZ44NEKJhKq65lWUsMW0RXnfqV INjWm5lM7BQQ+oxM2RK6iPn4BL9+gCdYSQC0TShC2vZRZs9sNyRUIjkGH96TrBjsGnHz PUAp11xvywHSryHO6uIfCF8DWBsaMofTRcSQoSiXnsRIuIM+MmWcGUEU6UwvK6VHdbz0 A8GlBvqzlwg8zngvEtFZqxYMeHqXKBYgswB2DX0uKd1lp/d3/++oyPbDocmpbLpMUiN7 3/DA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date; bh=sBp57shTwGXC6n+Ooiz69dkUfrNyfJhl8vLXryd6pog=; fh=+W+h24UyqrvCEgcJUSCSBCwhRFkn2iVTZdPAA+CSSz4=; b=dwbhABYKysiiztcJf4cKWX03+X/Nst5pDrsdWmcQd1i68yxpm0/jQRtV40JWtlT844 f5EK9Zb9t4dJxmB/5EglwDIWbejO3KLBjythyOW3A2u4Yj0N/3uxZD1kx5oX5l1BG4QN pnM+jizisDJMCMn0Z4vWPILOTydc1nEfeKA3wakKlkh94/feQv6Dsco7TXeSt99cAda6 x8Ap2KDRIiGa5uA96EL0wmndai90U9079WjrhNUkMoSMSdQ6w79aF/cxk72GbGAhXg2Z bPa2HL7KmfK59c410qfamTpaSo3Fte5R0WaB8NoY3ajXAU4IGh9by/XM7qG5X+OTvSZA J/xg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f19-20020a170903105300b001b3dd46d4fesi8846275plc.66.2023.08.01.08.26.51; Tue, 01 Aug 2023 08:27:13 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234558AbjHAOTP (ORCPT + 99 others); Tue, 1 Aug 2023 10:19:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234562AbjHAOTN (ORCPT ); Tue, 1 Aug 2023 10:19:13 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A83E5BF; Tue, 1 Aug 2023 07:19:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 45935615CD; Tue, 1 Aug 2023 14:19:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 01565C433C9; Tue, 1 Aug 2023 14:19:09 +0000 (UTC) Date: Tue, 1 Aug 2023 10:19:08 -0400 From: Steven Rostedt To: Ze Gao Cc: Adrian Hunter , Alexander Shishkin , Arnaldo Carvalho de Melo , Ian Rogers , Ingo Molnar , Jiri Olsa , Mark Rutland , Masami Hiramatsu , Namhyung Kim , Peter Zijlstra , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-trace-devel@vger.kernel.org, Ze Gao Subject: Re: [RFC PATCH v3 6/6] libtraceevent: prefer to use prev_state_char introduced in sched_switch Message-ID: <20230801101908.4ccc81c8@gandalf.local.home> In-Reply-To: <20230801090124.8050-7-zegao@tencent.com> References: <20230801090124.8050-1-zegao@tencent.com> <20230801090124.8050-7-zegao@tencent.com> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.7 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 1 Aug 2023 17:01:24 +0800 Ze Gao wrote: > Since the sched_switch tracepoint introduces a new variable to > report sched-out task state in symbolic char, we prefer to use > it to spare from knowing internal implementations in kernel. > > Also we keep the old parsing logic intact but sync the state char > array with the latest kernel. This should be two patches. First sync the state char array and then add your state_char change. The two changes are agnostic to each other, and should be separate commits. Same goes for the perf changes. -- Steve > > Signed-off-by: Ze Gao > --- > plugins/plugin_sched_switch.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/plugins/plugin_sched_switch.c b/plugins/plugin_sched_switch.c > index 8752cae..4c57322 100644 > --- a/plugins/plugin_sched_switch.c > +++ b/plugins/plugin_sched_switch.c > @@ -11,7 +11,7 @@ > > static void write_state(struct trace_seq *s, int val) > { > - const char states[] = "SDTtZXxW"; > + const char states[] = "SDTtXZPIp"; > int found = 0; > int i; > > @@ -99,7 +99,12 @@ static int sched_switch_handler(struct trace_seq *s, > if (tep_get_field_val(s, event, "prev_prio", record, &val, 1) == 0) > trace_seq_printf(s, "[%d] ", (int) val); > > - if (tep_get_field_val(s, event, "prev_state", record, &val, 1) == 0) > + //find if has prev_state_char, otherwise fallback to prev_state > + if (tep_find_field(event, "prev_state_char")) { > + if (tep_get_field_val(s, event, "prev_state_char", record, &val, 1) == 0) > + trace_seq_putc(s, (char) val); > + } > + else if (tep_get_field_val(s, event, "prev_state", record, &val, 1) == 0) > write_state(s, val); > > trace_seq_puts(s, " ==> ");