From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6E692C433F5 for ; Thu, 12 May 2022 11:40:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353346AbiELLkM (ORCPT ); Thu, 12 May 2022 07:40:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239947AbiELLkI (ORCPT ); Thu, 12 May 2022 07:40:08 -0400 Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0501B6D4C8 for ; Thu, 12 May 2022 04:40:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1652355608; x=1683891608; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=334QfPsBhgD128XgXQmRYLsAEiLeQWJ3MXNBRTVpIsw=; b=PDVUJz2h/Hlih36WLWOJqDG6cyrmk94I3IExIqWj4Y91CcDDVFFYN7FM ZkBr2h/MxmL/yyYTPspKUEFgbU0LXHYrkCmbr4EnPRPZnESl3rGeVGMEQ wPZPTpmQmUty5lTYPIV2pGbqZ0DBmBZ1jkb3c/zqteRvrW5annkxAhrxO LOiA5rmV1B4zPPtwQI2Ep6hMbEmfrZttTTP2FlTJ5C5FYN1TDgkxeGNeD Zq2/6VfGs22Y0Y2ddDr3NbELSxySjOVk3Ms+Xgd8VbP6DLz3Labysowc9 D5xHw8c7PihmV5c4T1GAP83PR0OhvwFXU0BPOGAxTjaTrItOrzeFpV6ju w==; X-IronPort-AV: E=McAfee;i="6400,9594,10344"; a="257521551" X-IronPort-AV: E=Sophos;i="5.91,219,1647327600"; d="scan'208";a="257521551" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2022 04:40:07 -0700 X-IronPort-AV: E=Sophos;i="5.91,219,1647327600"; d="scan'208";a="594628454" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO [10.0.2.15]) ([10.252.32.215]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 May 2022 04:40:04 -0700 Message-ID: Date: Thu, 12 May 2022 14:40:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.8.1 Subject: Re: [PATCH V2 21/23] libperf evsel: Add comments for booleans Content-Language: en-US To: Ian Rogers Cc: Arnaldo Carvalho de Melo , Jiri Olsa , Alexey Bayduraev , Namhyung Kim , Leo Yan , linux-kernel@vger.kernel.org References: <20220506122601.367589-1-adrian.hunter@intel.com> <20220506122601.367589-22-adrian.hunter@intel.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/05/22 08:34, Ian Rogers wrote: > On Wed, May 11, 2022 at 12:03 AM Adrian Hunter wrote: >> >> On 6/05/22 23:51, Ian Rogers wrote: >>> On Fri, May 6, 2022 at 5:26 AM Adrian Hunter wrote: >>>> >>>> Add comments for 'system_wide' and 'requires_cpu' booleans >>>> >>>> Signed-off-by: Adrian Hunter >>>> --- >>>> tools/lib/perf/include/internal/evsel.h | 9 +++++++++ >>>> 1 file changed, 9 insertions(+) >>>> >>>> diff --git a/tools/lib/perf/include/internal/evsel.h b/tools/lib/perf/include/internal/evsel.h >>>> index 77fbb8b97e5c..cc8f1ba790bd 100644 >>>> --- a/tools/lib/perf/include/internal/evsel.h >>>> +++ b/tools/lib/perf/include/internal/evsel.h >>>> @@ -49,7 +49,16 @@ struct perf_evsel { >>>> >>>> /* parse modifier helper */ >>>> int nr_members; >>>> + /* >>>> + * system_wide is for events that need to be on every CPU, irrespective >>>> + * of user requested CPUs or threads. Map propagation will not override >>>> + * this events own_cpus, which will contribute to evlist all_cpus. >>> >>> So this muddies my understanding of cpus and own_cpus (sigh, again >>> undocumented). I believe cpus to be the set of CPUs (or any CPU, aka >>> dummy) that perf_event_open happens on. all_cpus in evlist is the >>> union of all the evsels cpus (ie not related to own_cpus as described >>> here). Own_cpus I believe to be what's computed at parse-event time >>> from sysfs. Is this a typo in the comment or quite likely my error? >> >> A 'system_wide' event is not created by the parser, so own_cpus is set >> by the code adding the event. > > I think I may be misreading the comment. Perhaps it should read: > > system_wide is for events that need to be on every CPU, irrespective > of user requested CPUs or threads. Map propagation will not override > this event's own_cpus and own_cpus don't contribute to the evlist > all_cpus. For a system_wide evsel, evsel->cpus are set to own_cpus and the evsel->cpus contribute to all_cpus. > > It would be nice if there were a comment on own_cpus to explain its > relationship to cpus and more broadly when it is used. Fwiw, the parse > time copy is made here: > https://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git/tree/tools/perf/util/parse-events.c?h=perf/core#n367 > > I worry that if own_cpus should be used in place of cpus then > iterators like evlist__for_each_cpu may need to handle this, and so > they'd be broken currently. No, evsel->own_cpus may be used to determine evsel->cpus, but that is where their influence stops. > > Thanks, > Ian > >>> >>> Thanks, >>> Ian >>> >>>> + */ >>>> bool system_wide; >>>> + /* >>>> + * Some events, for example uncore events, require a CPU. >>>> + * i.e. it cannot be the 'any CPU' value of -1. >>>> + */ >>>> bool requires_cpu; >>>> int idx; >>>> }; >>>> -- >>>> 2.25.1 >>>> >>