Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp225087lqh; Wed, 27 Mar 2024 22:59:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVtquRhXmK/nSztbdmUc9qoN3HA6t0GqxHYFJF0c9QYlrZUkwT5VmRqQQXyyazhux1rQoSuVyhkqkraiFN03GdLMGdNN9RWJUftA2x+lA== X-Google-Smtp-Source: AGHT+IEYZUNYcLW+W9NExvgfBYagV/6oA1uS6UX6jEtNfE5+bXnTgu05T6Ig9epUe5BhP1kKDrTs X-Received: by 2002:a17:902:f607:b0:1e0:b62a:c0a2 with SMTP id n7-20020a170902f60700b001e0b62ac0a2mr1962166plg.51.1711605558899; Wed, 27 Mar 2024 22:59:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711605558; cv=pass; d=google.com; s=arc-20160816; b=I2uPRBJilxo7nqYd9vKq+vllti3W7y0XJY7/cn942wjYW5svLr3O+E72d1vaWAOrP4 4k9MS8jRzHIK725YZ+WruFZBKgh9l6ELHhmJQGRMBGwn0lz/0Cff17szTgMPeonwK3bj ATRtLpwBY1acgn50kmWSgvRowY+odRMQVskSy+QASyZmdQHXNF7VICdyuJM9C0JXnfDQ UpntM2FRDTk1fK15HmcChBJOVSNoyzhnZP2Wq6PLERksH7qXY1C3KBNEgR/SNOaALEuh BPE/YPTbEgT+jrn0NvvMo8KF2Gtsgtc9Hyx5mko+RSKgfcIEzQMwD5U+C/vhJLNwDb3F cYKw== ARC-Message-Signature: i=2; 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=3wulzPJ7dB/+aPvEvhFky4v54wMywLeN6EVfTjVAdQU=; fh=SgT3m7hIaMm+OR+Fougrvd0KuN0omKDzTHBRp1Uj8jU=; b=LVzhjDphPO26sq1qdT44IvgImgcdF5FUWhF0BASoiAyXTx2BxI6JsUlcDp55PkZy6q 0k6+5xgrAdeFWfP7m/jpOpcA7ctTd+7mRYbJoby9rvfICeP9/+YiX9hBycSr9zYDXRlj PvJlqIBwEdRzUs50BCDB4xBYxGUenFUlv5QwF2SL4O8h1OS+KddOKDD5yjcVfnkQARzm 8zCd51pFZa7+y4D799ERQbbwQ1lgRMkqWWKNK9h2YkwaWEMqoNIMWbWV0qByfGJ8UI8D xhG8pMdTRBI50ylH9hdWnqI21MgbhU5hi1ELFxR8qQTrfwtFRO0f9ILVttFvEcrAJDeM JaOg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=hdMF4pvv; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-122444-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122444-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id q8-20020a170902dac800b001e211c27a7bsi780323plx.465.2024.03.27.22.59.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 22:59:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-122444-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=hdMF4pvv; arc=pass (i=1 spf=pass spfdomain=bytedance.com dkim=pass dkdomain=bytedance.com dmarc=pass fromdomain=bytedance.com); spf=pass (google.com: domain of linux-kernel+bounces-122444-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122444-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.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 9076D2949D9 for ; Thu, 28 Mar 2024 05:59:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7CFAC482C7; Thu, 28 Mar 2024 05:59:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="hdMF4pvv" Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 A04B22B9B4 for ; Thu, 28 Mar 2024 05:59:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711605551; cv=none; b=c60HLTCH7YnApwvAnzC0ZiJsEcY4vaPSEA4xh421m8CghdUyJks1Kv5OWcoSkrLGwTa8+HqdZEkhs3HnV+SwLwfcrxJXMFlNHAszObecdWK/iqPhDjb3Oz1yx2CkCRctu0CWFmqrQUm+3181FxmEDmD8jUv68nk0cC46EHZUsg8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711605551; c=relaxed/simple; bh=/321d+Qvt+lK15o4LdlFgN8rHDY1h6wWZiC7KtOA+6w=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=liJDuu+cFjBILWIcy8zZMVyAaAnVUS4C8DTu2GMouNpt6tBq2Lwc3U8ed6dgkhKXLM76PFj6TiqI2XM/uf0W3VSp1NmoSZoU6FWw/w3pvqIxDUdaYa8j1VNVuRBOXYTXqrh2eiVOXD78Hne+UqJd+wG9tePaBKt4iRFNx2NLP74= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=hdMF4pvv; arc=none smtp.client-ip=209.85.214.178 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Received: by mail-pl1-f178.google.com with SMTP id d9443c01a7336-1e0f2798cd8so5602715ad.3 for ; Wed, 27 Mar 2024 22:59:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1711605549; x=1712210349; 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=3wulzPJ7dB/+aPvEvhFky4v54wMywLeN6EVfTjVAdQU=; b=hdMF4pvvUDzz8T6IgwGAAVy9/xaV8PEhYZ+VKLq21xDHV+D9FWu+cBk6Ln2NFhL6gY 0J3djbf9oev700vA5SxVrjwYSgZSLLvugCwAxUeKtQrWnB4wwLSwGqlB+OkPgLEnBqT2 RzEameaBil07zxPQZghtBqPhNKFnaHjiqktIqJBee20Zm92yCJP3/oedDdUAe+tp0mgC VnDPqtRMg0PFO1/ARW8bKuZXDUShItymykzKZh7T/58KeztO/VOlNeiQwIdP/iZXY+La jWZHOC0cdci/7PqY1FPqD72IH4PCIPNATk+7Of6KTTdj0YlKOiBfXsRYcSJ7ClYQEQEr uz4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711605549; x=1712210349; 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=3wulzPJ7dB/+aPvEvhFky4v54wMywLeN6EVfTjVAdQU=; b=VS9GqbXnfT8TQzAsQe0nXvPPwp1yNli8/t/DGbinZiUSsHR08IoZB3oz9MwWmtl0lg hYCZCMKLxoR4aJ1OvNSoWIG4tgviKzvQwRh9XytQkmaRYnEUkKJ4woCJ4uZK+nImVxrR pTxJSHeLfju4+RxyiNvR1ZT2mEX+Px+CXn40ufkNNAsWntbOFuQFwfOQQbvTuUKTpacv lRuNjcqHYfKWwlXhLmz1GsXrH+iItl7F01bGCaZ+ZPh2J7bzY4uEN4hKuqcwl/TOsJqL ckzw02UOa+ceJ0u/0roLCWc1bR8fKyrVrnE1pa7dH9QZq7OPmHIgrewPOi2jTkGdAw4L moHw== X-Forwarded-Encrypted: i=1; AJvYcCX8LeYFfQIYVddOveD0ZABdYMU2L5UUrHUCb6dqjmgL801XDY9r/o1MnUVSQy2ktPfAaP4Jp8Yw+iW7GlPGTMSdW/k2ta19jRntfPOr X-Gm-Message-State: AOJu0YxM7gwxhvAGiFdptD4ZeAgWW2KK44ah63wN0QkNExRxa4lY4/jU dZoMjCjFkYPu6gkCabPvkr5oWlaBmG1jd/u6Hzws6nrqSTzjEY177IK1n7Dqg+k= X-Received: by 2002:a17:903:2a8e:b0:1df:df4:73e0 with SMTP id lv14-20020a1709032a8e00b001df0df473e0mr2022452plb.4.1711605548965; Wed, 27 Mar 2024 22:59:08 -0700 (PDT) Received: from ubuntu20.04 ([203.208.189.8]) by smtp.gmail.com with ESMTPSA id l9-20020a170902d34900b001e0b461d104sm595984plk.67.2024.03.27.22.59.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Mar 2024 22:59:08 -0700 (PDT) From: Yang Jihong To: peterz@infradead.org, mingo@redhat.com, acme@kernel.org, namhyung@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, irogers@google.com, adrian.hunter@intel.com, kan.liang@linux.intel.com, james.clark@arm.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Cc: yangjihong@bytedance.com Subject: [PATCH 1/2] perf sched timehist: Fix -g/--call-graph option failure Date: Thu, 28 Mar 2024 13:58:56 +0800 Message-Id: <20240328055857.383180-1-yangjihong@bytedance.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit When perf-sched enables the call-graph recording, sample_type of dummy event does not have PERF_SAMPLE_CALLCHAIN, timehist_check_attr() checks that the evsel does not have a callchain, and set show_callchain to 0. Currently perf sched timehist only saves callchain when processing sched:sched_switch event, timehist_check_attr() only needs to determine whether the event has PERF_SAMPLE_CALLCHAIN. Before: # perf sched record -g true [ perf record: Woken up 0 times to write data ] [ perf record: Captured and wrote 4.153 MB perf.data (7536 samples) ] # perf sched timehist Samples do not have callchains. time cpu task name wait time sch delay run time [tid/pid] (msec) (msec) (msec) --------------- ------ ------------------------------ --------- --------- --------- 147851.826019 [0000] perf[285035] 0.000 0.000 0.000 147851.826029 [0000] migration/0[15] 0.000 0.003 0.009 147851.826063 [0001] perf[285035] 0.000 0.000 0.000 147851.826069 [0001] migration/1[21] 0.000 0.003 0.006 After: # perf sched record -g true [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 2.572 MB perf.data (822 samples) ] # perf sched timehist time cpu task name wait time sch delay run time [tid/pid] (msec) (msec) (msec) --------------- ------ ------------------------------ --------- --------- --------- 144193.035164 [0000] perf[277062] 0.000 0.000 0.000 __traceiter_sched_switch <- __traceiter_sched_switch <- __sched_text_start <- preempt_schedule_common <- __cond_resched <- __wait_for_common <- wait_for_completion 144193.035174 [0000] migration/0[15] 0.000 0.003 0.009 __traceiter_sched_switch <- __traceiter_sched_switch <- __sched_text_start <- smpboot_thread_fn <- kthread <- ret_from_fork 144193.035207 [0001] perf[277062] 0.000 0.000 0.000 __traceiter_sched_switch <- __traceiter_sched_switch <- __sched_text_start <- preempt_schedule_common <- __cond_resched <- __wait_for_common <- wait_for_completion 144193.035214 [0001] migration/1[21] 0.000 0.003 0.007 __traceiter_sched_switch <- __traceiter_sched_switch <- __sched_text_start <- smpboot_thread_fn <- kthread <- ret_from_fork Signed-off-by: Yang Jihong --- tools/perf/builtin-sched.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index b248c433529a..1bfb22347371 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -2963,8 +2963,11 @@ static int timehist_check_attr(struct perf_sched *sched, return -1; } - if (sched->show_callchain && !evsel__has_callchain(evsel)) { - pr_info("Samples do not have callchains.\n"); + /* only need to save callchain related to sched_switch event */ + if (sched->show_callchain && + evsel__name_is(evsel, "sched:sched_switch") && + !evsel__has_callchain(evsel)) { + pr_info("Samples of sched_switch event do not have callchains.\n"); sched->show_callchain = 0; symbol_conf.use_callchain = 0; } -- 2.25.1