Received: by 2002:ab2:6309:0:b0:1fb:d597:ff75 with SMTP id s9csp855039lqt; Thu, 6 Jun 2024 23:56:04 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVlAuqs+iCAqGds02GWSITphQMh2Y6Bm4+dYDwVnj5D+oGdoZK7oFoQMA1EqnFpet7QXvJNafRyT9/iQ58P40Sird/TvTCKUEB3udXZWA== X-Google-Smtp-Source: AGHT+IEJXlsylAhuXWXqiqQ5a2oxVnTWuijB5M/kueejkpfPW9IVMVVumrjWWOBFuScdzPnxFCI0 X-Received: by 2002:a17:902:c401:b0:1f4:8e4a:b774 with SMTP id d9443c01a7336-1f6d02d57f2mr18516045ad.1.1717743364085; Thu, 06 Jun 2024 23:56:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717743364; cv=pass; d=google.com; s=arc-20160816; b=NrFeC1ks58wtLkHbJ/RvWbdCmh/DEDgjF1oP7Buzzi7sCpcrcXZ0gU6etXgU8J2zWr 9nXnC+qcyQHm7GY5WND5H6rRpF0WUyHkqilbPhxY1lTnrhyXakSly1KSizHvmNN6aD/T w1I6I7Vl2KNYHCYZwclXQgG0PRn48c0rogqkbA/zNdFGdEcS10zXeyiT/RmTRLp2WvKp cJ39grUFE9HKEOQsbz6EdBpqri1/MZaf/IOdWrGoIE/jfJ8mBB18SZ4CSEE0JROQggQP E8s6YFMp+2XYQDxHWA2Lx6yDfdzGWVjcTAW2GCwC0+YmmVolpwXlVUjMOvGmdq/jDKkQ kXQg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=to:from:subject:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:date:dkim-signature; bh=kEpqaFglUIN4j0bNTTqG5LfCSH5lEYc3LxNNjSK4NrA=; fh=PNG/4lOjF9VPw34sGuduC7+dt+LP/Wrr3WhnCdwjlk4=; b=HK+FtOzpL1l1dcfAosFtt6vQ2hedEDzPXa9sYRHM+wvkW6U3NXoyhlrrbJ7Lc7qjg1 +cXfdUS8xRPu6aVlL9f8oMwM1ZEXU8kbCZgD3iOzqaI9Gz9pdhCPaCBaP0BRkv9T19Ev IBKUwyrExElfObjpz8Q2vzZL+SdTPFaWwgTOftMDzPgGvRWzTjuVvBDGQw906gQH/HAu gurEzn3K5pcf7Z4So4KwHu7aMF0p3HJEyDblTiDjZZvi+wcF32InVcqRqE+TYJrmKB2V S5boWq164t1O51SMaAKaPZuY86Mcsx/U9qua67cppCRVibs7twHNasNhFzOeQXlE22so DDrg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=VyhOF7hL; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-205469-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f6bd7609cesi51735ad.67.2024.06.06.23.56.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 23:56:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-205469-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=VyhOF7hL; arc=pass (i=1 spf=pass spfdomain=flex--irogers.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-205469-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-205469-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id DB1F328D274 for ; Fri, 7 Jun 2024 06:54:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 18C941CA85; Fri, 7 Jun 2024 06:53:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="VyhOF7hL" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CEC6015380D for ; Fri, 7 Jun 2024 06:53:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717743233; cv=none; b=kerH+22TmAX4GxIVnp1Jyrn7NxClOzC/VTGdz0Xkf//0o52gzOhbZ4nb82ftTYi/ulbwYkYia/ckHRxfHHCzsrdZ1Umjwa9O1jGdkMx643G/etz/GRuCTi40+3HpkqnUe8S1/GJB0cvrsvtl3a5HI86/weEOsgNsPh55a3rFPHo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717743233; c=relaxed/simple; bh=k5Of17rlZ5YWpoLqnZnihufQm9m2MOHJaY1j7aQrJp0=; h=Date:Message-Id:Mime-Version:Subject:From:To:Content-Type; b=AwZRN7udp3GmrDziMcijLZvHdEdnWQYTerXmA4UyhdeJmvkMTvj+QymUAlUVEvKfryzecKoo4lmTVg/VmiWl6qOo9N3NZ+jPQJ/EnCJuSF7jo3plh9/MamrImr3azPEwYsifmru64jY05MRznDZsGJmnFQOq0wEFuIvPJ5fvH4o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=VyhOF7hL; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dfa84f6a603so2838554276.3 for ; Thu, 06 Jun 2024 23:53:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717743231; x=1718348031; darn=vger.kernel.org; h=to:from:subject:mime-version:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=kEpqaFglUIN4j0bNTTqG5LfCSH5lEYc3LxNNjSK4NrA=; b=VyhOF7hLTCf1Btx6ngwltDyGyklE2Kb1GBWO1J8aOTp8o1unEBZ7UXxLwGQdpBGIN7 ymV9vn1Y/KscyDfumxX+5fldeHtQXnXz1nShIXGg5xoPIT0ogKw8fTMGTccgkb44sFEQ 53yep982tq+ja8ZhrcKjDmxI0SqoqJIeanpG+6M9xiu6ZYQd4iW5onfSLUUUOmagdDJK jRVftfYaxgxFnXFkmSgtigP6yfXk2LLhjSZJk/NI/93cihWDJYvLSAbkadR5ODecW3k1 MKgDc9ihZF2bmBHVLhnB5em/PMf36+PfL3ErLyiCr9zHA19DeahDyv3PogVpo6p6zbvw nLLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717743231; x=1718348031; h=to:from:subject:mime-version:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=kEpqaFglUIN4j0bNTTqG5LfCSH5lEYc3LxNNjSK4NrA=; b=tHB0X3591N8DZ3+/YzBAXWa+5Y+7PqR1LBuABb959onB7mdWBSEnCMO1ns4zTySFES INF6S9zayp4HLy26nLbs5qjDWVknX3zGYhEwYKiGURhzpYWEj6ofH91ZKp19JbfZ6bNC 12dtGPJc8yUu7DxVfOZ4+yKYJxFKVHnNt+G+0wx/sQHjB3vOKIaI2yeu3nJppgs9qKnu 69pRlHZhAmjqyw4C1CjGlb5Mc/ncLdpILdEw1qDw85fMEIIu7pSn/8DqQivUkAECKTUM VesxWSje3YqzE4K4JyySktyidSFuqYLSC/qPq8wzsJYDNmnF9Iv2BefhBRgfpEvAJXr+ otfA== X-Forwarded-Encrypted: i=1; AJvYcCWXMe9pfRALuEII1dojkQjsIs9zDWgEr84zKky3373LztyUXrAzCjZmDsU8AicY747RqKFxmiTtJ9ALIFeSOUfqLbb7UypV65QCGsHd X-Gm-Message-State: AOJu0YxPpZjW4oXrGr2hXvrE3yC3Rb8Y1YvNGcSQN1HQ7FHf8m3ptWcU RBOOiTp11HenYaIEzczfxnZa42TOZD66sYjb4Xrhhyu1355/SASDON28pH/naF/gTQ+lEWRJxQD yfhjvFg== X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:da3f:3dce:f5a8:653b]) (user=irogers job=sendgmr) by 2002:a05:6902:1082:b0:dfa:febe:57c6 with SMTP id 3f1490d57ef6-dfafebe58f0mr33228276.13.1717743230815; Thu, 06 Jun 2024 23:53:50 -0700 (PDT) Date: Thu, 6 Jun 2024 23:53:43 -0700 Message-Id: <20240607065343.695369-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Mailer: git-send-email 2.45.2.505.gda0bf45e8d-goog Subject: [PATCH v1] perf arm: Workaround ARM PMUs cpu maps having offline cpus From: Ian Rogers To: Suzuki K Poulose , Mike Leach , James Clark , John Garry , Will Deacon , Leo Yan , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , Kan Liang , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, Yicong Yang Content-Type: text/plain; charset="UTF-8" When PMUs have a cpu map in the 'cpus' or 'cpumask' file, perf will try to open events on those CPUs. ARM doesn't remove offline CPUs meaning taking a CPU offline will cause perf commands to fail unless a CPU map is passed on the command line. More context in: https://lore.kernel.org/lkml/20240603092812.46616-1-yangyicong@huawei.com/ Reported-by: Yicong Yang Closes: https://lore.kernel.org/lkml/20240603092812.46616-2-yangyicong@huawei.com/ Signed-off-by: Ian Rogers --- tools/perf/arch/arm/util/pmu.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/perf/arch/arm/util/pmu.c b/tools/perf/arch/arm/util/pmu.c index 8b7cb68ba1a8..6b544edbd3f6 100644 --- a/tools/perf/arch/arm/util/pmu.c +++ b/tools/perf/arch/arm/util/pmu.c @@ -11,12 +11,15 @@ #include "arm-spe.h" #include "hisi-ptt.h" +#include "../../../util/cpumap.h" #include "../../../util/pmu.h" #include "../../../util/cs-etm.h" #include "../../arm64/util/mem-events.h" -void perf_pmu__arch_init(struct perf_pmu *pmu __maybe_unused) +void perf_pmu__arch_init(struct perf_pmu *pmu) { + struct perf_cpu_map *intersect; + #ifdef HAVE_AUXTRACE_SUPPORT if (!strcmp(pmu->name, CORESIGHT_ETM_PMU_NAME)) { /* add ETM default config here */ @@ -33,6 +36,9 @@ void perf_pmu__arch_init(struct perf_pmu *pmu __maybe_unused) pmu->selectable = true; #endif } - #endif + /* Workaround some ARM PMU's failing to correctly set CPU maps for online processors. */ + intersect = perf_cpu_map__intersect(cpu_map__online(), pmu->cpus); + perf_cpu_map__put(pmu->cpus); + pmu->cpus = intersect; } -- 2.45.2.505.gda0bf45e8d-goog