From patchwork Fri Jan 26 22:38:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Luck, Tony" X-Patchwork-Id: 192838 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2395:b0:106:343:edcb with SMTP id gw21csp190532dyb; Fri, 26 Jan 2024 14:40:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IGymRLUqJ09Ll8qe/hlYedhZOmJBV+Gh4AAz927J9FaUa7lrDJ7frmxACfVf3gmS4FvQkkd X-Received: by 2002:a05:6402:1647:b0:55a:7db9:3b19 with SMTP id s7-20020a056402164700b0055a7db93b19mr254914edx.11.1706308831421; Fri, 26 Jan 2024 14:40:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706308831; cv=pass; d=google.com; s=arc-20160816; b=ZomJP08+BJxAwYEATappajNEMt+h+EzLqJG/EUTDfdPjyxDEthlima09jrk1ivw+wV tmHWDTjCQBnvBpUq/Y+OXam3tpRure+pq5iW1S3Guym/8lhukfQIUhbMdxBIa5XrW0jY SJMBrqoHPsMgPL632O58XKurEkcRa3RA306eTzQtHn2Br+Zc0K7ZtwVFo2tuG4cfNyBC qu6jkRZWVIbmyKlTiW77Gw7ATNtH/2nG4ZziJWCgOmCzyDXYzHVfLvEqyBRgvwXVP+Ho Xa5Cq2671ZSd/5hM/eebLCaOb11EW6TaE+lPwErh5rLoGIPERXJ6rsgVWHOfRYCyXKNb l6lg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=52RfnHRltrZwgW69TjcUuF+avr5JiRz11BegIQLCDKU=; fh=CeSt/0DUxAI+IzY2bemPEXMONxc81ae/+QF2A4ki9mA=; b=XBXVjvATX+G1KghYn0+NC7QNxKN37ZJmieMdR3/LwJInmq7oNOb73o7JGVd3a7jguG W0B9cGes2ezyqmVVs+eByjYixrM0ITN8qXEj8wkSmjZkkB+lPc9UA7w5+tMlC0eAcbB8 qAk+yoVNjim/wxbEnjm5ADSUavYb1siv+qZkKNXknJxHJ7R933YCTqjkluHSLvv1mpyD mXQ8TKuEstKM1W+mrsEGyTSzslh1GJsl9nKBXzZwXpgVHFAQiacBeR6cTOXJjTyawjiB L8O1J8uBGOqI+gRH4HRp2y/7h5MKb0h/D3mW595MOtFRf4/Eo6QKtR0m3Ja0vZgF7cAr T6vA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YY1ylreC; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-40790-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40790-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id d26-20020a056402401a00b005527ae447f1si1170492eda.112.2024.01.26.14.40.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 14:40:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40790-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YY1ylreC; arc=pass (i=1 spf=pass spfdomain=intel.com dkim=pass dkdomain=intel.com dmarc=pass fromdomain=intel.com); spf=pass (google.com: domain of linux-kernel+bounces-40790-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40790-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 0D23C1F25156 for ; Fri, 26 Jan 2024 22:40:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E7E1C58116; Fri, 26 Jan 2024 22:38:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="YY1ylreC" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 0B67B51024; Fri, 26 Jan 2024 22:38:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706308734; cv=none; b=OEFA+8Vhab5LdMIlTk3Fbjnf14NLEjqMW3BZJCBQLt54Bt95sOh6M1dqZwm2+q1iCJsdPnl7gl+3JBgA6UJeCfBG9TtJjlhI8JCbZ5BodciUsw8frHvR/Qh/GNBz4SBUl7jp2zWtP14vX1bvwY7Fu7XpZsnArzzl8WvNdnbWXcw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706308734; c=relaxed/simple; bh=ejTtG9IVvU1pMsWd87GPfoDZ/SXanaRDlw9oN2DlbHc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ZR26JHG4cDTPpB7VklFF4XWZcIBgGSoIJpFdKKWfFj/1gwyRNLQYyvH+2W19mhTTIUrpvaUCZ3lkgM6Y/JZmCyYx6whETYDfD7hbC7qZtDTDd/lUdNgbDBz7s1QEQKFl4ajV7iNf3sahpZB2TnnPTlLDv/I/qLeZuWoOhkmOOPk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=YY1ylreC; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1706308733; x=1737844733; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ejTtG9IVvU1pMsWd87GPfoDZ/SXanaRDlw9oN2DlbHc=; b=YY1ylreCzIDOBPybCEpYbZ6B3+pIZul4N8Bfuk31NggHBl++SrI6J/Zo /TRvOw7eb2ZzIKb4jEvxhVY6CUgidl/D5CYTykUe+XmWmN17+LHjn9Z97 D0Hui9PwzekBa9cjb5tl3+J/KzMYV9nOHSHc/+kzBDU0JywFaQ1aDuSra ePThqjxpoqHu7cQIdqLlCRpM/d/dFS8zNeSen+pxj9Owb9ltvnm7IR03Y KKkqCjnUxGQjsElrDq8ERJmavMN+EdLwPl869EHcd3peAVohuuBdzbdoU MQ8wUOaX4vqKBQxGuxDUDw0r21yQ5UpG+pevqjs2avEBtuChpIYjXkKsn w==; X-IronPort-AV: E=McAfee;i="6600,9927,10964"; a="9707700" X-IronPort-AV: E=Sophos;i="6.05,220,1701158400"; d="scan'208";a="9707700" Received: from orviesa001.jf.intel.com ([10.64.159.141]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2024 14:38:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.05,220,1701158400"; d="scan'208";a="35560260" Received: from agluck-desk3.sc.intel.com ([172.25.222.74]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jan 2024 14:38:48 -0800 From: Tony Luck To: Borislav Petkov Cc: Fenghua Yu , Reinette Chatre , Peter Newman , Jonathan Corbet , Shuah Khan , Shaopeng Tan , James Morse , Jamie Iles , Babu Moger , Randy Dunlap , x86@kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, patches@lists.linux.dev, Tony Luck , Shaopeng Tan Subject: [PATCH v14 5/8] x86/resctrl: Add node-scope to the options for feature scope Date: Fri, 26 Jan 2024 14:38:34 -0800 Message-ID: <20240126223837.21835-6-tony.luck@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240126223837.21835-1-tony.luck@intel.com> References: <20231204185357.120501-1-tony.luck@intel.com> <20240126223837.21835-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778054133068408317 X-GMAIL-MSGID: 1789194489255383611 Currently supported resctrl features are all domain scoped the same as the scope of the L2 or L3 caches. Add RESCTRL_NODE as a new option for features that are scoped at the same granularity as NUMA nodes. This is needed for Intel's Sub-NUMA Cluster (SNC) feature where monitoring features are node scoped. Tested-by: Shaopeng Tan Reviewed-by: Peter Newman Reviewed-by: Reinette Chatre Reviewed-by: Shaopeng Tan Reviewed-by: Babu Moger Signed-off-by: Tony Luck --- include/linux/resctrl.h | 1 + arch/x86/kernel/cpu/resctrl/core.c | 2 ++ 2 files changed, 3 insertions(+) diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 058a940c3239..b8a3a11b970d 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -170,6 +170,7 @@ struct resctrl_schema; enum resctrl_scope { RESCTRL_L2_CACHE = 2, RESCTRL_L3_CACHE = 3, + RESCTRL_NODE, }; /** diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index d7c0651d337d..27523841f9fd 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -500,6 +500,8 @@ static int get_domain_id_from_scope(int cpu, enum resctrl_scope scope) case RESCTRL_L2_CACHE: case RESCTRL_L3_CACHE: return get_cpu_cacheinfo_id(cpu, scope); + case RESCTRL_NODE: + return cpu_to_node(cpu); default: break; }