Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp9716810rwd; Wed, 21 Jun 2023 10:51:44 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6iEqdnReclBVsm7DygpMrogLE8nNzTxQ+8aiO1l5iUdPxNQx5nK0zHBt3e4N9aSjAMk9jA X-Received: by 2002:a05:6808:6396:b0:398:43a7:e9fe with SMTP id ec22-20020a056808639600b0039843a7e9femr15123622oib.20.1687369904736; Wed, 21 Jun 2023 10:51:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687369904; cv=none; d=google.com; s=arc-20160816; b=TyqQ/46/p2MRdat7bE7NdWwZ2AejVrIK/FVS/TwqdOOBmvLxbJFd0ZoZKCMupLg1AY teW6iBy7E5p8wDNpIanPVfsjwMhE8e96C+Nd7mq6YZ2mIhzf1iofcuCZQyu4WvVCSHX6 PiWf+ZsfAqWPyYYP+yNfMtYa8uo15Dd5aecFudI75ezcIO8oOf5CTYvIR7VU4xx+IlAf cSGViWH2uiqEm5rX1xlD7uWpDn/kKdTYuObNekaGwWqU0sofHuZ5E14NvNo0QqF334wY 8Ie9mT/PN9Ml7WBGZ0lXSAsLxFim/r0Xsi1wjzlbuAK+BClfjV0GxZXblkS9zFEdtGez 3SWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Xla/N390ibh9feNxFeh844/QquheEzVtzSEweziMfgg=; b=oSnHReRz345bs5VSG5Kcif94ifY8dBqAetw1owSpxCnjxIfNlJpXljv2cRKh1XC+YC BnAXC7rafe2tQmZbepUBzrJSyunA4qA8/x6Dv5ZtRxkipL18Hs0bqoEj1Xy/UYfukObe HwCh7oak2hIq+1gpzjOsPave+TU54SAcC1D3+De+pnoV9S0LA5cGtyqRmxiAWi21YkCL GayCFjFksi1UYrCzJU748nzJm5da4KimRGprqEfQFHIpMN/p+ZWx5RWcwhoAhXqzVyMK KTGyTEQNMgkBUgQiCoeGZEW7vwLh6ZELAlS8CQF/u2GKqjb/zwOjXGtxOMCanuHuZ0Rm Mn6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NsfwqCvj; 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=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p8-20020a17090b010800b0025ea25605ddsi12269833pjz.40.2023.06.21.10.51.32; Wed, 21 Jun 2023 10:51:44 -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=@intel.com header.s=Intel header.b=NsfwqCvj; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231175AbjFURkq (ORCPT + 99 others); Wed, 21 Jun 2023 13:40:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229954AbjFURkk (ORCPT ); Wed, 21 Jun 2023 13:40:40 -0400 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CBB86193; Wed, 21 Jun 2023 10:40:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687369239; x=1718905239; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aUw1ko8XN5kSoQKed9FOjszj0DPEXH1X0Jv1dS7/3l4=; b=NsfwqCvjdEyHOkI9BAMocFPGur1SDxQda3pc0G+s7Z9oW9bycOvxb9xG MQdvgdlreGcL3vmun9UvCjTWkOyw+PstasP2oV/QlifutBFziBD1tv2zO l09T36t6AZW2SvQPDwvCWtYGu8ZD7BPWWJShYdhQ3cfZp9jhrmIoMANg+ TWp8VCPJD2aAnkSinw8eDjq5GXlyppQOyw7mqOHHcuBuzRlcYmjWMQp4o GKcKd1Bm35YuCIFzk7HyXIglgLBma/F0vj8f/swixiZ6AbXI6FXj2jpTZ HCUpEfvGCorYL3VFaiy+X0qiwphexfyiJMqQ4ut3g46RPQODFiK2M4hWv A==; X-IronPort-AV: E=McAfee;i="6600,9927,10748"; a="359120523" X-IronPort-AV: E=Sophos;i="6.00,261,1681196400"; d="scan'208";a="359120523" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2023 10:40:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10748"; a="779921568" X-IronPort-AV: E=Sophos;i="6.00,261,1681196400"; d="scan'208";a="779921568" Received: from agluck-desk3.sc.intel.com ([172.25.222.74]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2023 10:40:16 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Peter Newman , Jonathan Corbet , x86@kernel.org Cc: Shaopeng Tan , James Morse , Jamie Iles , Babu Moger , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v2 3/7] x86/resctrl: Add a new node-scoped resource to rdt_resources_all[] Date: Wed, 21 Jun 2023 10:40:02 -0700 Message-Id: <20230621174006.42533-4-tony.luck@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230621174006.42533-1-tony.luck@intel.com> References: <20230621174006.42533-1-tony.luck@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Add a placeholder in the array of struct rdt_hw_resource to be used for event monitoring of systems with Sub-NUMA Cluster enabled. Update get_domain_id() to handle SCOPE_NODE. Signed-off-by: Tony Luck --- arch/x86/kernel/cpu/resctrl/internal.h | 4 +++- arch/x86/kernel/cpu/resctrl/core.c | 12 ++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/cpu/resctrl/internal.h b/arch/x86/kernel/cpu/resctrl/internal.h index 8275b8a74f7e..243017096ddf 100644 --- a/arch/x86/kernel/cpu/resctrl/internal.h +++ b/arch/x86/kernel/cpu/resctrl/internal.h @@ -435,6 +435,7 @@ enum resctrl_res_level { RDT_RESOURCE_L2, RDT_RESOURCE_MBA, RDT_RESOURCE_SMBA, + RDT_RESOURCE_NODE, /* Must be the last */ RDT_NUM_RESOURCES, @@ -442,7 +443,8 @@ enum resctrl_res_level { enum resctrl_scope { SCOPE_L2_CACHE = 2, - SCOPE_L3_CACHE = 3 + SCOPE_L3_CACHE = 3, + SCOPE_NODE, }; static inline struct rdt_resource *resctrl_inc(struct rdt_resource *res) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index 6571514752f3..e4bd3072927c 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -112,6 +112,16 @@ struct rdt_hw_resource rdt_resources_all[] = { .fflags = RFTYPE_RES_MB, }, }, + [RDT_RESOURCE_NODE] = + { + .r_resctrl = { + .rid = RDT_RESOURCE_NODE, + .name = "L3", + .scope = SCOPE_NODE, + .domains = domain_init(RDT_RESOURCE_NODE), + .fflags = 0, + }, + }, }; /* @@ -489,6 +499,8 @@ static int arch_domain_mbm_alloc(u32 num_rmid, struct rdt_hw_domain *hw_dom) static int get_domain_id(int cpu, enum resctrl_scope scope) { + if (scope == SCOPE_NODE) + return cpu_to_node(cpu); return get_cpu_cacheinfo_id(cpu, scope); } -- 2.40.1