From patchwork Mon Mar 20 03:37:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 71948 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1002373wrt; Sun, 19 Mar 2023 20:55:35 -0700 (PDT) X-Google-Smtp-Source: AK7set8QL3eIe5T3KCy6jkoLH6ROlnmbXPIzm09FK1gabpTkexoj6C9qAXjF4xRHrlYv/4KohSqL X-Received: by 2002:a17:902:ee4d:b0:19a:839d:b67a with SMTP id 13-20020a170902ee4d00b0019a839db67amr15659820plo.5.1679284534926; Sun, 19 Mar 2023 20:55:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679284534; cv=none; d=google.com; s=arc-20160816; b=RsXuOBXfesGH92XadpghD1vIQlBRETgobaYeGXhkHg2v9DZp1mQLYKjfDvtCs3ieVV AbBNYCJZSz5LPe2Xf04Ut1d5D8JecjsX/B3cMrHx2QHKQqo4yswXAbrf4HI4xmv+a0TA t7jvP8sjHDTxxzTHv47PesA6kDBkbRzIfQEpqfBQxYbbtHkHaVkmVvu8e3mFj0QWKe3x xUzA1e+AMIBeGO6w7v/7AhWGuE9K9zTMIMwIwspPZE6XkF/IaMHN9e2ys08tNIPsJgi1 bjW3KivPofG1UNA4FTwRxujiS3N6Oyh4tbR2R3bRCDxOQyAztO5+fB5xRZxspX7qJX/f 62bQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:references:mime-version :message-id:in-reply-to:date:dkim-signature; bh=Xrt9Ph5px6prAvTQhXAecI3U6Lfan0vmOke50ovWG1M=; b=v55LVa9QS8Kqwce0jSfH4BA8iUbV2piGG/DZrUXZ1HU0GT3xQl2avdmdeDPIL+ukSW ZKhEbAQzqXu4dRyCe7zgHoVwk6o/e6y1F7sOHdCoMbODO1FsP0bfo1R8qDVe/8i/enqp nYwktDwwhSbuKO64c/5UyhRx1VjAp5WaZhNtK4RbTf3gG/I4DHJdItNdBti/aucnSf8S qL4/Goyxw6qk6AdpLjSoyV9W9KUpsdNZUL1VC0qKeoItaBtTKk5nF4QtNh6VZPXi6gre tGsWyugHgORjs7vCelxaH6vtOOVIYjPo/PMWXYzxXEu2ovsVfYb4d+WRr2dFvh41HUPd vH9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=SLm8pysa; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w13-20020a170902a70d00b00194afb5a3f9si9306463plq.164.2023.03.19.20.55.20; Sun, 19 Mar 2023 20:55:34 -0700 (PDT) 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=@google.com header.s=20210112 header.b=SLm8pysa; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229481AbjCTDjD (ORCPT + 99 others); Sun, 19 Mar 2023 23:39:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229734AbjCTDiy (ORCPT ); Sun, 19 Mar 2023 23:38:54 -0400 Received: from mail-yw1-x114a.google.com (mail-yw1-x114a.google.com [IPv6:2607:f8b0:4864:20::114a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ED1EA1ABF7 for ; Sun, 19 Mar 2023 20:38:52 -0700 (PDT) Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-544781e30easo108370047b3.1 for ; Sun, 19 Mar 2023 20:38:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; t=1679283532; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=Xrt9Ph5px6prAvTQhXAecI3U6Lfan0vmOke50ovWG1M=; b=SLm8pysaaJPDn3tarDhYFdN0EoWhscBYsdzIjuWTUUtB0j5tEwe9R6xoqXPNrT+h5K qKOSI+OR5Q//CyRQL5Y6rR4Tls8LUt0f2xYILflCtzDTTw6Vur94Fe97Ks5zz4Eawyz1 lvxTNIpHcD/epo6xo2SUaNrFgX5A3JIn8sFS+kHVL9WNcJdiXjHODNVfbnVsGYg9IhBo g4MAGQT5FE1aYb8pbG9MqU7Pxjcm09dDr6JOyE0OASTf7Ogit8u8Bg++uq+JkKagUiXg o0ib7riT4+5/P3/WoHSyQinzMlXTvfshQjEhhHhn3+y5jiWSMlnMjrIj5eIR0pFeTPCG WEEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679283532; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Xrt9Ph5px6prAvTQhXAecI3U6Lfan0vmOke50ovWG1M=; b=FQ++Xf2K0JMY0GNGZiUutWK7SD1B3DZllbgXJ1LLpShOElMTFweOSQWgE10uu7bwtc fIU6ylDCrU6Lz4SvmiyaZPvaI4Gls+3pVB/K0HGPKRDRbPzy2K2wDHLvMPeOCdZChuc5 xvtU318Vg4N2oF3gZVT3oRzTRWEhbboAlANhhdAdlD2pyQSTa1b9aen07BQESfCxHbWr fOp8Q9FKmN1B+zcx/wzR5kpem6/9CxpkGfzJyRhRFQM49GfGGWJtW0h7SeNE4Gd6qj97 Cc25/Ig0B71URgRmP7dgvAdLA5a6HN9BjunoZn7zfVzhxUUkoFU1f55Z/eaQ6X/iOsMO nDZw== X-Gm-Message-State: AO0yUKVZy7b5UY6ak7QynMEjRy4WGLWCWCdfxEn8cH4zkJLwPbCYXuhA 9PNZZKunlN7TQnmpzf3sqhlAtnmFUroe X-Received: from irogers.svl.corp.google.com ([2620:15c:2d4:203:1895:9fa0:27f5:cb71]) (user=irogers job=sendgmr) by 2002:a05:6902:1002:b0:b4a:e062:3576 with SMTP id w2-20020a056902100200b00b4ae0623576mr3589232ybt.13.1679283531762; Sun, 19 Mar 2023 20:38:51 -0700 (PDT) Date: Sun, 19 Mar 2023 20:37:50 -0700 In-Reply-To: <20230320033810.980165-1-irogers@google.com> Message-Id: <20230320033810.980165-3-irogers@google.com> Mime-Version: 1.0 References: <20230320033810.980165-1-irogers@google.com> X-Mailer: git-send-email 2.40.0.rc1.284.g88254d51c5-goog Subject: [PATCH v4 02/22] perf bpf_counter: Use public cpumap accessors From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , Darren Hart , Davidlohr Bueso , " =?utf-8?q?Andr=C3=A9_Almeida?= " , James Clark , John Garry , Riccardo Mancini , Yury Norov , Andy Shevchenko , Andrew Morton , Adrian Hunter , Leo Yan , Andi Kleen , Thomas Richter , Kan Liang , Madhavan Srinivasan , Shunsuke Nakamura , Song Liu , Masami Hiramatsu , Steven Rostedt , Miaoqian Lin , Stephen Brennan , Kajol Jain , Alexey Bayduraev , German Gomez , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Eric Dumazet , Dmitry Vyukov , Hao Luo Cc: Stephane Eranian , Ian Rogers X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760857460707640940?= X-GMAIL-MSGID: =?utf-8?q?1760857460707640940?= Avoid the use of internal apis via the cpumap accessor functions. Signed-off-by: Ian Rogers --- tools/perf/util/bpf_counter.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/perf/util/bpf_counter.c b/tools/perf/util/bpf_counter.c index 1b77436e067e..76ee3e86824a 100644 --- a/tools/perf/util/bpf_counter.c +++ b/tools/perf/util/bpf_counter.c @@ -545,7 +545,7 @@ static int bperf__load(struct evsel *evsel, struct target *target) filter_type == BPERF_FILTER_TGID) key = perf_thread_map__pid(evsel->core.threads, i); else if (filter_type == BPERF_FILTER_CPU) - key = evsel->core.cpus->map[i].cpu; + key = perf_cpu_map__cpu(evsel->core.cpus, i).cpu; else break; @@ -587,9 +587,9 @@ static int bperf_sync_counters(struct evsel *evsel) { int num_cpu, i, cpu; - num_cpu = all_cpu_map->nr; + num_cpu = perf_cpu_map__nr(all_cpu_map); for (i = 0; i < num_cpu; i++) { - cpu = all_cpu_map->map[i].cpu; + cpu = perf_cpu_map__cpu(all_cpu_map, i).cpu; bperf_trigger_reading(evsel->bperf_leader_prog_fd, cpu); } return 0;