Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp3955080rwb; Sun, 30 Jul 2023 21:12:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlEIYBKl/W1gStWBRdjQj3XMn3kgBH1GjjmBnAK7eqsvc4+ZrtUmCLCMB7yZPr768WeoTHJ6 X-Received: by 2002:a05:6358:431d:b0:134:d4b6:1c47 with SMTP id r29-20020a056358431d00b00134d4b61c47mr4750379rwc.22.1690776762203; Sun, 30 Jul 2023 21:12:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690776762; cv=none; d=google.com; s=arc-20160816; b=XTDfoZh41dzsznBszyPIlewb6KiodJtHRRVBH5cteL9JIYz+swWYzFXafYMiKyZpyX l5W/CxHGOWkE/dI48ovUE3McMB8KQMZH4M6vO3APF1jcc4O2DO32Wz1yy5seV64v0RXd BzHhFv1xc0U9Xd9EqTYwBqFJL+wkhxbAnwk3qQj1/fso0xU61a2k3iBeQrF6yJsudVxf zKY0Mo+/4dsV74qSPHrxH7P/3PryKQE/XzNCeJzloKcbGEH5nOts6+z0Yd5sa3ZKHeYf 2zJT973jJ+f5ZZZtPhVsSwft4Du7SODKkVFYQceX8QrWvWmyyhm5OvHa/EzHlzjf+g1S geDQ== 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 :dkim-signature; bh=rZBj4apNeWA7R+pIyzCxZHWTbUda90Igc2CXpe2/RU8=; fh=NScd5uWj51yEzo+BC3AmM3+B4muo/YmJCepY1l6e52M=; b=KIJJrOn8ygnMFfjoTuToc6K878BERVWYLnApABMjf8VKdNGl0klWGR85lsSnUOndFk 7k4E/GKEJRBETB2ueXbx4izzofEVT8j/sd/hi1Y6SDlPcO5DhfMH++D7c590A3SVCK1I CwWdWVTMeFqNNhEZCZQtbxawAbu/PYGGFtgeb8Q9JuR7gegBggXNv+k/3ABibfJnf0Ge Y0ERf6WC6tslfN2uAGQDNgaFfA8FQRTJsmk7FWI/EOFYXvw1+JEbNSTg66gZ5OKNQLP8 qw4tt50TsHDeuwd20nL9txbAyyAt1EzYODPkna6486RGUeZmpP4hC3bEO5S+pAYgy3yV gAaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="h/xhvo4F"; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i184-20020a6387c1000000b00563de641cf1si6439832pge.724.2023.07.30.21.12.30; Sun, 30 Jul 2023 21:12:42 -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=@kernel.org header.s=k20201202 header.b="h/xhvo4F"; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229528AbjGaDxd (ORCPT + 99 others); Sun, 30 Jul 2023 23:53:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57538 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229785AbjGaDxY (ORCPT ); Sun, 30 Jul 2023 23:53:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 048D818D; Sun, 30 Jul 2023 20:53:02 -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 3F95860E8D; Mon, 31 Jul 2023 03:53:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BED03C433C8; Mon, 31 Jul 2023 03:52:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690775581; bh=Y9lgSgz5fjO9KmaWx63oLAt23LyF/pyHoSo8cniMsME=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=h/xhvo4F9dornzS8cdSJXF1rL85JfZ/EtzMDO0KpFHrSy8+WqRVz9SBnvFCXrLWRY LiNn6LGmQIO89egztL9ybFWm0VTyzoEJ+X2L8jNjFsIGUrJfe4a6TnQj+sInvezkZg UhQnRvwthsq/lf+GYWteOybzSoySE7O7HwkuRPCtNZu2iyoAErRdwBwwp327fCTBLZ 5sJaI+u9NXDwycJJfXWj7zer/EOf65IguwjcpW+wNgaLFvUnksUlqljcEheiYJRfVq 1PCtOHNuj5JaqZPDzBwyc3RwDNIU9yA/SMJLnba++1sq7sPU+FhpKMVQWEI+BbVq76 lFKaguqOe9u8Q== Date: Mon, 31 Jul 2023 12:52:54 +0900 From: Masami Hiramatsu (Google) To: Ze Gao Cc: Peter Zijlstra , Steven Rostedt , Namhyung Kim , Adrian Hunter , Alexander Shishkin , Arnaldo Carvalho de Melo , Ian Rogers , Ingo Molnar , Jiri Olsa , Mark Rutland , Masami Hiramatsu , 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 v2 0/3] report task state in symbolic chars from sched tracepoint Message-Id: <20230731125254.b059f0c7f29761d018dedbe8@kernel.org> In-Reply-To: <20230726121618.19198-1-zegao@tencent.com> References: <20230726121618.19198-1-zegao@tencent.com> X-Mailer: Sylpheed 3.7.0 (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=-2.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,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 Wed, 26 Jul 2023 20:16:15 +0800 Ze Gao wrote: > > This is the 2nd attempt to fix the report task state issue in sched > tracepint, here is the first version: > > https://lore.kernel.org/linux-trace-kernel/20230725072254.32045-1-zegao@tencent.com > > Against v1, add a new var to report task state in symbolic char instead > of replacing the old one and to not to break anything. > > -- > > In the status quo, we should see three different outcomes of the reported > sched-out task state from perf-script, perf-sched-timehist, and Tp_printk > of tracepoint sched_switch. And it's not hard to figure out that the > former two are built upon the third one, and the reason why we see this > inconsistency is that the former two does not catch up with the internal > change of reported task state definitions as the kernel evolves. > > IMHO, exporting internal representations of task state in the tracepoint > sched_switch is not a good practice and not encouraged at all, which can > easily break userspace tools that relies on it. Especially when tracepoints > are massively used in many observability tools nowadays due to its stable > nature, which makes them no longer used for debug only purpose and we > should be careful to decide what ought to be reported to userspace and what > ought not. > > Therefore, to fix the issues mentioned above for good, instead of choosing > I proposed to add a new variable to report task state in sched_switch with > a symbolic character along with the old hardcoded value, and save the > further processing of userspace tools and spare them from knowing > implementation details in the kernel. > > After this patch seires, we report 'RSDTtXZPI' the same as in procfs, plus > a 'p' which denotes PREEMP_ACTIVE and is used for sched_switch tracepoint only. This series looks good to me. Putting the flag in the trace record is a good idea :) Reviewed-by: Masami Hiramatsu (Google) for this series. Thank you, > > Reviews welcome! > > Regards, > > Ze > > Ze Gao (2): > sched, tracing: add to report task state in symbolic chars > perf sched: use the new prev_state_char instead in tracepoint > sched_switch > > include/trace/events/sched.h | 60 +++++++++++++++++++++--------------- > tools/perf/builtin-sched.c | 57 ++++++---------------------------- > 2 files changed, 45 insertions(+), 72 deletions(-) > > Ze Gao (1): > libtraceevent: use the new prev_state_char instead in tracepoint > sched_switch > > plugins/plugin_sched_switch.c | 29 ++++------------------------- > 1 file changed, 4 insertions(+), 25 deletions(-) > > -- > 2.40.1 > -- Masami Hiramatsu (Google)