Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp5614942pxv; Wed, 7 Jul 2021 07:51:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPEi2aNl41LbHWQElec46TjdUO6G1MoEMlI3G6Fnt+dGTDWSq0WOEcF9mONhtuQOBZO62l X-Received: by 2002:a02:a98d:: with SMTP id q13mr15588384jam.124.1625669501148; Wed, 07 Jul 2021 07:51:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625669501; cv=none; d=google.com; s=arc-20160816; b=Qe1FIv/mvhYVuoO/Qofqm5cjIE5xiDtlCLt6SEW2zJN7qJljZtTLSrYYh5Br57ckAA QxuvlhBHGSFs5TIcjARVi43U41UnVdG6jCH2ML9JbbYhe6lIk7CwxEDow5PJgQ5qs8qs dtTh9bSsQ8dsxWCBth09FkKxE/MZdesJnaVXX4XhYJS4pH3xpodfpD4l3647vipEcuGx sefpkyIxLhIxmEOSwZfi8gZdywpOvJtQnCEXqibLJqpsoXfnvVMEvRBWwTrbVg48kO30 MoQ9hLeM2XGXKqujHsSIXOUU2DYiiCW32nVKO8+HZxj+hfnPXi8vN7qBHHSTuKher0mr mJUQ== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=sS3vIiorNkhtwi35Zg4I8VCWQiurl6X5QS48n3VimGY=; b=NBkJv9M2UluuQ1rpW1WdKJQkNzSUokvKnTqdMUAQMY4K7w/ta7yX6D9tGWwzpsLfxu JZWLWpgAKDh5LQtUSORPt/pRPy5L/x2hmToL0FHWH6AOb7BfPHebgnh7EfWyyM6vrfkd ROVBPs06bTgzwOiK1izIRcBCE+xxMKzqjqtBb0eob9Xvd3GFHMIZOqEqaf9mbIZbhd9l BAf3CcOasR0gXn3PkbMFSHBai2ete33JyIMdCf8JVTNIU+CzJBbTS1DN8MTVXzPUS58G +NFDypAMlv7NGJlfgkkw976LampS3fVt7iB6M4orUM6KJ+hLJQ3pCgMw0s36uU6Riyuh 1ZZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Gq5ACYBG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n4si3493849ion.62.2021.07.07.07.51.28; Wed, 07 Jul 2021 07:51:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Gq5ACYBG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S232140AbhGGOxa (ORCPT + 99 others); Wed, 7 Jul 2021 10:53:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:59042 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232173AbhGGOwU (ORCPT ); Wed, 7 Jul 2021 10:52:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0194561130; Wed, 7 Jul 2021 14:49:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625669346; bh=2l1DsW7j//O3bGpUL301v9hbe8B6HM3Efos7O31i39o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Gq5ACYBGMma7Lb74GDWvKTCL21pqYIezTZRs7rBbfwd9CHM0HHz457obLrobmC6Vp /T3/j0vqiqUowMmPDjlsOSkuH/QYZUtI6T4UVaP9doQrUmuJWNwl0iqTPIe2HiyYnR tspGBLy7vfddKCw3cv6iyth47hlVbNzJhJiTOVSXGTIkiME8mOs/HlsINYnCy5qEvN ScDrk5Zhe6ffrQhyj8Hwf5nS3OnzCi2yHuuJI3oT9Lg4kpxS9GgOq/sFKOAKEbvdyO bshke1mu7EyDrwDTP88BAMuvScthrshhRGeD/6N8dkCm6fUDnm22OqhRrizw8grcsJ kQkSBr54ztfvQ== Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id D213C40B1A; Wed, 7 Jul 2021 11:49:03 -0300 (-03) Date: Wed, 7 Jul 2021 11:49:03 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: lkml , Peter Zijlstra , Ingo Molnar , Mark Rutland , Namhyung Kim , Song Liu , Alexander Shishkin , Michael Petlan , Ian Rogers , nakamura.shun@fujitsu.com, linux-perf-users@vger.kernel.org Subject: Re: [PATCH 2/7] libperf: Move idx to perf_evsel::idx Message-ID: References: <20210706151704.73662-1-jolsa@kernel.org> <20210706151704.73662-3-jolsa@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210706151704.73662-3-jolsa@kernel.org> X-Url: http://acmel.wordpress.com Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Em Tue, Jul 06, 2021 at 05:16:59PM +0200, Jiri Olsa escreveu: > Moving evsel::idx to perf_evsel::idx, so we can move > the group interface to libperf. I fixed up this, that appearead on my tree after you cooked up this patch: diff --git a/tools/perf/util/bpf_counter_cgroup.c b/tools/perf/util/bpf_counter_cgroup.c index 21261f1a05011d62..89aa5e71db1a9a23 100644 --- a/tools/perf/util/bpf_counter_cgroup.c +++ b/tools/perf/util/bpf_counter_cgroup.c @@ -124,7 +124,7 @@ static int bperf_load_program(struct evlist *evlist) map_fd = bpf_map__fd(skel->maps.events); for (cpu = 0; cpu < nr_cpus; cpu++) { int fd = FD(evsel, cpu); - __u32 idx = evsel->idx * total_cpus + + __u32 idx = evsel->core.idx * total_cpus + evlist->core.all_cpus->map[cpu]; err = bpf_map_update_elem(map_fd, &idx, &fd, @@ -221,7 +221,7 @@ static int bperf_cgrp__sync_counters(struct evlist *evlist) static int bperf_cgrp__enable(struct evsel *evsel) { - if (evsel->idx) + if (evsel->core.idx) return 0; bperf_cgrp__sync_counters(evsel->evlist); @@ -232,7 +232,7 @@ static int bperf_cgrp__enable(struct evsel *evsel) static int bperf_cgrp__disable(struct evsel *evsel) { - if (evsel->idx) + if (evsel->core.idx) return 0; bperf_cgrp__sync_counters(evsel->evlist); @@ -251,7 +251,7 @@ static int bperf_cgrp__read(struct evsel *evsel) int reading_map_fd, err = 0; __u32 idx; - if (evsel->idx) + if (evsel->core.idx) return 0; bperf_cgrp__sync_counters(evsel->evlist); @@ -263,7 +263,7 @@ static int bperf_cgrp__read(struct evsel *evsel) reading_map_fd = bpf_map__fd(skel->maps.cgrp_readings); evlist__for_each_entry(evlist, evsel) { - idx = evsel->idx; + idx = evsel->core.idx; err = bpf_map_lookup_elem(reading_map_fd, &idx, values); if (err) { pr_err("bpf map lookup falied: idx=%u, event=%s, cgrp=%s\n", @@ -288,7 +288,7 @@ static int bperf_cgrp__read(struct evsel *evsel) static int bperf_cgrp__destroy(struct evsel *evsel) { - if (evsel->idx) + if (evsel->core.idx) return 0; bperf_cgroup_bpf__destroy(skel);