Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp380455lqp; Tue, 11 Jun 2024 07:17:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX/1hvt4LbJcL66sRCSWgcgT1pNxkcksSur/Sxpu4UxCWt0B88PEmCkPv8LYumI1jMWRqTuJbR+0iwhnUvN/LxDFeA3IaEqJyB+WIOH2A== X-Google-Smtp-Source: AGHT+IEDXWSLudgO6suKfeyNz5EKOChrHPVXQfrF4I8EUKL/2NkrWRpjUlzCeG9vFcr7SexqQel3 X-Received: by 2002:a67:e2d4:0:b0:48d:843f:f40d with SMTP id ada2fe7eead31-48d843ffadbmr1688664137.4.1718115461903; Tue, 11 Jun 2024 07:17:41 -0700 (PDT) Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a1e0cc1a2514c-80b975861b7si1174967241.194.2024.06.11.07.17.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 07:17:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210050-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=q06QeoQs; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-210050-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210050-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 81F0C1C232CB for ; Tue, 11 Jun 2024 14:17:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DB81A17D894; Tue, 11 Jun 2024 14:17:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="q06QeoQs" Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2060.outbound.protection.outlook.com [40.107.101.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5168DAD2C; Tue, 11 Jun 2024 14:17:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.101.60 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718115449; cv=fail; b=ibedHpFQJP5s6zQixOhGVstaYuKkbVq/1Yn5mlc54pNrwBur5nN+Y8Y+Msx43SEHoII51T5ef8O6r01Z44EpX15fTquvQHEw0s5MpXE2ggO9B2S45SfvtvYkt88R1pseF/Q/Q6mKnp5u8K4RF9eJfOPj8w7EGrGZLczGNBcZPxw= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718115449; c=relaxed/simple; bh=JOgC7J5GnAww0oesY37DRzpCuRC3CVaarX0gB/AFOps=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=iB9zoEPptY52iOICXoqv3TMrAOuZA5V0vN8/2s03s9XIAxvr0y2kf7QgB3uweCfBO3fmKfQjZujGHTz1bQ85/dr8r4fJJBIrA19V7/gh2BGFsfA36Sy72yDH1Pta2kjmObUaPeEh6k+oQpVXo0m6C5xieIoxwSyvrHssQLsPmYs= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=q06QeoQs; arc=fail smtp.client-ip=40.107.101.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=EG6ZzmisjY0+VP9DDXVOAjLI2c9A2v6O5D4UU6AMYF2tSGKXU3Y5qJksYB5NBmZrPtuhic18T8kyS63rVyl2nZJlT8f417qyq4rr+1G11FVXSSuoXFbbe9ksmyTxVBk/Q2ElkDwf5umicmz9J77utrWC21U4JJmK/OlJuRo+395GTC395zihgt1pigoBMSTRiaRk4B1ukCyLtwfb3TUeOHIMfZR5uq5WYv01dGBQ6qMnEnuOtRZHyLzZF6vI5mh4x/Coy8afKdYe/TJu+Y38VeLor9YXU+t9NNvKJ5ztaSOQ4DqhsCJIE5ZsWY8hGbOcM6BzOGDABCg9leoV4Jp6cQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=XaZsXanyBt6U4ehOdaROFA8jR7dnf4W8bgVPD6oYIJo=; b=GrVwRgl0VbpBp7CrE8Ze+v7iOyTc/ppD6wY7QnMiaFs84MKmmHwsgPnP6v5GnzcAt0d80KH3MNQFmD5ZKg8jrPsnXsSU+2mCqwl1VZinoWcEKzgKrxIFsh9bnVosQUfF7w5GDFUb+LTlAz2qZaUzbARK4PwvYJdFNvm4A4N9jfdLQlIQpMmGVA/g9UviTAdC7Q9U8y4N8ENH9p8MNYgaJywgO9UIYpj+dkL/UMR16DkY1m8yhazKEozNrS2AViZnx3QGlWy4XN3ddlp9JurkmTSbBd53BKTPeXBKqvJUo6k24fEJ9oYuE1k3QOYVdrOYTdx/qUo47GNfSquNcEwXgA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XaZsXanyBt6U4ehOdaROFA8jR7dnf4W8bgVPD6oYIJo=; b=q06QeoQsZviagd3LIGUfm7RvgirKoC2wCVe3JXxNRMiEUhcathjBlQ/jzcBJV0nDAd9Z39Wl12f/w2KMlQTSKP9ael645q7bRedL1zVCE4CFUnLh0JdaHvFm56XbXx8zc3+N6/k0+DUFWTAwF9VUkKut+MeuwULTREBf6CDi33k= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from LV8PR12MB9207.namprd12.prod.outlook.com (2603:10b6:408:187::15) by PH8PR12MB7422.namprd12.prod.outlook.com (2603:10b6:510:22a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7633.37; Tue, 11 Jun 2024 14:17:22 +0000 Received: from LV8PR12MB9207.namprd12.prod.outlook.com ([fe80::3a37:4bf4:a21:87d9]) by LV8PR12MB9207.namprd12.prod.outlook.com ([fe80::3a37:4bf4:a21:87d9%6]) with mapi id 15.20.7633.036; Tue, 11 Jun 2024 14:17:22 +0000 Message-ID: Date: Tue, 11 Jun 2024 19:47:09 +0530 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/6] perf/x86/rapl: Fix the energy-pkg event for AMD CPUs To: "Zhang, Rui" , "alexander.shishkin@linux.intel.com" , "dave.hansen@linux.intel.com" , "Hunter, Adrian" , "mingo@redhat.com" , "irogers@google.com" , "tglx@linutronix.de" , "gustavoars@kernel.org" , "kan.liang@linux.intel.com" , "kees@kernel.org" , "mark.rutland@arm.com" , "peterz@infradead.org" , "bp@alien8.de" , "acme@kernel.org" , "jolsa@kernel.org" , "x86@kernel.org" , "namhyung@kernel.org" Cc: "ravi.bangoria@amd.com" , "kprateek.nayak@amd.com" , "gautham.shenoy@amd.com" , "linux-perf-users@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-hardening@vger.kernel.org" , "sandipan.das@amd.com" , "ananth.narayan@amd.com" , "linux-pm@vger.kernel.org" References: <20240610100751.4855-1-Dhananjay.Ugwekar@amd.com> <20240610100751.4855-2-Dhananjay.Ugwekar@amd.com> Content-Language: en-US From: Dhananjay Ugwekar In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-ClientProxiedBy: MA0PR01CA0042.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a01:81::13) To LV8PR12MB9207.namprd12.prod.outlook.com (2603:10b6:408:187::15) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: LV8PR12MB9207:EE_|PH8PR12MB7422:EE_ X-MS-Office365-Filtering-Correlation-Id: 904bc36f-358a-4239-06fc-08dc8a2135ee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|1800799015|7416005|376005|366007|921011; X-Microsoft-Antispam-Message-Info: =?utf-8?B?TlNDdkcrbm40UVcvYU9rRjk1Ym8vaEhjZEI3WjFEREViWFRyaDQyTVJYd0k5?= =?utf-8?B?Zi9uSEwraDgvMmcwaCtLMCtWdTBnOW1oUGZnWlpjSDhSMDNxeFpmR3liT09T?= =?utf-8?B?aHd5WjkxN0xGQTR0ZzZUdkVhYjNaYTBleDNsZDdBRjlXUU9ydE1LM1J6eXgv?= =?utf-8?B?Z2todHJTdjhNN1IrWFRoM2doRzFIaElKa2xoVT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BR3FoNEZtb3VHcmJRcSs0MTIzMGRyQm91SVp2eFZteFJ0aGo5?= =?utf-8?B?NGlHa3B4ZEpVRUQzc3d6OXBwVmJmQnNaSTZXeExDY1BYUi9WRUVsbGE2aGwx?= =?utf-8?B?L0NBRWszcUdZVkdrM2JzUklCWG8vOXZVR25saDJueVRzWmZiNmNFSGdMYTBt?= =?utf-8?B?OGVOVmdRMGVUbmt4ODBUM3p3RXNvcE5ab3RNV1UvRnBKWHdhaHNISUFkUVUz?= =?utf-8?B?NlI0UDJrNFdDY3l2Y0ppazd5bTQ0eGlxQWNYQjJLSGl5TERXRHdzdEtILzNk?= =?utf-8?B?My9zVFNQeUF2YUFQbzRSQW1lVmtMRVAzTWhkekIyQ0F5cmt1ZVpMU0Znb29l?= =?utf-8?B?bVFQdUNWa09hdk9BbHZsaVVhSmlYQVZVWXcyMWR2aDVjRnI5ZzhCWkg2Y2Vn?= =?utf-8?B?bU5DQVhqcjQ2elF5d0kwRnAvQ1U0T1NXaTZ5OERuS05LQU10bFBLbGhEQlJj?= =?utf-8?B?NHJneTVEVU9pV1hvRGM5WlZDOVBhVUFqK1hxK1lHMENqSmdnSzd3UW1nUklt?= =?utf-8?B?NmkyUWpTZHllVGhvZUtqQTR0RnVHRjQ4akRZYXZwKzVDTFJVMlpJTm4yNStl?= =?utf-8?B?d0l5cW50d3ZLcTYyU2Q4TjUvd3FYTHE1b3NvZ1oyMng1MHdnMXZFKzFwWVpI?= =?utf-8?B?V25LbVY0WWoyUDZZT1U1VHRTaFREcFpoRjNualRPNzZvMzRLVW02ZmpNbmxP?= =?utf-8?Q?rQfwFhc3mqBO/HlSRKCaG5qtBKg4KSU+ZGtEM=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:LV8PR12MB9207.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(1800799015)(7416005)(376005)(366007)(921011);DIR:OUT;SFP:1101; X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?utf-8?B?Y2JPUEg3NUh6MlhCNGE2K2g4MjB5d1E5VWZic1RlaXEyNXErVFFielNPRHEx?= =?utf-8?B?RXNGSm93bzJIKzQ2bDB3U1ZwMThGeUg4OEk4NzB4NEpHcTAyYmNWQi9ldzF2?= =?utf-8?B?UmNsVUR5ZFVtOWRrZzRicDBJOTZqSElKZGVsSHpJRERiN2pUS2RnTElYdnls?= =?utf-8?B?ZUcyUDUrSytwb21mZEY5c1U3dnQ3cnp5bWxPZkRTV3g2eFJtVVJLd2psMENj?= =?utf-8?B?ZWJtYllqNyt6S1lReWhVeVVOKzZpR1UwS0Y1YU5jQnBJaXVhdHFRZUJHQVVl?= =?utf-8?B?cmpPRTJrWEEyeWJONGhvZDVGaEQ3bHVQd09zeVZnaDJlUVNvSXBwclY1RlFN?= =?utf-8?Q?wdYqiIdvfQsRwiQ09fKZYGZkn?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 904bc36f-358a-4239-06fc-08dc8a2135ee X-MS-Exchange-CrossTenant-AuthSource: LV8PR12MB9207.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jun 2024 14:17:22.6737 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: OsEaVOTjMY8Ej0WbTklghXVP26wr56+80iuEIpeQ2x5mXpz+QcvN7IyX9K0OaT2UqHEgbJmgHBs5iebtPKVKjw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB7422 Hello Rui, On 6/11/2024 11:05 AM, Zhang, Rui wrote: > On Mon, 2024-06-10 at 10:07 +0000, Dhananjay Ugwekar wrote: >> After commit ("x86/cpu/topology: Add support for the AMD 0x80000026 >> leaf"), >> on AMD processors that support extended CPUID leaf 0x80000026, the >> topology_die_cpumask() and topology_logical_die_id() macros, no >> longer >> return the package cpumask and package id, instead they return the >> CCD >> (Core Complex Die) mask and id respectively. This leads to the >> energy-pkg >> event scope to be modified to CCD instead of package. >> >> Replacing these macros with their package counterparts fixes the >> energy-pkg event for AMD CPUs. >> >> However due to the difference between the scope of energy-pkg event >> for >> Intel and AMD CPUs, > > Actually, on Intel platforms, the energy-pkg event is also package > scope except one platform, and that one is the only multi-die system > with RAPL MSRs available. > So that is why the die/pkg logic was introduced in the first place. > > I like the macro/helpers in this patch. The logic inside them may need > to be optimized for Intel platforms, but that is a separate task. Yes that is correct, however anyway the die macros return the package values on a single die system, so I preferred to use them for all Intel systems (single or multi-die). We can surely update the macro name or logic in future to make it more semantically correct. Thanks for the review! Regards, Dhananjay > >> we have to replace these macros conditionally only for >> AMD CPUs. >> >> On a 12 CCD 1 Package AMD Zen4 Genoa machine: >> >> Before: >> $ cat /sys/devices/power/cpumask >> 0,8,16,24,32,40,48,56,64,72,80,88. >> >> The expected cpumask here is supposed to be just "0", as it is a >> package >> scope event, only one CPU will be collecting the event for all the >> CPUs in >> the package. >> >> After: >> $ cat /sys/devices/power/cpumask >> 0 >> >> Signed-off-by: Dhananjay Ugwekar >> Fixes: 63edbaa48a57 ("x86/cpu/topology: Add support for the AMD >> 0x80000026 leaf") > > Reviewed-by: Zhang Rui > > thanks, > rui >> --- >> PS: This patch was earlier sent separately(link below), it has not >> been >> merged yet, it is necessary for this patchset to work properly, also >> it >> fixes the pre-existing energy-pkg event. >> https://lore.kernel.org/linux-perf-users/20240502095115.177713-1-Dhananjay.Ugwekar@amd.com/ >> --- >>  arch/x86/events/rapl.c | 30 ++++++++++++++++++++++++++---- >>  1 file changed, 26 insertions(+), 4 deletions(-) >> >> diff --git a/arch/x86/events/rapl.c b/arch/x86/events/rapl.c >> index b985ca79cf97..73be25e1f4b4 100644 >> --- a/arch/x86/events/rapl.c >> +++ b/arch/x86/events/rapl.c >> @@ -103,6 +103,10 @@ static struct perf_pmu_events_attr >> event_attr_##v = {                              \ >>         .event_str      = >> str,                                                  \ >>  }; >>   >> +#define rapl_pmu_is_pkg_scope()                                \ >> +       (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||  \ >> +        boot_cpu_data.x86_vendor == X86_VENDOR_HYGON) >> + >>  struct rapl_pmu { >>         raw_spinlock_t          lock; >>         int                     n_active; >> @@ -140,9 +144,21 @@ static unsigned int rapl_cntr_mask; >>  static u64 rapl_timer_ms; >>  static struct perf_msr *rapl_msrs; >>   >> +static inline unsigned int get_rapl_pmu_idx(int cpu) >> +{ >> +       return rapl_pmu_is_pkg_scope() ? >> topology_logical_package_id(cpu) : >> +                                        >> topology_logical_die_id(cpu); >> +} >> + >> +static inline const struct cpumask *get_rapl_pmu_cpumask(int cpu) >> +{ >> +       return rapl_pmu_is_pkg_scope() ? topology_core_cpumask(cpu) : >> +                                        topology_die_cpumask(cpu); >> +} >> + >>  static inline struct rapl_pmu *cpu_to_rapl_pmu(unsigned int cpu) >>  { >> -       unsigned int rapl_pmu_idx = topology_logical_die_id(cpu); >> +       unsigned int rapl_pmu_idx = get_rapl_pmu_idx(cpu); >>   >>         /* >>          * The unsigned check also catches the '-1' return value for >> non >> @@ -543,6 +559,7 @@ static struct perf_msr amd_rapl_msrs[] = { >>   >>  static int rapl_cpu_offline(unsigned int cpu) >>  { >> +       const struct cpumask *rapl_pmu_cpumask = >> get_rapl_pmu_cpumask(cpu); >>         struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu); >>         int target; >>   >> @@ -552,7 +569,7 @@ static int rapl_cpu_offline(unsigned int cpu) >>   >>         pmu->cpu = -1; >>         /* Find a new cpu to collect rapl events */ >> -       target = cpumask_any_but(topology_die_cpumask(cpu), cpu); >> +       target = cpumask_any_but(rapl_pmu_cpumask, cpu); >>   >>         /* Migrate rapl events to the new target */ >>         if (target < nr_cpu_ids) { >> @@ -565,6 +582,8 @@ static int rapl_cpu_offline(unsigned int cpu) >>   >>  static int rapl_cpu_online(unsigned int cpu) >>  { >> +       unsigned int rapl_pmu_idx = get_rapl_pmu_idx(cpu); >> +       const struct cpumask *rapl_pmu_cpumask = >> get_rapl_pmu_cpumask(cpu); >>         struct rapl_pmu *pmu = cpu_to_rapl_pmu(cpu); >>         int target; >>   >> @@ -579,14 +598,14 @@ static int rapl_cpu_online(unsigned int cpu) >>                 pmu->timer_interval = ms_to_ktime(rapl_timer_ms); >>                 rapl_hrtimer_init(pmu); >>   >> -               rapl_pmus->pmus[topology_logical_die_id(cpu)] = pmu; >> +               rapl_pmus->pmus[rapl_pmu_idx] = pmu; >>         } >>   >>         /* >>          * Check if there is an online cpu in the package which >> collects rapl >>          * events already. >>          */ >> -       target = cpumask_any_and(&rapl_cpu_mask, >> topology_die_cpumask(cpu)); >> +       target = cpumask_any_and(&rapl_cpu_mask, rapl_pmu_cpumask); >>         if (target < nr_cpu_ids) >>                 return 0; >>   >> @@ -677,6 +696,9 @@ static int __init init_rapl_pmus(void) >>  { >>         int nr_rapl_pmu = topology_max_packages() * >> topology_max_dies_per_package(); >>   >> +       if (rapl_pmu_is_pkg_scope()) >> +               nr_rapl_pmu = topology_max_packages(); >> + >>         rapl_pmus = kzalloc(struct_size(rapl_pmus, pmus, >> nr_rapl_pmu), GFP_KERNEL); >>         if (!rapl_pmus) >>                 return -ENOMEM; >