From patchwork Thu Dec 23 07:45:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Rogers X-Patchwork-Id: 12698009 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 AA7BEC433EF for ; Thu, 23 Dec 2021 08:09:35 +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=/DoO1/GzjsrwHafEP9fg6aDX7DZQlmFRC9u+mCpD3kA=; b=tmJ61kYwtHTjO+ihgbLJ7SPktz EsX1HdUGFi5hNjMH7JPcqC97ugMucu7a9xnh2riWIyrwgk1UOGU9wA5Glq3WT4MHwaMr5vA/jgjdr VxNhgI3pxW878YqX+NY3rUN/ReS7SR12bgDJ8mu9I+n5TP8UPq8bErWRY1CPgLvjJD+zw4QY5tFuB IsH+fhTuTVZ/BFbrGUVRQqIFMichWPifeY/CoxjdMn6SRaPOhLLhUelaOGqZmZtBudB6up1dot1+o wKeDyT4HFkx88bkcSnM/oNIYZrOg3AsVMRCdQVQSvSLZuf5DiF9QpJ03OShBRuLtHWGco8eAyI7UA Do6LoYyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1n0J8t-00C7k7-6l; Thu, 23 Dec 2021 08:08:03 +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 1n0Ior-00BzuS-3I for linux-arm-kernel@lists.infradead.org; Thu, 23 Dec 2021 07:47:22 +0000 Received: by mail-yb1-xb49.google.com with SMTP id d27-20020a25addb000000b005c2355d9052so8657378ybe.3 for ; Wed, 22 Dec 2021 23:47:19 -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=ErABhHzBAdfT0a5ELxa3T/433q7mkoWRWaaPkr2zYLE=; b=h8ZCv5xpAMC9yF2kAMaxLxcymXWeg49EXaiL3OtamiPvT60DCEbRj+QLqM5moN4W8N cDtzztDAzcCThB3KlEz4R+jmMAHQWwC0HWP9jzLrXQeSgbrISK7vUtwmIT3hgpk8SnZf Ea9k4Vw/8Cu2Cdt9poAJAnCZzvqBtOEBBihTwocK1pOVbQEMqkL30NhY5x1b3qIvRjz4 fZ/pakEDofR/HPl2V3MJr+X78TgyvuQt7Pnw0BdOGwBWbb1AwiQ5TqTdNRY8Ibpa4R9J QnytXVyIbzFHR52fV6mELViTABsYuN04e+hTtQnQ/bbrmoakuXNkJUX/vXlWQxbzo5zJ 3Cyg== 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=ErABhHzBAdfT0a5ELxa3T/433q7mkoWRWaaPkr2zYLE=; b=2NPC62lHxzog55D6fJylfDd1GDvpmxxZjslWpqc30shFejeIJz+SYZ3LdOqdrL+o1x Ddv2dTCfbof/4/+f3prIxTu4V1D0sm4PDGFZJs/kJ7pNiB777xO6A5WJ+Z+R1vPFa+EY MhXbvxmxqn3Mr83FwWX1uQWlziLNej0KXMU3hZcq4EfVE6HRfEw7yxGErF4YhYeTgXqk nIfnF8vcc9DI6d/aRzhXmMuEVapKeNo77by7K+xeARD9R/M4yP8HbLn0YktEfnKLG8z1 H6cx90nKFw4xDSwr0DyAR62daoE/CrpaY9jYqVT/DTDQ72urO1evF62kdAEjemroK0zz FafQ== X-Gm-Message-State: AOAM533tU+FG2BOCIIdqedB8PtHEwwvkslrbkAUYbWrJ2p9CHJ1QVSre yO3/JPanudUzVIalY1PLPe6+pQWws3+x X-Google-Smtp-Source: ABdhPJwqZDzpHASDcXqKxGGvIcAj99RfagujZOxumPIiBCWlWRZFjRDOAtRAIxTsQbSB/e87K/O6PSKPvp4b X-Received: from irogers.svl.corp.google.com ([2620:15c:2cd:202:4fef:90ff:589d:24ca]) (user=irogers job=sendgmr) by 2002:a25:238a:: with SMTP id j132mr1715031ybj.530.1640245639355; Wed, 22 Dec 2021 23:47:19 -0800 (PST) Date: Wed, 22 Dec 2021 23:45:21 -0800 In-Reply-To: <20211223074541.3318938-1-irogers@google.com> Message-Id: <20211223074541.3318938-29-irogers@google.com> Mime-Version: 1.0 References: <20211223074541.3318938-1-irogers@google.com> X-Mailer: git-send-email 2.34.1.307.g9b7440fafd-goog Subject: [PATCH v2 28/48] libperf: Use cpu not index for evsel mmap 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 Cc: eranian@google.com, Ian Rogers X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211222_234721_195872_ADDD3C86 X-CRM114-Status: GOOD ( 12.38 ) 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 Fix issue where evsel's CPU map index was being used as the mmap cpu. Signed-off-by: Ian Rogers --- tools/lib/perf/evsel.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/lib/perf/evsel.c b/tools/lib/perf/evsel.c index 8028b5a4da69..f1e1665ef4bd 100644 --- a/tools/lib/perf/evsel.c +++ b/tools/lib/perf/evsel.c @@ -252,6 +252,7 @@ int perf_evsel__mmap(struct perf_evsel *evsel, int pages) for (thread = 0; thread < xyarray__max_y(evsel->fd); thread++) { int *fd = FD(evsel, idx, thread); struct perf_mmap *map; + int cpu = perf_cpu_map__cpu(evsel->cpus, idx); if (fd == NULL || *fd < 0) continue; @@ -259,7 +260,7 @@ int perf_evsel__mmap(struct perf_evsel *evsel, int pages) map = MMAP(evsel, idx, thread); perf_mmap__init(map, NULL, false, NULL); - ret = perf_mmap__mmap(map, &mp, *fd, idx); + ret = perf_mmap__mmap(map, &mp, *fd, cpu); if (ret) { perf_evsel__munmap(evsel); return ret;