From patchwork Thu Jul 13 16:32:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Luck, Tony" X-Patchwork-Id: 120043 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1964154vqm; Thu, 13 Jul 2023 10:07:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlGY/bbbwBx5VPmUoP/Tyw9mh9IqQNYNYhW2DqWDuU/ZdRhjwgPNNcssmpcmZsIsUNmsT75k X-Received: by 2002:ac2:55bb:0:b0:4f8:7333:d1fd with SMTP id y27-20020ac255bb000000b004f87333d1fdmr1508876lfg.34.1689268040870; Thu, 13 Jul 2023 10:07:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689268040; cv=none; d=google.com; s=arc-20160816; b=PpwL8vaX+O5Q6KkmohUxz/2b2WXw0W3CnUW6PrNZh24gqg9bazR5ZVGOWk+MWYSSW6 L625JqZrhdh6Jeifo9z0L8QQEKgipDpc6uaYg7XH/NKkrPFXGuC5B+7u1IyUE7EfoF/+ WDBAGm8MqUh+aM/jBwEVne5MrsZRW4jUU95Cg8JNoi8nHDmQTuzOe4VQYWKYvliyQqNG nIbyT7brGWeCYii7hBdWAHMkzGmaqK4Wqd4TnsU0q6o62eTfs8AXjqNEChzivd/APKzE R0JwriDryeydtygB/f1Vqn92vzSKBPPAFNOwrXOM5N74g4/JxW6LPwOjwg4t//Ilbjms 7mKA== 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=TnpVlOWPFkOXgpVW1bIvFAPZaV3EnSK5zCVKk90iNw8=; fh=g0WKEVDdB8sQamShH39vSa8SoB8TDPrv8hO7zbxV08s=; b=CLKM3wrBFFexkQHSaNTnjlQNXyzjIGZoGgi9ZyEmy2z2MSoHKebQjWvhyZNb7CtFOJ ysk2m8zFBwBFDmcMn7K2ZGkk+mBYn0Vz73hMoyNIF0iI6Ps277YRkF2GmWtdbyw7skIK YKTG8wq+OZU/Fyr8sHYdMi3ftrR51fZpqbm1LycpGRHlxC/HM+7iMxdagTp7IfSPPYZQ sgI0Mdpdo2X7cXZ4QzkYRSuYX+/SrS3uQIlP7ulADHLGK/BFxKbKGGRLg/nafONxNCMM Ez6DcyprlmWew4223j1XJlQhQmxLdprOzTtzpaOj6oB+i4zLC2vaH6lUIL2vPx/visab ckBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=E1oeZ9A0; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n21-20020aa7d055000000b0051e034292f7si7385296edo.147.2023.07.13.10.06.46; Thu, 13 Jul 2023 10:07:20 -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=E1oeZ9A0; 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 S231777AbjGMQcr (ORCPT + 99 others); Thu, 13 Jul 2023 12:32:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43502 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232834AbjGMQce (ORCPT ); Thu, 13 Jul 2023 12:32:34 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 916AF273F; Thu, 13 Jul 2023 09:32:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1689265953; x=1720801953; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mb0vyqYUmP9/Z2FeljUZJDw2W7rRUKlG9bPFHkTU9kY=; b=E1oeZ9A04k0Ke+aX+iHdySs7rP0WfXXQFQfPhL8Hq8X5uhFiHNbm30qF gkLeXhIh8ORondiflXknuPk6JIa4E/9G4nXxPErGIWnSxtSledge+vhxd iCYqBVJ9AGTCQThXssZp01U2seAPhe69BADaVwN++MImOKVOafvL5Vcff xRyOs1PfwEydJz7lD2WSUL6zrkvKG0TNa3IMv7tWJu63KCLnE++Hn35pD QIZ9zdzd7N2mNE4jTKAeT2re2uUobxxTLHz6g16Tqh+wP9biwiwo3LdiP sSqwL5htgPSykCNjufl8LkMk6Qdab/XB2V/Z1s8lOIPfS6jMqizvAqZw1 Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="362707619" X-IronPort-AV: E=Sophos;i="6.01,203,1684825200"; d="scan'208";a="362707619" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2023 09:32:23 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10770"; a="722046377" X-IronPort-AV: E=Sophos;i="6.01,203,1684825200"; d="scan'208";a="722046377" Received: from agluck-desk3.sc.intel.com ([172.25.222.74]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 13 Jul 2023 09:32:22 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Peter Newman , Jonathan Corbet , Shuah Khan , x86@kernel.org Cc: Shaopeng Tan , James Morse , Jamie Iles , Babu Moger , Randy Dunlap , linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v3 3/8] x86/resctrl: Add a new node-scoped resource to rdt_resources_all[] Date: Thu, 13 Jul 2023 09:32:02 -0700 Message-Id: <20230713163207.219710-4-tony.luck@intel.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230713163207.219710-1-tony.luck@intel.com> References: <20230713163207.219710-1-tony.luck@intel.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771325925558394458 X-GMAIL-MSGID: 1771325925558394458 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 Reviewed-by: Peter Newman --- 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); }