Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp10587132rwd; Thu, 22 Jun 2023 01:54:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4C6B6feVFyxFq5MaQGWQazzkeXLdhcchgom1d/4X641SFbTeAYRMsnPpvnfCxPScmhMody X-Received: by 2002:a17:90a:6f02:b0:25b:c528:8456 with SMTP id d2-20020a17090a6f0200b0025bc5288456mr7733390pjk.25.1687424051111; Thu, 22 Jun 2023 01:54:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687424051; cv=none; d=google.com; s=arc-20160816; b=xEwBF1dy90dIRTfUX2BMx3zxrE1WIiX0slV4BYhKwjWWIb2LWDsWnykZeuV+VgUPQo 3quc8G1DY6Am8kWnlwbfGpVXWboRCBEsGigSgjyO3akVAzyzXJDWD688eymE2a3g9Swm oArXgLOZzgFsymvP6oXfxupz62R/D/qj22jQXpUb1/v46XdF2g6jDQEsIRq4Mpn6+LIa i5hqG86/uYwNjse/+Qnqpbpj/IO/kdkOFnmEI3EzGrl3GCixrytB2fLq3+NS/fn5Q20X TV/XTGbU8apRugMPTXyaDLXEuZHDYBIdapWLNHlqAizbJ48CQtZWlLWqF63nPkzNYLip XSyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=IdBmjBd+d+wipgVHMjHdZuz/Q2bcPY1vZInPBSwjan8=; b=QCLFQ6dvwek0aB2ANRYXvSFtojdzDAC53lKGLD7WJxvn7k/z89EIZduRtuI7lfWb06 uE31892ucrkmBRqYAp5DBGBzBiFIEiH2EEF9qLQnOnvrXlfsxcphoP6WE8CodvJTTqCy EGz4W9CgYyA1xr2SN08IBDr4Z99qiwjWbB49+AnodZMAhYVqIFOR/yetun1JVL6R7Nda Eza3FEJ4omPpNRmj3iIPTNC+Khc/KZEyAkY0BUhYi8ZVX8XVp8QkgdCCyKZl6tpXMY9f Yk4Y6Fh5xcMl30UX21sRYp9rPyK09V9A05m1Yz//EXfnJq/mnpyhkp8BKYXYBvyPUznD k3GQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=P4OUVdrG; 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=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id om16-20020a17090b3a9000b00256a98800absi6691966pjb.186.2023.06.22.01.53.59; Thu, 22 Jun 2023 01:54:11 -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=@ibm.com header.s=pp1 header.b=P4OUVdrG; 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=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230317AbjFVIiR (ORCPT + 99 others); Thu, 22 Jun 2023 04:38:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229504AbjFVIiQ (ORCPT ); Thu, 22 Jun 2023 04:38:16 -0400 Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D18A310F4; Thu, 22 Jun 2023 01:38:15 -0700 (PDT) Received: from pps.filterd (m0356517.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 35M8GtHL017113; Thu, 22 Jun 2023 08:37:49 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=message-id : date : mime-version : subject : to : references : from : in-reply-to : content-type : content-transfer-encoding; s=pp1; bh=IdBmjBd+d+wipgVHMjHdZuz/Q2bcPY1vZInPBSwjan8=; b=P4OUVdrGwddumfa3+4B43ZMolycnNWHfHx7EIytH9BLnKT6B6g5LLGwWQ8R2cSrwQqUh aJK5JvIVWUsrtOEU+gm2PDNOhnxduR02tM7A3sIDKxLd3wRf47y023QYm9twuokea0W2 I2E2ukG1woZwz5jvMnpvguHVqrM2L7+9gEB/5w3zircvsDdSqFSB4S+Is/qoauR74HpU 2QjZKTQN0XKBVBDo1SVZapcSyOcTZhaOhGB5rnhUSULFNZr2wdaXay6/zqL8UdeKF1UQ A1mZhlXBZRzCDOziiQvMQWKZKAHTXVs6cEf3uCAQ+FUMg1wLeS507Rml2XeJBXtzAt94 gw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rcjb3s4w8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Jun 2023 08:37:48 +0000 Received: from m0356517.ppops.net (m0356517.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 35M8HYZS019453; Thu, 22 Jun 2023 08:37:24 GMT Received: from ppma05fra.de.ibm.com (6c.4a.5195.ip4.static.sl-reverse.com [149.81.74.108]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rcjb3s338-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Jun 2023 08:37:24 +0000 Received: from pps.filterd (ppma05fra.de.ibm.com [127.0.0.1]) by ppma05fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 35M4l6ju007666; Thu, 22 Jun 2023 08:35:59 GMT Received: from smtprelay07.fra02v.mail.ibm.com ([9.218.2.229]) by ppma05fra.de.ibm.com (PPS) with ESMTPS id 3r94f52h7v-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Jun 2023 08:35:59 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay07.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 35M8Zv5e46661956 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 22 Jun 2023 08:35:57 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2C5AA200B0; Thu, 22 Jun 2023 08:35:57 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C44BE200B1; Thu, 22 Jun 2023 08:35:56 +0000 (GMT) Received: from [9.152.212.165] (unknown [9.152.212.165]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Thu, 22 Jun 2023 08:35:56 +0000 (GMT) Message-ID: <6c6dc916-7a1a-f5da-a975-af2701a6fb65@linux.ibm.com> Date: Thu, 22 Jun 2023 10:35:56 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v1 2/2] perf pmu: Remove a hard coded cpu PMU assumption Content-Language: en-US To: Ian Rogers , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Adrian Hunter , Kan Liang , James Clark , Ravi Bangoria , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230622050330.3733114-1-irogers@google.com> <20230622050330.3733114-2-irogers@google.com> From: Thomas Richter Organization: IBM In-Reply-To: <20230622050330.3733114-2-irogers@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: RRrUpgmXwJzNN0s6u1DMJdTF18OjoytI X-Proofpoint-GUID: MaSCIiYK1ZjjD7eZAqQ4kd88rW1m0tPM X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-06-22_05,2023-06-16_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 phishscore=0 mlxlogscore=999 clxscore=1011 impostorscore=0 mlxscore=0 suspectscore=0 spamscore=0 adultscore=0 lowpriorityscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2306220070 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H5, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On 6/22/23 07:03, Ian Rogers wrote: > The property of "cpu" when it has no cpu map is true on S390 with the > PMU cpum_cf. Rather than maintain a list of such PMUs, reuse the > is_core test result from the caller. > > Signed-off-by: Ian Rogers > --- > tools/perf/util/pmu.c | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/tools/perf/util/pmu.c b/tools/perf/util/pmu.c > index 963c12f910c5..64fa568a5426 100644 > --- a/tools/perf/util/pmu.c > +++ b/tools/perf/util/pmu.c > @@ -551,7 +551,7 @@ static int pmu_alias_terms(struct perf_pmu_alias *alias, > * Uncore PMUs have a "cpumask" file under sysfs. CPU PMUs (e.g. on arm/arm64) > * may have a "cpus" file. > */ > -static struct perf_cpu_map *pmu_cpumask(int dirfd, const char *name) > +static struct perf_cpu_map *pmu_cpumask(int dirfd, const char *name, bool is_core) > { > struct perf_cpu_map *cpus; > const char *templates[] = { > @@ -575,7 +575,8 @@ static struct perf_cpu_map *pmu_cpumask(int dirfd, const char *name) > return cpus; > } > > - return !strcmp(name, "cpu") ? perf_cpu_map__get(cpu_map__online()) : NULL; > + /* Nothing found, for core PMUs assume this means all CPUs. */ > + return is_core ? perf_cpu_map__get(cpu_map__online()) : NULL; > } > > static bool pmu_is_uncore(int dirfd, const char *name) > @@ -886,7 +887,8 @@ struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char > if (!pmu) > return NULL; > > - pmu->cpus = pmu_cpumask(dirfd, name); > + pmu->is_core = is_pmu_core(name); > + pmu->cpus = pmu_cpumask(dirfd, name, pmu->is_core); > pmu->name = strdup(name); > if (!pmu->name) > goto err; > @@ -903,7 +905,6 @@ struct perf_pmu *perf_pmu__lookup(struct list_head *pmus, int dirfd, const char > } > > pmu->type = type; > - pmu->is_core = is_pmu_core(name); > pmu->is_uncore = pmu_is_uncore(dirfd, name); > if (pmu->is_uncore) > pmu->id = pmu_id(name); Looks good to me, for both patches: Tested-by: Thomas Richter -- Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany -- Vorsitzender des Aufsichtsrats: Gregor Pillen Geschäftsführung: David Faller Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294