From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (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 9B4B32417E4 for ; Wed, 21 May 2025 22:51:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747867870; cv=none; b=JyzlzzFSjNpd2LV5ckgBvmJSp8yGBYbKe7T3+EHjqAMzVYh/ioMFMCYB0D2N1BPoQsEoAl4JQ+DJS4n+ezIymZVy41MYxxUljwKWe5Sa2SSw2EsaD5VyTbG2fHrUBzH73WqZ0s9Q9kTa5GPQEdRBdN2r6EbWzwOL+V5Xfw/INjs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1747867870; c=relaxed/simple; bh=DPZAwBEsXW/4j3Zsp6qfubUvBA55fJAptJ9A0jOaC7M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dIExCARE2guRNPL5oG1W2saZLQFK/m3h/vMyyf/MpxJZHCJKzfcGklVvt7nPb6v4Qlp3KGd31fRe2uYmxayP1ZtFeVKh69US3HfqfWfKbEFDc0x2CU6b2lGAwL0Op7b9KDyNBLTbBWb+0wX4a2aPlnZM92fuGECvKKbMr4QtYHQ= 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=Wl7YD0Kp; arc=none smtp.client-ip=198.175.65.14 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="Wl7YD0Kp" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1747867869; x=1779403869; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=DPZAwBEsXW/4j3Zsp6qfubUvBA55fJAptJ9A0jOaC7M=; b=Wl7YD0Kp373SnAQZQOZrF6HBXjRQinFER74njY/1GKoEEa+A4ockhrC0 u0odiUUfIC4DCMTFCIolPOsktPtkck3oGIPMgk2OQ92JG+UXSzycE8FOe IPDtj6MqqTq2DPCUp9cf6T9g/HuW4jbs6WNIZ9BaYDwA/MNfiqlQehB3T y/hztvrNWad5Gut5u5vKZMImE2FNGFuO+3ETzP7i3wl2Ppv2FHIrKxtLF tIhBbW6whyYSbF4Sx2gNGLumh8p+RU3bs8s2GOgvNYbqHTWlgvTfU8jxH e+1LpQtNam/V+rQfGh5AElFacWP7Q6X4kyrjyjgLjZGsLhc6DaDvPdeCm A==; X-CSE-ConnectionGUID: Qn+xWY6oS0q94lb28y/MFA== X-CSE-MsgGUID: ZqJSy6jYRHqM7j2iudaHwA== X-IronPort-AV: E=McAfee;i="6700,10204,11440"; a="53677734" X-IronPort-AV: E=Sophos;i="6.15,304,1739865600"; d="scan'208";a="53677734" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2025 15:50:59 -0700 X-CSE-ConnectionGUID: 4/o9t1teSRiIaDVSMdFqEw== X-CSE-MsgGUID: BzjeVJB9Tiu/s1mIIPmsgQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.15,304,1739865600"; d="scan'208";a="141352169" Received: from agluck-desk3.sc.intel.com ([172.25.103.51]) by fmviesa009-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 May 2025 15:50:58 -0700 From: Tony Luck To: Fenghua Yu , Reinette Chatre , Maciej Wieczor-Retman , Peter Newman , James Morse , Babu Moger , Drew Fustini , Dave Martin , Anil Keshavamurthy , Chen Yu Cc: x86@kernel.org, linux-kernel@vger.kernel.org, patches@lists.linux.dev, Tony Luck Subject: [PATCH v5 16/29] x86/resctrl: Add and initialize rdt_resource for package scope core monitor Date: Wed, 21 May 2025 15:50:34 -0700 Message-ID: <20250521225049.132551-17-tony.luck@intel.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250521225049.132551-1-tony.luck@intel.com> References: <20250521225049.132551-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 Counts for each Intel telemetry event are periodically sent to one or more aggregators on each package where accumulated totals are made available in MMIO registers. Add a new resource for monitoring these events so that CPU hotplug notifiers will build domains at the package granularity. Signed-off-by: Tony Luck --- 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 4ad3d7f10580..4ba51cb598e1 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, @@ -250,6 +251,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 d5045491790e..64c1c226d676 100644 --- a/fs/resctrl/internal.h +++ b/fs/resctrl/internal.h @@ -234,6 +234,8 @@ struct rdtgroup { #define RFTYPE_DEBUG BIT(10) +#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 f8c9840ce7dc..ce4885c751e4 100644 --- a/arch/x86/kernel/cpu/resctrl/core.c +++ b/arch/x86/kernel/cpu/resctrl/core.c @@ -99,6 +99,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) @@ -430,6 +438,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 bdad98ac0d27..1e1cc8001cbc 100644 --- a/fs/resctrl/rdtgroup.c +++ b/fs/resctrl/rdtgroup.c @@ -2193,6 +2193,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.49.0