Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp545197lqz; Sat, 30 Mar 2024 07:48:39 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWaZdLX063wGN+1+sNf8/HMf8Gz/jmlutQhJzhMTJsPHFiqZvkb7AE36qYOR1ZA0S/zElvZ7hPyY5loE/ubnVsjtm9DtNfLvyV0pK9aGA== X-Google-Smtp-Source: AGHT+IHiqJQmkGOnv6SVT0tCYveIgj87iE4Iijs74p5x9sWxAQWG1dsFFlayQ4czvmlkD9Pf0SRC X-Received: by 2002:a17:902:ead5:b0:1e0:d62e:77d with SMTP id p21-20020a170902ead500b001e0d62e077dmr4648072pld.23.1711810119090; Sat, 30 Mar 2024 07:48:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711810119; cv=pass; d=google.com; s=arc-20160816; b=w5PvwleS5L89grMF1BTG1W2pRsfFQtyu44Q3Xl1CfuANoZAxuK7qNanWgmj3R+C51k uBEuHaRf3pUbx9HHVWHuOydnvyy90caEO7D3ZxhKGNdHjS4+yEATu7ms3UtA6Uv4otZn f/UtIK5sUDgPxsYXZJl9XfKFRUpD1blMskyTKjIQ4WJBzAtE5bRKwHUvWb42bsEg6j3E ZPlAtuc+eOrfZFiDAI/J/AjYABefi6RX0+hoDN+M2zqIIf+HAxnsMzjyqV3csFP8AFe9 loEc3aTbvVNgT6G/f2iv/jU8oYZXwShM0g/Md5JlnMOKryhkwT7x4kfaHKVcYD2GtGX+ rifA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ITbZYQLQ5WlLmMJZHVfX1czz+WoVnwsLk0YQVP9RVPU=; fh=IWK/Yy4Zv/T+Xlc68btJ8+7kkf8d3u1peEQ8jXNbVZQ=; b=FKXt4FxO1L7ERRazgFuafF40g2uICv8wegBNfVS18l7ht0lqqRI/hE4VmVn279pl7G u4FPQ2NdbxuqbXHpwkf6O/3YTbgDZXaGWKMavldJGwzesOmqLVrx4/oW/2OVwlFzobKh 7q5KR3J+hVv83ZBFnt/PKQZa02kF+sGHcLwyLgSNoXpUptQbuJimnkxEJqUFaJ5PR0vw 5b2culQjU6KWqkyR9yY1UyJBJEBr8ziID65zYBgnqvP5NxBZOIuzB8n3XFpdplg9ncwV r+P/lb1sLxG5bbXkBPnG67AhJ0lkGr6sjpCCLDofPfQuIAS3umq59kwQMxS/kZ1oUUJd G3DA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rl28LvWu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-125747-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125747-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id u6-20020a17090282c600b001dd92587f16si5404156plz.628.2024.03.30.07.48.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Mar 2024 07:48:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-125747-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rl28LvWu; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-125747-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125747-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id B5301B2137C for ; Sat, 30 Mar 2024 14:48:34 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 32C4E381B1; Sat, 30 Mar 2024 14:48:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="rl28LvWu" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 41B811C0DEF; Sat, 30 Mar 2024 14:48:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711810105; cv=none; b=KWU9xytssS3Dk4R4oX9zXo21nAd9kubNc/rvtqRnAT9szDah70tCLi9OxJfUZi5hjfGxneRqAO3I5VJ8e24eO4oGdoUk4yxp6MSoynBQJafcsj0BMrp/pNDzRmVxkmKR+4LDgPMf3PJm+ghB5YrT9oJokAedrAVLis9ENmMxrhA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711810105; c=relaxed/simple; bh=Wpkl9TtAeYU9lc9iPFm/MeqQLMnA8ufIvAGWRAEVtaA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hP/EPUNBW8xVNKlwkOhmmE8v25DskoPmwKPT8ju9MfKV5vmY5ccldjOaO0Sml+e3BCqqz2UJjqRQCTN8tU4rM6zQcquYpQ98TZ9GIm4B4tTRfjldJiYRPikSnh+q5ps9brjJTTjNZ0xsoaibDc+CVs2w/4QOJq2w3t5O1I/bOp0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=rl28LvWu; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id AA508C433F1; Sat, 30 Mar 2024 14:48:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711810105; bh=Wpkl9TtAeYU9lc9iPFm/MeqQLMnA8ufIvAGWRAEVtaA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rl28LvWuFUbDMNMTs3jM2vEcteIEkTJvj5Fok1q2nGshSmLpeLtvBgyoXWQFJp3E8 Oaa+vGpQ+70PxJXQTSmaEp2eRGA95J5/emnQqBdwpX41fB12NQTXwqt/2yPpx7U1l8 umVnvpN3RyRoNMmPKxq9zanAzsQxBU+NX0VElsD02Y2qyK5DtDv077RkRosRspUIL6 BY9I7Qh6LK7xg89hWPjMPax6Q774xv45MjElmJrIAnkJSJBuZ/saV/uC/G1okbTa4k K/n+GPG9qT6p9XV/c/kIOsCLK4fydvf/HCVgp68ws0MHMikwPPW1g/9/DWoOaWmKJ/ +J5qMNnOUHqhg== Date: Sat, 30 Mar 2024 11:48:21 -0300 From: Arnaldo Carvalho de Melo To: Ian Rogers Cc: Yang Jihong , peterz@infradead.org, mingo@redhat.com, namhyung@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org, adrian.hunter@intel.com, kan.liang@linux.intel.com, james.clark@arm.com, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [External] Re: [PATCH 1/2] perf sched timehist: Fix -g/--call-graph option failure Message-ID: References: <20240328055857.383180-1-yangjihong@bytedance.com> <2e44ae50-d4af-4788-9274-aaf345bac066@bytedance.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Fri, Mar 29, 2024 at 09:08:01AM -0700, Ian Rogers wrote: > On Thu, Mar 28, 2024 at 8:02 PM Yang Jihong wrote: > > > > Hello, > > > > Sorry, due to the new email settings, the last reply email was in html > > format, resend it now. > > > > On 3/29/24 00:02, Ian Rogers wrote: > > > On Wed, Mar 27, 2024 at 10:59 PM Yang Jihong wrote: > > >> > > >> 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 > > >> > > > > > > This looks good, should there be a Fixes tag for the sake of backports? > > > > > The direct cause is commit 9c95e4ef0657 ("perf evlist: Add > > evlist__findnew_tracking_event() helper"). perf-record uses > > evlist__add_aux_dummy() to replace evlist__add_dummy() to add a dummy > > event. The difference is that evlist__add_aux_dummy() sets > > no_aux_samples to true (this is expected behavior, for dummy event, no > > need to sample aux data), resulting in evsel__config() not adding the > > PERF_SAMPLE_CALLCHAIN bit to dummy's sample_type. > > > > In summary, the direct cause is the problem introduced by commit > > 9c95e4ef0657 ("perf evlist: Add evlist__findnew_tracking_event() > > helper"), but the root cause is the timehist_check_attr() logic problem, > > The dummy event itself does not need to have PERF_SAMPLE_CALLCHAIN, so > > there is no need to check it. > > > > > > So, maybe add fixes-tag: > > > > Fixes: 9c95e4ef0657 ("perf evlist: Add evlist__findnew_tracking_event() > > helper") > > > > If it is ok, I will send v2 version with this fixes-tag. > > I think the maintainer can add the fixes tag when they add the reviewed-by tag: I usually do this, but if the submitter does it I'll have just to check that it is the right tag, helps a bit in processing. - Arnaldo > Reviewed-by: Ian Rogers > > Thanks, > Ian > > > Thanks, > > Yang