From patchwork Wed Jan 5 06:13:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 12704112 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 61336C433F5 for ; Wed, 5 Jan 2022 06:49:53 +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:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=CSfhPmx62R/s/o1IKvFhnu3J5dq/JH/PeLs1X3d3W4o=; b=h6Pq2VBX9rPN/Gjonia/LIdDCB SanDCqwEwOCGvIevZa7aBbCbp/RgRbaT1Yf4ZokMGtbmxBLqVbPkbQs6RXbhd0G6oDM5zgqlsvbzp G6GWQv6k7e99BYHJoP0QAgRf66gNaSVBQxnou1zsvhTD5vmxb7WXqdQqj+Rfv7kRZV3RpBgfkbhka /NBJWI7c57UwuDl7kL7I9/Z4RKboJ5BQHcHiVLAjCjdCdOVZrkn0cYppTQggV6MmEt5MYp2uhB7p/ mQpFTvNGEN3q4mTsU2GyEPhFufTJNWxj3rF/A0RZHDqP6X7gcNthIp/eKpa8UuKXbP7j0AsAAQT0X Icx9OoPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n505r-00Dsuw-HS; Wed, 05 Jan 2022 06:48:20 +0000 Received: from mail-yb1-xb49.google.com ([2607:f8b0:4864:20::b49]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1n4zaH-00DgWA-7w for linux-arm-kernel@lists.infradead.org; Wed, 05 Jan 2022 06:15:42 +0000 Received: by mail-yb1-xb49.google.com with SMTP id b6-20020a256706000000b0060aa7315dd9so58382301ybc.9 for ; Tue, 04 Jan 2022 22:15:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=wNEaBrVID5KM3S+MlzNQlzdEQtierpy9+J1kdBtC9c0=; b=WZn8xmkrKYSldq7JqIbFNcKZISXWtE24gAeqxe6WCDbrccu2Na4X6LhsDB70POLjWs GZiEqTanFDVpY5baoNwRYrFOkXnFRPPTjViOrsSBkVFTbcJOAxANKymYca22p/Ij1mT+ 6QHcEP/VK4Ks06lVGJXFdog6KwUPjRgxSjNLKX7etHoFKCrGQs8GFqxlimdnEdmK76Hf wlzYah3Zlq7dvgc50O40UriT9aaXwwKKqvgd5GQx8SCa/N8Fz7KQZQkMl9fEZnX2Oalu y7nZLXzm/U1WJI3LpZ8bBn6cEAOgOsV6+JEUWmCQJ3rLIQSlNGMhKCiGrlGLWFyisIU7 3/0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=wNEaBrVID5KM3S+MlzNQlzdEQtierpy9+J1kdBtC9c0=; b=ipgrrTPib1X6KFp8iakl/0GIg/i/kRifLhEUSutsGy7nNjEI6hySP6kxIuljtGV5ll AlPsj0wWKIjk+rf/6L02KaIR9LLB8B+jo2DUZFth8mBHSF8fVCR6KsioqxNPig/qVdFM uXmSfR8lSu3vWII01298u7QBFHatFEE3byI5WR11zibF16IVEM3ByurscMKQpPZV3RKU d8Mv8NQAosR1JNgZAkyWOKe0YkSzmwwK+EQuGT4UnWlibL3FsKKaOjTazBjBiuFq+1FB Ob/fdYw9M3eezqErB4azFUDy5dSeTHAfz5bO79nq8QWDLEOCmx7cBjGuhYr2mePbUV/1 Nmvw== X-Gm-Message-State: AOAM533J7i4DQmw4GXWRt+WpOcMzeBU2hJQ8ZfzY2LSeNCtdHyC5RR6t F+b+r7t+CPm+9rPjRqvNxpda/dJmUPEN X-Google-Smtp-Source: ABdhPJxvHg/G/TnVmSMcJExq8JscSaEMGMUJGDv0dfelD+vcY1O+NwfP5Cg4pWKMN5NrRECAnW1joptjWk29 X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:3af1:caef:2937:5d2b]) (user=irogers job=sendgmr) by 2002:a25:7609:: with SMTP id r9mr50860138ybc.508.1641363339813; Tue, 04 Jan 2022 22:15:39 -0800 (PST) Date: Tue, 4 Jan 2022 22:13:44 -0800 In-Reply-To: <20220105061351.120843-1-irogers@google.com> Message-Id: <20220105061351.120843-42-irogers@google.com> Mime-Version: 1.0 References: <20220105061351.120843-1-irogers@google.com> X-Mailer: git-send-email 2.34.1.448.ga2b2bfdf31-goog Subject: [PATCH v4 41/48] perf stat: Correct check_per_pkg cpu From: Ian Rogers To: Andi Kleen , Jiri Olsa , 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 Cc: eranian@google.com, Ian Rogers X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220104_221541_328892_667B62C9 X-CRM114-Status: GOOD ( 12.64 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Code was incorrectly using the cpu map index as the CPU. Signed-off-by: Ian Rogers --- tools/perf/util/stat.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index f7f9757eba23..86ab427e87fc 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c @@ -292,11 +292,12 @@ static bool pkg_id_equal(const void *__key1, const void *__key2, return *key1 == *key2; } -static int check_per_pkg(struct evsel *counter, - struct perf_counts_values *vals, int cpu, bool *skip) +static int check_per_pkg(struct evsel *counter, struct perf_counts_values *vals, + int cpu_map_idx, bool *skip) { struct hashmap *mask = counter->per_pkg_mask; struct perf_cpu_map *cpus = evsel__cpus(counter); + int cpu = perf_cpu_map__cpu(cpus, cpu_map_idx); int s, d, ret = 0; uint64_t *key;