Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2240560rdh; Tue, 26 Sep 2023 18:00:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFvaULmZAnNwHl26tMj1tSABsA7kPdiqy2FT/FBok1HucN2j5x0ZgDdiH/0Omi9dc6Fq6mF X-Received: by 2002:a05:6808:2225:b0:3ae:5c48:6f42 with SMTP id bd37-20020a056808222500b003ae5c486f42mr897013oib.5.1695776425603; Tue, 26 Sep 2023 18:00:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1695776425; cv=pass; d=google.com; s=arc-20160816; b=tjjxAzkbvkvD5/bLs8d3nOMAHloZ0ePT5/6p81PXKPQc+2iCBkWQJuF2DpRfTpz3rL py2biILXFFUmEA35hDj8+rBU7SQVRUpSItbW4TJzI2T6PiR4mGw812GX5S6VM3sn3QSg OYB2q8tJDoK2NIx9MmTfQUiggnGznXbpAIdFIio1nO576nW4j3vwlj0JeRbHf81wg2aL qxifCE7TstJLUYuqP16keYzNIWuRPaygDs0zpcHjRAH1BZguvBhb1V1TE1eS0VglJY/W O7BdvO9VPsgkq5g5UB1VSw0Tk55maPLyTlnu3Q1ew8YmbgjV79+T6MOzhxgblC5P/FlJ sfcQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject:reply-to :user-agent:date:message-id:dkim-signature; bh=JiRHeb21xzOmXAaLCzKgP/BaR61WpO3oq/M1cUjgd98=; fh=n3UUJOe8du1pePjCuNjLZcyBktL9hAzApNNURE4HFR8=; b=tDyW5ob4/cpaZLeDOygTqzt45NOZZtgSCF1nOiDtMfl9eurPkFSKnUfSRyTVSY1Oyw 699Vd3Gtrctqjk3DMOgBSBvKwncyKkpl68V49UQTp5aOyrtmPF/vWXArRyQybj7IxnS6 74kxwZOiLyQ4v8ydqyqzOJNIfoBC/SJjdotayQE6OZUyXcc3EQ0fy6jXEkbiZ4k9W0UN 84gvaiEyFBjBTBaHEwmlsqLRE1XhzjXw06dc793T/mPjndwrAQuTX4XwyaFkYn7g8SI7 Mop8oK6c0Ohy8a8Fy99i98RG7D46PAatbqxgQy4tDnGhMbsHw1++xCEFe3pF9sjuTWC0 HNpw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ylUm8rUu; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id ds7-20020a056a004ac700b0068fa57d2442si14110274pfb.130.2023.09.26.18.00.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Sep 2023 18:00:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=ylUm8rUu; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 5CD8A805E43E; Tue, 26 Sep 2023 12:16:49 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235397AbjIZTQn (ORCPT + 99 others); Tue, 26 Sep 2023 15:16:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229580AbjIZTQl (ORCPT ); Tue, 26 Sep 2023 15:16:41 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2074.outbound.protection.outlook.com [40.107.92.74]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 87183DE; Tue, 26 Sep 2023 12:16:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=mR8IpkoXZEAqQ2nChhot/g2u9wUSllqmXNG8OoztvspYJHHOH/UCDX+MX93LbZAwMBK6iBvelRvIVhbnsK8lwcoHbSwldogL21naiWwELLwVasaQXhPJoqrOagFNIjhzCdITZrxiXSTmZGBXPEZi1QwbWi84Hl71ma7Hkp/rE+zxhJO09y/tDMYl/yeJNkHrwsxSfLibLj/ACSL/krZP1oyDGb3Xci6CBWe3qUtEwmYn8UTwxy+nJwF1A1yDTCcb1pWuUKgcFVKZCf6SH8QOxjXDB7I9uA9Q14ZErXvkpBLsDv6kAT9aOYavDfdlnq91ioDj/5tTbQ3CV6BF92iSGg== 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=JiRHeb21xzOmXAaLCzKgP/BaR61WpO3oq/M1cUjgd98=; b=AqWUj/elD2J2eqHhqlJqCuawyvzSFifGmIvcPjD6NKpTIKETGr8zWiaQJ3deI2c4AiDz7tMFycE9D3pWfonbXIr0rlQC/VNwdfqR8VANCyRXurBoNCOS8CFqmxcK3SOHF+uykOPfKxeruB+i72/429XLSku8jNh57/uWnkF+xPgsceXdZ2dkGPjTAr9MD0Q5mRg/yKaVmvBBosAMGTlecQPHk+IZiF90I3gWxsfiw8/GIMk6HRtOWPf9ET1ORf0Emcbj2ttL3I1Lw7MA2M3pwdJfkeBAEn4RjVDGBq/ANv9B67lFbsKyj7VLW+SFkWO+nY/k4b3uOAUI9mxg1oKlrQ== 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=JiRHeb21xzOmXAaLCzKgP/BaR61WpO3oq/M1cUjgd98=; b=ylUm8rUuN/eySA4WberS1lm8AkGL7JdU2BdWC8YQpH8Jzct1D9+ZaNTqLq3HDALYgE0H6Z3EyxxizanXO2tf1BTU7uoiEWeu9i8YB2dJEGu+LjdOiS35HwMOoMC/BDgzB5uL5roDI3HzyWPknEhelLjrBqSCK3m3UVGhVHXFSvY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from MW3PR12MB4553.namprd12.prod.outlook.com (2603:10b6:303:2c::19) by PH7PR12MB6610.namprd12.prod.outlook.com (2603:10b6:510:212::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6813.23; Tue, 26 Sep 2023 19:16:28 +0000 Received: from MW3PR12MB4553.namprd12.prod.outlook.com ([fe80::fbfe:ec9c:b106:437e]) by MW3PR12MB4553.namprd12.prod.outlook.com ([fe80::fbfe:ec9c:b106:437e%5]) with mapi id 15.20.6838.016; Tue, 26 Sep 2023 19:16:28 +0000 Message-ID: Date: Tue, 26 Sep 2023 14:16:24 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.15.1 Reply-To: babu.moger@amd.com Subject: Re: [PATCH v5 6/8] x86/resctrl: Sub NUMA Cluster detection and enable Content-Language: en-US To: Tony Luck , Fenghua Yu , Reinette Chatre , Peter Newman , Jonathan Corbet , Shuah Khan , x86@kernel.org Cc: Shaopeng Tan , James Morse , Jamie Iles , Randy Dunlap , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, patches@lists.linux.dev References: <20230722190740.326190-1-tony.luck@intel.com> <20230829234426.64421-1-tony.luck@intel.com> <20230829234426.64421-7-tony.luck@intel.com> From: "Moger, Babu" In-Reply-To: <20230829234426.64421-7-tony.luck@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: SA0PR12CA0008.namprd12.prod.outlook.com (2603:10b6:806:6f::13) To MW3PR12MB4553.namprd12.prod.outlook.com (2603:10b6:303:2c::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MW3PR12MB4553:EE_|PH7PR12MB6610:EE_ X-MS-Office365-Filtering-Correlation-Id: 01776349-d7d5-471e-9abd-08dbbec51563 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1fNzk2Q9jKq7c97UwxZieqZIfxQRNSNrN1JbsNS1b25HBe87NJmWX+0z0JH2DB0NxZq0/yGLj2yepNDtb2CFDdb5n4poVdkDcMspvllzYP4sBUaLcOgrcg6tKvm1bdWGBcdcLcyYxSkAlTY0ecOXit3+/PzKTVP/YG3Z/ZQeVdYg1iVpPT48bESHcLVXC6TfermlDEDfKAXh2DqdT5RNC+NeAyMTGp9aXQV5e+I+QAEcIG6F9lixY6DDkEs6KW8huGyZT3JoBGGgOU6NdFU26YCJeeWa9s5Q0b+hLUGxSXtKyLLjQ932nWHOMBNNpk9YRh6Yk2xm9Uvi4Sz8HGo+uTReaJuQ19ahra+v8u5bGJNgkEhlaRSVqjkaImoCt+ioRtPRJd2TlZtceNv/hGxExNtc+4cJ2OWiJWE5umcdajqMwkcpEwjA2g2kWf3Js7vg5t5hlCbDGlITCbscZ3wjk2BoqtmWRY04Ctn7qZ9CcCCha2wtBK/dXxVq9yK2XjNDIKOxsTPsCAwxVMABC07cdYgiZRHugUvy+G07sb5vthxhtgmeZd09K6DgCHu7RK0p1kA9hq8GLnQj4/JSuq71E9fspAVJQwsF0RBeP6P8fy5y8aUBzjpU7tqrgvlpR+UfSxsejD+z33owbDhMfvMSBw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW3PR12MB4553.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(376002)(39860400002)(136003)(366004)(346002)(230922051799003)(186009)(451199024)(1800799009)(8936002)(4326008)(8676002)(110136005)(5660300002)(31686004)(7416002)(41300700001)(83380400001)(66476007)(53546011)(26005)(316002)(66556008)(54906003)(6512007)(66946007)(38100700002)(6666004)(2616005)(6506007)(36756003)(31696002)(6486002)(2906002)(478600001)(3450700001)(86362001)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?MHgzUDM2b2NhbjI0VnJSQjdvY0s5S2NtZU12NmdrME1wVzdqTTJRUDhQeGhy?= =?utf-8?B?YXg3SjlONUVwVytWc3ViWWJkU1Vyb0p4Zk91SHpGK1pyNk9UeDZxMVJnajgr?= =?utf-8?B?TFpPY1RZeHZaVFg2N2VCZHRTRm1DK1JrYjNOQmlvUGxnNGZDVXV1U0F2YlF0?= =?utf-8?B?eU82L1NLQzkybjlpL0VmZnhnSExKRnUyTytTNDlMR0ZnNnhaeU94VHBkNXhx?= =?utf-8?B?SGF0RlRNN2Y3QlMvdmJITnNjUEhFN0xyTHVGN3Zl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wzTVJYa1g0QVdpWkdTa3BXajJXK1RSdWNraWdCRTZ1d3h6?= =?utf-8?Q?mMfM=3D?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01776349-d7d5-471e-9abd-08dbbec51563 X-MS-Exchange-CrossTenant-AuthSource: MW3PR12MB4553.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Sep 2023 19:16:28.1077 (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: tbZPKOCH7kBQlfsK7Wm3xvHyVs5fU1oN5wnCnuhBAuGJcsbmbJSyzSQSeX4Ay9rc X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB6610 X-Spam-Status: No, score=-2.3 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 26 Sep 2023 12:16:49 -0700 (PDT) Hi Tony, On 8/29/23 18:44, Tony Luck wrote: > There isn't a simple h/w bit that indicates whether a CPU is > running in Sub NUMA Cluster mode. Infer the state by comparing > the ratio of NUMA nodes to L3 cache instances. > > When SNC mode is detected, reconfigure the RMID counters by updating > the MSR_RMID_SNC_CONFIG MSR on each socket as CPUs are seen. > > Signed-off-by: Tony Luck > --- > arch/x86/include/asm/msr-index.h | 1 + > arch/x86/kernel/cpu/resctrl/core.c | 68 ++++++++++++++++++++++++++++++ > 2 files changed, 69 insertions(+) > > diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h > index 1d111350197f..393d1b047617 100644 > --- a/arch/x86/include/asm/msr-index.h > +++ b/arch/x86/include/asm/msr-index.h > @@ -1100,6 +1100,7 @@ > #define MSR_IA32_QM_CTR 0xc8e > #define MSR_IA32_PQR_ASSOC 0xc8f > #define MSR_IA32_L3_CBM_BASE 0xc90 > +#define MSR_RMID_SNC_CONFIG 0xca0 > #define MSR_IA32_L2_CBM_BASE 0xd10 > #define MSR_IA32_MBA_THRTL_BASE 0xd50 > > diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c > index ed4f55b3e5e4..9f0ac9721fab 100644 > --- a/arch/x86/kernel/cpu/resctrl/core.c > +++ b/arch/x86/kernel/cpu/resctrl/core.c > @@ -16,11 +16,14 @@ > > #define pr_fmt(fmt) "resctrl: " fmt > > +#include > #include > #include > #include > #include > +#include I didnt see the need for this include. > > +#include > #include > #include > #include "internal.h" > @@ -724,11 +727,34 @@ static void clear_closid_rmid(int cpu) > wrmsr(MSR_IA32_PQR_ASSOC, 0, 0); > } > > +/* > + * The power-on reset value of MSR_RMID_SNC_CONFIG is 0x1 > + * which indicates that RMIDs are configured in legacy mode. > + * Clearing bit 0 reconfigures the RMID counters for use > + * in Sub NUMA Cluster mode. > + */ > +static void snc_remap_rmids(int cpu) While adding the new functions, i see that new function names start with resctrl_ prefix. However, we are all not very consistent. Can ypu rename this function to resctrl_snc_remap_rmids? > +{ > + u64 val; > + > + /* Only need to enable once per package */ > + if (cpumask_first(topology_core_cpumask(cpu)) != cpu) > + return; > + > + rdmsrl(MSR_RMID_SNC_CONFIG, val); > + val &= ~BIT_ULL(0); > + wrmsrl(MSR_RMID_SNC_CONFIG, val); > +} > + > static int resctrl_online_cpu(unsigned int cpu) > { > struct rdt_resource *r; > > mutex_lock(&rdtgroup_mutex); > + > + if (snc_nodes_per_l3_cache > 1) > + snc_remap_rmids(cpu); > + > for_each_capable_rdt_resource(r) > domain_add_cpu(cpu, r); > /* The cpu is set in default rdtgroup after online. */ > @@ -983,11 +1009,53 @@ static __init bool get_rdt_resources(void) > return (rdt_mon_capable || rdt_alloc_capable); > } > > +/* CPU models that support MSR_RMID_SNC_CONFIG */ > +static const struct x86_cpu_id snc_cpu_ids[] __initconst = { > + X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_X, 0), > + X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, 0), > + X86_MATCH_INTEL_FAM6_MODEL(EMERALDRAPIDS_X, 0), > + {} > +}; > + > +static __init int get_snc_config(void) Same comment as above. > +{ > + unsigned long *node_caches; > + int mem_only_nodes = 0; > + int cpu, node, ret; > + > + if (!x86_match_cpu(snc_cpu_ids)) > + return 1; > + > + node_caches = kcalloc(BITS_TO_LONGS(nr_node_ids), sizeof(*node_caches), GFP_KERNEL); > + if (!node_caches) > + return 1; > + > + cpus_read_lock(); > + for_each_node(node) { > + cpu = cpumask_first(cpumask_of_node(node)); > + if (cpu < nr_cpu_ids) > + set_bit(get_cpu_cacheinfo_id(cpu, 3), node_caches); > + else > + mem_only_nodes++; > + } > + cpus_read_unlock(); > + > + ret = (nr_node_ids - mem_only_nodes) / bitmap_weight(node_caches, nr_node_ids); > + kfree(node_caches); > + > + if (ret > 1) > + rdt_resources_all[RDT_RESOURCE_L3].r_resctrl.mon_scope = RESCTRL_NODE; > + > + return ret; > +} > + > static __init void rdt_init_res_defs_intel(void) > { > struct rdt_hw_resource *hw_res; > struct rdt_resource *r; > > + snc_nodes_per_l3_cache = get_snc_config(); > + > for_each_rdt_resource(r) { > hw_res = resctrl_to_arch_res(r); > -- Thanks Babu Moger