From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.21]) (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 C82C732143A for ; Thu, 25 Sep 2025 20:04:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.21 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758830655; cv=none; b=izy6U0MqpmIF+Tvmn8+vG06byVs8b8er+JTZuXPH9HjK0oRFslEAP7UpDr3qkX2OSorN1EE+kxtUlMTSJoGZuX5mDxdlE7utiYJYcrD6IML5LJUgSjq6sbyjM8VAZ+AhiY2a2v+O0214o9WzoalsDlZGdTY09CnEw6nWs6bnqlc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758830655; c=relaxed/simple; bh=YGbAnFmurLh7byiT75mi0ZvMHKcRUq7uV1rFIt85zc8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rpu2I5w0D+5DhZeSC6gOKUZ3UbLe8t8P2k02klZwU2lmck5a4cjAJniKsN3sBWjc/DobMJJhE99Np4Wf8w3IgLgjM8aWtk1oj/o4uiVs5JqLE3Gu+wb3egsiqls8AAr9b0HHTjhGFoy21jef91tdbrjrkumieSGOeIMcR7Yf+FA= 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=UaKu2lCY; arc=none smtp.client-ip=198.175.65.21 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="UaKu2lCY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1758830654; x=1790366654; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YGbAnFmurLh7byiT75mi0ZvMHKcRUq7uV1rFIt85zc8=; b=UaKu2lCYQ0ndVpRg27zJmoTNz3Ft/m5aSVC53utZ8A6h1V4kHIxx+axg zdSB6Yj/3olKT97tbNwWnqWEoxDG/p5C8m5Q/w+hcu9CF8XoedNmaxgmt FjXmrztHrBT84qvTASxzwr3da56rKIHzwNF3JfKa8RA+n3AKXCUI1NIzJ JNXAOhEbgGHycAiItu3yRGaFt5V6TeCPbWsHKgSOxv1mcLUuxfN8o1FnI WrcxprcFSHhUcyEYrMdTwJ7mTUdhHg2N8UqTV5I+ZjqzNndfUGHp+dHA0 a9ydyHHK1MPWFZud+p6sYBoOcwpUgEOGWNIwa72BlhyMbw7K9rwvfpN1X w==; X-CSE-ConnectionGUID: CTgL14GzRT28ocvRo4KBhQ== X-CSE-MsgGUID: ef0wjRkfTjiHRvsIg+7RYg== X-IronPort-AV: E=McAfee;i="6800,10657,11531"; a="61074239" X-IronPort-AV: E=Sophos;i="6.17,312,1747724400"; d="scan'208";a="61074239" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2025 13:04:09 -0700 X-CSE-ConnectionGUID: +1xI2iuMR5a9n1OyQykjPg== X-CSE-MsgGUID: IhBA5GBpQdGr4s6ph/EAaQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,293,1751266800"; d="scan'208";a="177003642" Received: from inaky-mobl1.amr.corp.intel.com (HELO agluck-desk3.intel.com) ([10.124.220.206]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2025 13:04:09 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Chen Yu Cc: x86@kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v11 13/31] x86,fs/resctrl: Add and initialize rdt_resource for package scope monitor Date: Thu, 25 Sep 2025 13:03:07 -0700 Message-ID: <20250925200328.64155-14-tony.luck@intel.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250925200328.64155-1-tony.luck@intel.com> References: <20250925200328.64155-1-tony.luck@intel.com> Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add a new PERF_PKG resource and introduce package level scope for monitoring telemetry events so that CPU hot plug notifiers can build domains at the package granularity. Use the physical package ID available via topology_physical_package_id() to identify the monitoring domains with package level scope. This enables user space to use: /sys/devices/system/cpu/cpuX/topology/physical_package_id to identify the monitoring domain a CPU is associated with. Signed-off-by: Tony Luck Reviewed-by: Reinette Chatre --- include/linux/resctrl.h | 2 ++ fs/resctrl/internal.h | 2 ++ arch/x86/kernel/cpu/resctrl/core.c | 10 ++++++++++ fs/resctrl/rdtgroup.c | 2 ++ 4 files changed, 16 insertions(+) diff --git a/include/linux/resctrl.h b/include/linux/resctrl.h index 6350064ac8be..ff67224b80c8 100644 --- a/include/linux/resctrl.h +++ b/include/linux/resctrl.h @@ -53,6 +53,7 @@ enum resctrl_res_level { RDT_RESOURCE_L2, RDT_RESOURCE_MBA, RDT_RESOURCE_SMBA, + RDT_RESOURCE_PERF_PKG, /* Must be the last */ RDT_NUM_RESOURCES, @@ -267,6 +268,7 @@ enum resctrl_scope { RESCTRL_L2_CACHE = 2, RESCTRL_L3_CACHE = 3, RESCTRL_L3_NODE, + RESCTRL_PACKAGE, }; /** diff --git a/fs/resctrl/internal.h b/fs/resctrl/internal.h index f5189b6771a0..96d97f4ff957 100644 --- a/fs/resctrl/internal.h +++ b/fs/resctrl/internal.h @@ -255,6 +255,8 @@ struct rdtgroup { #define RFTYPE_ASSIGN_CONFIG BIT(11) +#define RFTYPE_RES_PERF_PKG BIT(11) + #define RFTYPE_CTRL_INFO (RFTYPE_INFO | RFTYPE_CTRL) #define RFTYPE_MON_INFO (RFTYPE_INFO | RFTYPE_MON) diff --git a/arch/x86/kernel/cpu/resctrl/core.c b/arch/x86/kernel/cpu/resctrl/core.c index ee6d53aae455..64c6f507b7bc 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -100,6 +100,14 @@ struct rdt_hw_resource rdt_resources_all[RDT_NUM_RESOURCES] = { .schema_fmt = RESCTRL_SCHEMA_RANGE, }, }, + [RDT_RESOURCE_PERF_PKG] = + { + .r_resctrl = { + .name = "PERF_PKG", + .mon_scope = RESCTRL_PACKAGE, + .mon_domains = mon_domain_init(RDT_RESOURCE_PERF_PKG), + }, + }, }; u32 resctrl_arch_system_num_rmid_idx(void) @@ -433,6 +441,8 @@ static int get_domain_id_from_scope(int cpu, enum resctrl_scope scope) return get_cpu_cacheinfo_id(cpu, scope); case RESCTRL_L3_NODE: return cpu_to_node(cpu); + case RESCTRL_PACKAGE: + return topology_physical_package_id(cpu); default: break; } diff --git a/fs/resctrl/rdtgroup.c b/fs/resctrl/rdtgroup.c index 72ae7224a2da..6e8937f94e7a 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2330,6 +2330,8 @@ static unsigned long fflags_from_resource(struct rdt_resource *r) case RDT_RESOURCE_MBA: case RDT_RESOURCE_SMBA: return RFTYPE_RES_MB; + case RDT_RESOURCE_PERF_PKG: + return RFTYPE_RES_PERF_PKG; } return WARN_ON_ONCE(1); -- 2.51.0