Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1401889rwb; Wed, 14 Dec 2022 09:42:56 -0800 (PST) X-Google-Smtp-Source: AA0mqf4klUKuHCFM9vIYH77ZQ2dbsLXRGGmb0aUifqyV5T6VzHrjIaASKhP7KNkLqAlX8lSRCE3L X-Received: by 2002:a05:6402:3987:b0:467:e9a5:77c4 with SMTP id fk7-20020a056402398700b00467e9a577c4mr20826615edb.14.1671039776207; Wed, 14 Dec 2022 09:42:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671039776; cv=none; d=google.com; s=arc-20160816; b=NVQ9/5B5oJTgPpHmy+czxK/s3PgirqhiuXZ6bmrhiwoCLua8uT3ieACT2AAVD/NpuR naoj1qRlZb6iM22XNxyaWfXLfwEHR6mQ1YRcWRH2I8YZdXNIVAZMUTQLX1siOLUrskD5 HRx+q6HiCYP5qymLlYE7hJ+9oBzDo/DPHOjrDO2Y4b30VcSlHWlLYdVoS0Ikv7RN4PyI L5I8E+56WNMuQtNxpVtDLDFdiVlGlttx/Vlhylj3/zFQf+OHBBanf7HMqqJ5wH97TUUO xfhmpAKRwyiUtktn9cyJfETUoZPIqSEl48EFfn2m/t4zUGxT1Smz2qBbr6FYnf8qEMQV 6IIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=WfiTsqqJleqbvHg0rGvaDJs2YGiKic5kg549WYGLyOQ=; b=t5lxGpxS0WCDJB1tjherwvS4RnBvkm5W49yMNCxM2N22XL8Y3JRL/w2m6UuU1W3KnJ J0Xd8RwUX1ttiHUfMRIwL7pSDAR8AjcOSCcpt/iynwgqUVrdDWTP835HVbzTCxZHCYTl TdqHbNPr7z8o7zb702p5PV1BLOOSowrEL/86Zc5ydhMzPwq2PF2GXovMsN5UvC9V251m F36LGl/v3YK24g6MLk9OocRO8vJqJfasgXuPWYeDfJySlQ1RPXrbX85763ZAtQn3Dz+l TM08mXNtpgFTQ8R9k1kVQgO4743vRKWwghs8+C8Lx9dq+mrTs3JlXCLHvjp53Czw59ie +DoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="JCV0Fd/a"; 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 j24-20020aa7ca58000000b00469f14100ecsi11604739edt.375.2022.12.14.09.42.39; Wed, 14 Dec 2022 09:42:56 -0800 (PST) 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="JCV0Fd/a"; 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 S237793AbiLNRfI (ORCPT + 70 others); Wed, 14 Dec 2022 12:35:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229561AbiLNRfG (ORCPT ); Wed, 14 Dec 2022 12:35:06 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48384E25; Wed, 14 Dec 2022 09:35:05 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id D731361B79; Wed, 14 Dec 2022 17:35:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1456FC433EF; Wed, 14 Dec 2022 17:35:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671039304; bh=gc8zeNDEuZKdGQgmQ907LP9lyq1u/4yg+3L7iqX/3KM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JCV0Fd/a9Y0U5jszw4Y4B/oOHklPRieIYq40WRRza9kmAVVjO2pZ1jZ/13nrMo1kA N41D8kUyiBukl/c+nKUxJsfoEizz6H/l0o57t0zZx5ENef3YCSk1UlRSe3A7weKRw2 ftkY9lA9z9hOXtIAw5v7d5Jk4ls04s1AodfklQWm8ls+1lEdz9rcyqL/R5EFQUb2ct cx7SB65Pk34+N8CvuiTe+rML+dSJt/UaHLq16XmZ1vBddcjlU9W9Hb3tCya99zgP6z jUJF9AjVC8ThptasDNqV7hxfjv71hSyId4bPWm5yDhsVbW1Z6cAsLUt20k11l22mnT b+ISWAXnCIACg== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 1A20440367; Wed, 14 Dec 2022 14:35:01 -0300 (-03) Date: Wed, 14 Dec 2022 14:35:01 -0300 From: Arnaldo Carvalho de Melo To: Leo Yan Cc: Namhyung Kim , James Clark , =?iso-8859-1?Q?Adri=E1n?= Herrera Arcila , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, songliubraving@fb.com, peterz@infradead.org, mingo@redhat.com, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, jolsa@kernel.org Subject: Re: [PATCH 2/2] perf stat: fix unexpected delay behaviour Message-ID: References: <20220729161244.10522-1-adrian.herrera@arm.com> <20220729161244.10522-2-adrian.herrera@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Url: http://acmel.wordpress.com X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Em Wed, Dec 14, 2022 at 11:57:21PM +0800, Leo Yan escreveu: > On Wed, Dec 14, 2022 at 11:41:55AM -0300, Arnaldo Carvalho de Melo wrote: > > Em Tue, Dec 13, 2022 at 08:40:31AM -0800, Namhyung Kim escreveu: > > > Hi, > > > > > > On Tue, Dec 13, 2022 at 6:44 AM Arnaldo Carvalho de Melo > > > wrote: > > > > > > > > Em Mon, Aug 01, 2022 at 09:20:37AM +0100, James Clark escreveu: > > > > > > > > > > > > > > > On 29/07/2022 17:12, Adri?n Herrera Arcila wrote: > > > > > > The described --delay behaviour is to delay the enablement of events, but > > > > > > not the execution of the command, if one is passed, which is incorrectly > > > > > > the current behaviour. > > > > > > > > > > > > This patch decouples the enablement from the delay, and enables events > > > > > > before or after launching the workload dependent on the options passed > > > > > > by the user. This code structure is inspired by that in perf-record, and > > > > > > tries to be consistent with it. > > > > > > > > > > > > Link: https://lore.kernel.org/linux-perf-users/7BFD066E-B0A8-49D4-B635-379328F0CF4C@fb.com > > > > > > Fixes: d0a0a511493d ("perf stat: Fix forked applications enablement of counters") > > > > > > Signed-off-by: Adri?n Herrera Arcila > > > > > > --- > > > > > > tools/perf/builtin-stat.c | 56 ++++++++++++++++++++++----------------- > > > > > > 1 file changed, 32 insertions(+), 24 deletions(-) > > > > > > > > > > Looks good to me. Fixes the counter delay issue and the code is pretty > > > > > similar to perf record now. Although I would wait for Leo's or Song's > > > > > comment as well because they were involved. > > > > > > > > I think I didn't notice Leo's ack, it still applies, so I'm doing it > > > > now. > > > > > > I think the BPF counters should be enabled/disabled together. > > > > Ok, so I removed this one and applied Namhyung's. > > I can guess why Adri?n doesn't enable/disable BPF counters together :) > > Since 'perf stat' doesn't enable BPF counters with other normal PMU > events in the first place, I believe this is deliberately by Song's > patch fa853c4b839e ("perf stat: Enable counting events for BPF > programs"), it says: > > "'perf stat -b' creates per-cpu perf_event and loads fentry/fexit BPF > programs (monitor-progs) to the target BPF program (target-prog). The > monitor-progs read perf_event before and after the target-prog, and > aggregate the difference in a BPF map. Then the user space reads data > from these maps". > > IIUC, when loading eBPF (counter) program, perf tool needs to handle > eBPF program map specially (so that perf tool can know the latest eBPF > program's map in kernel). > > I don't know anything for eBPF counter, so this is why I am still a bit > puzzle which way is right to do (bind vs separate eBPF counters). But > I personally prefer to let eBPF counter to respect delay, so it's fine > for me to apply Namhyung's patch. "I'm fine" can be read as an Acked-by, right? :-) - Arnaldo