Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4082077rwb; Mon, 31 Jul 2023 00:29:59 -0700 (PDT) X-Google-Smtp-Source: APBJJlF60DGkZyhS5Gu0Un35oeEmFaIUTXNOSkOf+zq9usomWGb6qNGc5u7Y5ON2iwiUznrAXJo6 X-Received: by 2002:a05:6a21:790a:b0:137:48cc:9cfa with SMTP id bg10-20020a056a21790a00b0013748cc9cfamr7403724pzc.24.1690788599570; Mon, 31 Jul 2023 00:29:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690788599; cv=none; d=google.com; s=arc-20160816; b=0bTCSyYEK7BlPSkWx7afYGi112e1BhKXTJXqtfwU/7U+GzUl9ibrbAOFgISHfhetGa NUoDHXv5XdsHjKg1MfIQr08vpxjZAHKBFM4OKRujQ21T04RMp1ErWgJm6O0GOm/iVQ+j djFZ8GqEHjDzQsfjkkokI0W11wkbPSW+3gLhy4dlMjRX8Azo8MF/eMKNbCPjntwVoVqA Q3XjJ0UXo431bi4AUt854f9EMR4EiJlgxqYui+v+gvoyaTNpERGYs4Q53huIaBj+aAD6 eY0AC6FzmuJC/RNKifLMCtmz0v+ZhbdvlA2mD5nn8bkFeXqCPIqjBjbQc5pLnu0y0F8B vEIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=3eyuVZGHrYlHoh+nOWqETVRc5+l/gf1Sp6LFIyZxmPk=; fh=ek6rCefo5kz3dFFBClaAT43nz7Xyzk0Vx3XV2BQpbtE=; b=q80BWGB+stYJLff6/kpGKHYl8C4JTMk/nhXPIS128K5SbgXZwlL+nX73kbq7GSV12t mrULnoUruIDfdghVDjeUq8AzS8JnXWf3n+LE7v3kRzzjo4kqo5xPRonBaNcrQlk93WXQ cSgEQ8B4565r11qMZ708UI1hLQa3wuYxWmqT0TuiQek2nJawIQkUSSyGpPuaHZFUXlxU Iaxvktjz/agp2MxDHY1Uauy8xW4FgGpvn8tZ16ozhwBJms0/1HFRRGvsvZ2plufr7HbL pLAJMOLMp0Qj2z7Yu91pNh5ZO7rFfRgBHIYKCUKRjCp102SlI4B0edPmXaB+WM8RWnss hB/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=IQHnBA7d; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id im23-20020a170902bb1700b001b9ca3e0388si6515413plb.584.2023.07.31.00.29.47; Mon, 31 Jul 2023 00:29:59 -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=@gmail.com header.s=20221208 header.b=IQHnBA7d; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229635AbjGaGTk (ORCPT + 99 others); Mon, 31 Jul 2023 02:19:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229622AbjGaGTj (ORCPT ); Mon, 31 Jul 2023 02:19:39 -0400 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D36BD188; Sun, 30 Jul 2023 23:19:37 -0700 (PDT) Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-52164adea19so5512483a12.1; Sun, 30 Jul 2023 23:19:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690784376; x=1691389176; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=3eyuVZGHrYlHoh+nOWqETVRc5+l/gf1Sp6LFIyZxmPk=; b=IQHnBA7dPB9m/24AyUTctN9XhN1LYoI6aX0FljAh8cmqXxXE9pX91h0u1GOjha0zrZ AHhrOk8YjFyLyZ+MoTdjyb+T66aTsbuLF4dtJYsW2aGcfuI1N7ua34bi7YXOjDYDvQOG XZjbd7Vd2df7SOzHxxvZRIVcVB2ocFgjQAIv49PqaxTpSogRmMBTmqwxZTnP/Y+MWtBc g9LMHrP6w6fJ8WE18TPkzjbqEX8VASaekPd/o3VbFyudLJFKQqvXfdR9YKaIH3+2+FMj zbB2DEiaOTNA+yBSLZDx9Rp8dG2XsjxpJEqk6a1hTl8W7Xg2g8usdqwmwTtAuRvxuhuw xpFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690784376; x=1691389176; h=content-transfer-encoding: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=3eyuVZGHrYlHoh+nOWqETVRc5+l/gf1Sp6LFIyZxmPk=; b=GuvL5DJqNNlTZ0HuiRa8rbuRIBgWpiVKGHA1n4hBgJT+/JPepZ+2NNJzWOoZU94Hsx SPA3IVDykd2lj5z7dlaZlIUJDlTBueN1WG67MbXGyNoWj9+ICqBVj0TXQJgyRDn4FTMT huocJa8EfE5IrYG6UKV3l5dMFsA6FjbJn69arpvaVwhcKhliKiqGd5NrpQvlTYpeKyxR VB3GC1vPYDxmdwjPtvIR9b6Gm4OHfaGLkP71qXbba6bA7EcrQo7C+gXlMvOTJigVNime oP1syFkSXhRnlI7psi1bDq60NiwnrLHwEd/9dmC3mezPMuE1TPxf4UccXRdejB/5rUI1 6yEw== X-Gm-Message-State: ABy/qLYvdQ0DtNav3zP84B01v1B3tfDo2/JtIylE26woODz0hekvNvAT 4yYQ9+9DgO5Oh68BXNhvTQG+KWf+te40X2sOo68= X-Received: by 2002:a50:ec82:0:b0:522:2aba:bb32 with SMTP id e2-20020a50ec82000000b005222ababb32mr7599019edr.13.1690784376100; Sun, 30 Jul 2023 23:19:36 -0700 (PDT) MIME-Version: 1.0 References: <20230726121618.19198-1-zegao@tencent.com> <20230731125254.b059f0c7f29761d018dedbe8@kernel.org> In-Reply-To: <20230731125254.b059f0c7f29761d018dedbe8@kernel.org> From: Ze Gao Date: Mon, 31 Jul 2023 14:19:24 +0800 Message-ID: Subject: Re: [RFC PATCH v2 0/3] report task state in symbolic chars from sched tracepoint To: Masami Hiramatsu Cc: Peter Zijlstra , Steven Rostedt , Namhyung Kim , Adrian Hunter , Alexander Shishkin , Arnaldo Carvalho de Melo , Ian Rogers , Ingo Molnar , Jiri Olsa , Mark Rutland , 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,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 Hi Masami, Thanks for your review! Sincerely, Ze On Mon, Jul 31, 2023 at 11:53=E2=80=AFAM Masami Hiramatsu wrote: > > 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 report= ed > > sched-out task state from perf-script, perf-sched-timehist, and Tp_prin= tk > > 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 interna= l > > change of reported task state definitions as the kernel evolves. > > > > IMHO, exporting internal representations of task state in the tracepoin= t > > sched_switch is not a good practice and not encouraged at all, which ca= n > > easily break userspace tools that relies on it. Especially when tracepo= ints > > are massively used in many observability tools nowadays due to its stab= le > > 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 choos= ing > > I proposed to add a new variable to report task state in sched_switch w= ith > > 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, p= lus > > a 'p' which denotes PREEMP_ACTIVE and is used for sched_switch tracepoi= nt 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)