Received: by 2002:a05:7412:8d11:b0:fa:4934:9f with SMTP id bj17csp380022rdb; Sun, 14 Jan 2024 23:23:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IFmiy3vz8vywHEYSqUJk7ckTX6PE6nneNt8nyXY5EXOZH94FTfSagmTxVqRZpr+ZEH+HgNo X-Received: by 2002:a05:6808:1413:b0:3bd:4a0c:2c32 with SMTP id w19-20020a056808141300b003bd4a0c2c32mr8038085oiv.70.1705303403168; Sun, 14 Jan 2024 23:23:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705303403; cv=none; d=google.com; s=arc-20160816; b=L9Ssy4+Uu3A2pKvtRPBwL9IdBAZtRySuzYBM+g/oeJamN7PO29c5UkHVx39OuMBN8Q atry+JHU+3IGcjYyjzRaKUfaXbgGy3eIrKEMqvN/HGOQRlEnHRp6sbIU7dGOvY89G+LQ MtnHVphABzjDYbzovakTuw9nTjMKarX2eFVaJX2/ULpR40ouLIrADfk8rr4/iPxjD5sU da7qwbvA0VUwPkNZ+PjEKxp9ExTD9GWiKxbpIJeUcALfQcRZDpEtB9gCEqiYcMvsaYgR Qh0xuJphrJtiQQ7HLU/JjY4Y03eDkIQED8XgJ6lwaWXLJb4cLRLgj855t9DiU4xtglKH uaKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=U3zxCYUmaML8ov7vohntDD30tq3BZHVZqgdXMQmkL3E=; fh=BA7X0Fh+nH6aOBOR/HncHKQUGXeIUOSOgeWoVcIZnUI=; b=p3NycbiW4RJDfYiweEADWUzLxK6dLacK64O0y7vUSkdXZx/sRg3IkFcxzgXmpntPS4 rSeT05v+hlp+QaOVCfv06yVwbp2gerS/iRua1I2ENgsyY5WmqpUghZqd88nSNoVeRqjM bHjRT86pmU/MCpnnw3tUdQq8eWNfIJc6EsvoC8K3vzsy3qwu8xqjj/2QZnrCM4IzxGcp FUHx4PkPZkI/t3WbfPQLUxQtUZD9cBOKX9hBxfmN0nzCUbqvcdN4RuxfctpQ94D8FV4I A+pL7fpS+xTIMLDfCiMC0TA08lNnsifu9o9XSsOTARoCXPnjucMi/2Z8tHobkjGfJFZy +cIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=SKggr1Zn; spf=pass (google.com: domain of linux-kernel+bounces-25676-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25676-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id w13-20020a63d74d000000b005cdbeb97153si8054610pgi.86.2024.01.14.23.23.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 23:23:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25676-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=SKggr1Zn; spf=pass (google.com: domain of linux-kernel+bounces-25676-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25676-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id B1AA8281651 for ; Mon, 15 Jan 2024 07:23:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 08E8046BF; Mon, 15 Jan 2024 07:23:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="SKggr1Zn" Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0DB583D62; Mon, 15 Jan 2024 07:23:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-f175.google.com with SMTP id 41be03b00d2f7-5cda3e35b26so2916559a12.1; Sun, 14 Jan 2024 23:23:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1705303394; x=1705908194; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=U3zxCYUmaML8ov7vohntDD30tq3BZHVZqgdXMQmkL3E=; b=SKggr1ZnwUygXw5Kbu/Tw0lWbicsNwsRjb+cgNK+jAhgPDec+brrzIisTeoE9YOPXH njkdyFvOe2t4FNobaLIyZjB7+XrQOonPNTcm+LqVPAixyE6SqR+XUslosdkJXKf0SeEC xaCbenkiUNQyFVOXPVRs0YzYRwil0yiMfmiKPsX1GDABNR2qsUUcQapBWdGp5ByB9aWE UYPWDutZxFkWKK7nbtbiqauogHLM8d+9pg3n7XkJA4vao65P4fOw/Dyo8VxRERgx2h+y 0S33SnDIeMXXFvfK88TNsqmHD6mUwH5fRUV0Q+cldw8s/c+xjPXdcdjBNwWPKsdJ0G/a GoLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1705303394; x=1705908194; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=U3zxCYUmaML8ov7vohntDD30tq3BZHVZqgdXMQmkL3E=; b=u6dfTutwj52hTKioskZDVEaj9fs/EAoOc4l0DzuFwKwTs+3KUGoY6KLqlp2oUtow2R W6RMtbphmdS9UCdOCHry3eijza3w6gp3Vk3Le/uSwCmvF3lK+2J9BnPaEtNvFScFQ7xV AF642LKegupsVj+b/AmxunT78JkupHfuxVwSw2RYXuWWMg9v3/c5DT/VbHVdFLVjuPtx W9hbuvwRMK2cJvgPqeDdNFg+jksTIW33kuqnAYu2835xRJ/w36M8ovzh/xQDYcMfyoPc eUWkfYHQhK4qx/1OmZHrrxy6Xdqd8QdVilJ+P1LKwp1+owG7PPPgSjQkFTTvroK3zQWX AVbA== X-Gm-Message-State: AOJu0YxnayXrfwq9zdQTYpcI3q6C92csTECGsigf8uvoc9hyALfstPbm c9rWJ6RlZLTAZ1H3CDTJ2h6AnA2eve8Ff/R+ X-Received: by 2002:a17:90b:1986:b0:28b:2a79:dcd with SMTP id mv6-20020a17090b198600b0028b2a790dcdmr2461709pjb.67.1705303394200; Sun, 14 Jan 2024 23:23:14 -0800 (PST) Received: from localhost.localdomain ([203.205.141.87]) by smtp.googlemail.com with ESMTPSA id mp13-20020a170902fd0d00b001d4ac8ac969sm6990545plb.275.2024.01.14.23.23.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 23:23:13 -0800 (PST) From: Ze Gao X-Google-Original-From: Ze Gao To: Adrian Hunter , Alexander Shishkin , Arnaldo Carvalho de Melo , Ian Rogers , Ingo Molnar , Jiri Olsa , Mark Rutland , Namhyung Kim , Peter Zijlstra , Steven Rostedt Cc: linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Ze Gao Subject: [PATCH 0/4] perf sched: Fix task state report Date: Mon, 15 Jan 2024 02:23:02 -0500 Message-ID: <20240115072306.303993-1-zegao@tencent.com> X-Mailer: git-send-email 2.41.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi, The problems of task state report in both libtraceevent and perf sched has been reported in [1]. In short, they parsed the wrong state due to relying on the outdated hardcoded state string to interpret the raw bitmask from the record, which left the messes to maintain the backward compatibilities for both tools. [1] has not managed to make itself into the kernel, the problems and the solutions are well studied though. Luckily, as suggested by Steven, perf/libtraceevent records the print format, especially the __print_flags() part of the in-kernel tracepoint sched_switch in its metadata, and we have a chance to build the state str on the fly by parsing it. Now that libtraceevent has landed this solution in [2], we now apply the same idea to perf as well. Regards, -- Ze [1]: https://lore.kernel.org/lkml/20230803083352.1585-1-zegao@tencent.com/ [2]: https://lore.kernel.org/linux-trace-devel/20231224140732.7d41698d@rorschach.local.home/ Ze Gao (4): perf sched: Sync state char array with the kernel perf util: Add helpers to parse task state string from libtraceevent perf util: Add evsel__taskstate() to parse the task state info instead perf sched: Commit to evsel__taskstate() to parse task state info tools/perf/builtin-sched.c | 57 +++------------ tools/perf/util/evsel.c | 146 +++++++++++++++++++++++++++++++++++++ tools/perf/util/evsel.h | 1 + 3 files changed, 157 insertions(+), 47 deletions(-) -- 2.41.0