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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 364CDC433F5 for ; Sun, 9 Jan 2022 18:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WLXcmVEthxTr1stcsUPdVDx87RYKcBNUTECn6Ox7iNU=; b=4xNq9VMtHguKsf 0RyTyse9oWEKc1xV3/MHhgtJd9eGOfnmyLrzED+SgqAzTIWxN97y839T/uSXDTb7tnlOvI+gBvtxt 5poyai6gJQ2b2n8vTDvFfHz+bSon54KZY/pQp5Rf7k4jZI9YZToi3+PdD1ZN9tDqqx731w+zXVh5Q EM7A9t7MK5xu5trNUHML+OqAS4eywnSWr3Yz6Iikak41yfAzj6JgWED3xeOlkTkq9Ur17/x801HfR XTtcSzYNGCBiIf2Lmeaum0WJYxCBQ5Ii+DxYsUIVQa/q4eTS12YTCcPz1FvA7Z2RRsxPFpNk8kAGU RadT7Jel0ApUypo4q46w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6cy6-008ETb-Dy; Sun, 09 Jan 2022 18:31:02 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n6cxv-008ERU-9w for linux-arm-kernel@lists.infradead.org; Sun, 09 Jan 2022 18:30:53 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1641753050; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AYvOwjwqFrDqfGP5yZ04n7pfG3rcdHLdCFAeOhb9uKU=; b=TxedaNfUg4zpuGBxnuRVDp87bu2s/GIMFNZf4fRCiWZendYTgCmHKbEYiwiNTETX3n675U tr6gp1LZ/UOVuRMcO7xBBE7bYMbTAaH7otavlnW7gtlOtlvGCrc8Sz4rsKwoaNo3ROeiXL qPxJ61Gat4DoBHxKg2A0ljJQukz5B7U= Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-168-y9gc-8IbPsWp44uA97cE_A-1; Sun, 09 Jan 2022 13:30:49 -0500 X-MC-Unique: y9gc-8IbPsWp44uA97cE_A-1 Received: by mail-ed1-f71.google.com with SMTP id c8-20020a05640227c800b003fdc1684cdeso438657ede.12 for ; Sun, 09 Jan 2022 10:30:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=AYvOwjwqFrDqfGP5yZ04n7pfG3rcdHLdCFAeOhb9uKU=; b=z8jZ1hJu3epdhADhBUv6dQc5PRmJhkO0AjB4QVCZTosY1lFBBsEueqHaHyha37w1cQ C6E4wz7EQooP3iIkgyRveYh4Eig9onIlwrvVVHk89aVAdFgYKNMfJm6YZ7LzUSxcUCXM JS4hwY2IMnPNG3Uz1CM7VsAlxcYC3PcyR7tGbNd/ee5HXGHbkYx9a4pyAQUnYA4OKL4E do9xl7/MV4cX3xhFLD0++LdaLbHc/7GAbYoEaOs7+Q0RrJXUSV8TA26MfVaBwu6U32ED DKOIV3Qe4MB4Q9rYgp+ZSdnEv5DoEpKiidQUKDBaPejRWWu6V0CPczc453BDCHwqU0Oc JUnQ== X-Gm-Message-State: AOAM532/0SdwfZ3QMgcWo2zDF+Pwk7ZfU4ljHNM1AtvzzZHYXB8FHccG K+3Qt9mh+mZIsYny45SvdKlkTZMMgpexsiDulikNzrR9zRjDLSjbdypT5op9SF9+3qU1H7uJgUV YT1vCnu6v88nTW2DHr//L5ajPSq0vPxoOV0o= X-Received: by 2002:a17:907:97c7:: with SMTP id js7mr54984077ejc.84.1641753048047; Sun, 09 Jan 2022 10:30:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJyV85a35OqUpicNWJWT5Lo2uyafytuFeApaXBkbpEfniiZMeOk+K5aqzwQAeklDfmJPYVfVRA== X-Received: by 2002:a17:907:97c7:: with SMTP id js7mr54984064ejc.84.1641753047877; Sun, 09 Jan 2022 10:30:47 -0800 (PST) Received: from krava (nat-pool-brq-u.redhat.com. [213.175.37.12]) by smtp.gmail.com with ESMTPSA id o25sm2376412edr.20.2022.01.09.10.30.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jan 2022 10:30:47 -0800 (PST) Date: Sun, 9 Jan 2022 19:30:45 +0100 From: Jiri Olsa To: Ian Rogers Cc: Andi Kleen , Namhyung Kim , John Garry , Kajol Jain , "Paul A . Clarke" , Arnaldo Carvalho de Melo , Riccardo Mancini , Kan Liang , Peter Zijlstra , Ingo Molnar , Mark Rutland , Alexander Shishkin , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Vineet Singh , James Clark , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Leo Yan , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, zhengjun.xing@intel.com, eranian@google.com Subject: Re: [PATCH v4 26/48] perf evsel: Derive CPUs and threads in alloc_counts Message-ID: References: <20220105061351.120843-1-irogers@google.com> <20220105061351.120843-27-irogers@google.com> MIME-Version: 1.0 In-Reply-To: <20220105061351.120843-27-irogers@google.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jolsa@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220109_103051_489803_4B054A76 X-CRM114-Status: GOOD ( 19.51 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Jan 04, 2022 at 10:13:29PM -0800, Ian Rogers wrote: SNIP > diff --git a/tools/perf/util/counts.h b/tools/perf/util/counts.h > index 7ff36bf6d644..3e275e9c60d1 100644 > --- a/tools/perf/util/counts.h > +++ b/tools/perf/util/counts.h > @@ -40,7 +40,7 @@ void perf_counts__delete(struct perf_counts *counts); > void perf_counts__reset(struct perf_counts *counts); > > void evsel__reset_counts(struct evsel *evsel); > -int evsel__alloc_counts(struct evsel *evsel, int ncpus, int nthreads); > +int evsel__alloc_counts(struct evsel *evsel); > void evsel__free_counts(struct evsel *evsel); > > #endif /* __PERF_COUNTS_H */ > diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c > index 656c30b988ce..6c9af21776e6 100644 > --- a/tools/perf/util/evsel.c > +++ b/tools/perf/util/evsel.c > @@ -1578,7 +1578,7 @@ int __evsel__read_on_cpu(struct evsel *evsel, int cpu, int thread, bool scale) > if (FD(evsel, cpu, thread) < 0) > return -EINVAL; > > - if (evsel->counts == NULL && evsel__alloc_counts(evsel, cpu + 1, thread + 1) < 0) > + if (evsel->counts == NULL && evsel__alloc_counts(evsel) < 0) ugh, nice.. good that it's used only from test code ;-) btw I noticed evsel__read_on_cpu_scaled is not used at all jirka > return -ENOMEM; > > if (readn(FD(evsel, cpu, thread), &count, nv * sizeof(u64)) <= 0) > diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c > index c69b221f5e3e..995cb5003133 100644 > --- a/tools/perf/util/stat.c > +++ b/tools/perf/util/stat.c > @@ -152,11 +152,13 @@ static void evsel__free_stat_priv(struct evsel *evsel) > zfree(&evsel->stats); > } > > -static int evsel__alloc_prev_raw_counts(struct evsel *evsel, int ncpus, int nthreads) > +static int evsel__alloc_prev_raw_counts(struct evsel *evsel) > { > + int cpu_map_nr = evsel__nr_cpus(evsel); > + int nthreads = perf_thread_map__nr(evsel->core.threads); > struct perf_counts *counts; > > - counts = perf_counts__new(ncpus, nthreads); > + counts = perf_counts__new(cpu_map_nr, nthreads); > if (counts) > evsel->prev_raw_counts = counts; > > @@ -177,12 +179,9 @@ static void evsel__reset_prev_raw_counts(struct evsel *evsel) > > static int evsel__alloc_stats(struct evsel *evsel, bool alloc_raw) > { > - int ncpus = evsel__nr_cpus(evsel); > - int nthreads = perf_thread_map__nr(evsel->core.threads); > - > if (evsel__alloc_stat_priv(evsel) < 0 || > - evsel__alloc_counts(evsel, ncpus, nthreads) < 0 || > - (alloc_raw && evsel__alloc_prev_raw_counts(evsel, ncpus, nthreads) < 0)) > + evsel__alloc_counts(evsel) < 0 || > + (alloc_raw && evsel__alloc_prev_raw_counts(evsel) < 0)) > return -ENOMEM; > > return 0; > -- > 2.34.1.448.ga2b2bfdf31-goog > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel