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 693F82EA47C for ; Sat, 25 Jul 2026 09:30:16 +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=1784971818; cv=none; b=Y5PuE3JzpnUuobZObo0yB4g/MbwvBNoUdr2HoWelMi/hDtnsaG7oMmbr1yMfhG7pxnSRvw/WufgpnmzZXwAukwDZxxGswleL9Cbh4rhrbCMC1el/3HFEuRIVkajqcxhyx6uSrBWLDVYgNhz9pHbjjgpl0KbDp9SeVQDl06zPN+I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784971818; c=relaxed/simple; bh=oYLj+ox5FiqjLDVJ6rlMLG0nUQ8Se0wEDoNygYJFblY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=gRcoA47FOR06+D4jXNa8Y4/ngB2jueCG9Wp7q2w8HxSn/ky/SERs2zy4FYkVAFsN8xqoyCtzLrra4D0UydQ5jhv98uh0U5hDDhX8v6vfSJ3zog/ObKObkiQdJV6ue9VUA+2Fvsq904L/0TMvZAV+jv+ijDVm3YepemAspqt7SLM= 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=T8sfVT7k; 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="T8sfVT7k" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1784971816; x=1816507816; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=oYLj+ox5FiqjLDVJ6rlMLG0nUQ8Se0wEDoNygYJFblY=; b=T8sfVT7kEpDWOsGrn4jb3UDLDdlRq38WHpOSlIemB+OV6sPPDCXjUM0r YpyUudPb4hdU6nka32Ofa70EuI/pixVd0dQOAMvZvXNxIGhVEJH8MNCBg D+/i15vqAdPdUps1bEUgAQAWJWcF9nIf+23EDox1rbX4OepeAYj3slmAZ SKyo6nX1Ojj3U3MDcu8QMTGTP1wFed0ihM5/gMtWTY0Bym5UFpHXRjack dfRlwe6+QfiXPigsvKHgUubFb7f774FoTyJ7wL81usSMeziVL1cE4x0mE g9oVxf77yLMLM/uE9KtHWED+F832Ix8sduVWO9ME/EUxxVGDQILkWL7CZ Q==; X-CSE-ConnectionGUID: cf+D7YxTTA2LSG4sl/d1wg== X-CSE-MsgGUID: IXCvnNTiTJym+ZqoKz4j4w== X-IronPort-AV: E=McAfee;i="6800,10657,11855"; a="85476218" X-IronPort-AV: E=Sophos;i="6.25,184,1779174000"; d="scan'208";a="85476218" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa113.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Jul 2026 02:30:16 -0700 X-CSE-ConnectionGUID: 8TG2eKRoQyGBd9Xfd4Q7kg== X-CSE-MsgGUID: +WYsliMSSM64oN1Ggn2ILQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.25,184,1779174000"; d="scan'208";a="258996616" Received: from chenyu-dev.sh.intel.com ([10.239.62.107]) by orviesa007.jf.intel.com with ESMTP; 25 Jul 2026 02:30:13 -0700 From: Chen Yu To: tony.luck@intel.com, reinette.chatre@intel.com Cc: tglx@kernel.org, bp@alien8.de, mingo@redhat.com, dave.hansen@linux.intel.com, hpa@zytor.com, fenghuay@nvidia.com, babu.moger@amd.com, chen.yu@linux.dev, x86@kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 0/9] Introduce MMIO-based CMT access for Enhanced RDT Date: Sat, 25 Jul 2026 17:20:29 +0800 Message-Id: X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit v5: https://lore.kernel.org/lkml/cover.1782866200.git.yu.c.chen@intel.com/ v4: https://lore.kernel.org/lkml/cover.1781332698.git.yu.c.chen@intel.com/ v3: https://lore.kernel.org/lkml/cover.1780710620.git.yu.c.chen@intel.com/ v2: https://lore.kernel.org/lkml/cover.1780587063.git.yu.c.chen@intel.com/ v1: https://lore.kernel.org/lkml/cover.1779872016.git.yu.c.chen@intel.com/ Intel Enhanced Resource Director Technology (ERDT) extends the existing RDT framework with two major capabilities: 1. MMIO-based access to monitoring and allocation registers, replacing the legacy MSR-based interface. 2. Region-aware RDT for fine-grained control over different tiers of memory (e.g., CXL.mem, DDR). This is described in the Intel RDT Architecture Specification: https://cdrdv2-public.intel.com/789566/356688-intel-rdt-arch-spec.pdf This patch set focuses on the first part: enabling MMIO-based access for Cache Monitoring Technology (CMT), while CAT/MBM/MBA are still using MSR. The platform advertises the MMIO register layout through the ACPI ERDT (Enhanced Resource Director Technology) table, which contains sub-tables describing per-domain register regions for monitoring and allocation. With ERDT, L3 cache occupancy counters are read via MMIO rather than MSR, allowing the reads to be performed from any CPU without requiring cross-CPU IPIs. This series parses the relevant ACPI sub-tables (RMDD, CMRC), prepares the resctrl monitor infrastructure for MMIO-based reads, and adds initial support for reading L3 occupancy via the CMRC interface. kselftest of CMT and L3_CAT has passed with minor adjustment at https://lore.kernel.org/lkml/20260523101715.3964456-1-yu.c.chen@intel.com/. V6 has gone through local sashiko review, with false positives left unaddressed. Major changes from V5 to V6: - Reorder the series so that the x86/topology change, which touches a different subsystem, comes first. (Reinette Chatre) - Drop the v5 "x86/resctrl: Replace 'msr' in monitoring data identifiers" patch. None of the renamed identifiers are used by the MMIO code. (Reinette Chatre) - Split the domain setup into erdt_cpu_valid() and erdt_l3_mon_domain_setup(). Validation now happens in domain_add_cpu_mon() before the CPU is added to the domain cpumask, and attaching ERDT data to a freshly created domain (Reinette Chatre) - Drop the SNC special case and the new resctrl_disable_mon_event(). (Reinette Chatre) - resctrl_arch_round_mon_val() now rounds to the ERDT scale instead of returning the value unchanged (Reinette Chatre) - Make erdt_get_max_rmid() a global value instead of a per-CPU lookup. (Reinette Chatre) - Use struct cpumask instead of cpumask_var_t, list_for_each_entry() instead of open coded container_of(), and document every member of struct erdt_domain_info. (Reinette Chatre) Thanks Tony, Reinette, Thomas, Hongyu for your time to look at this patch set. Changes from V4 to V5: There are some major changes since v4: - (biggest change) Eliminate the xarray for runtime lookups; embed struct erdt_domain_info directly in rdt_hw_l3_mon_domain and assign during l3_mon_domain_setup(). - Separate CPUID and ACPI enumeration cleanly. Do not use CPUID feature flags to gate MMIO-based monitoring. Use ACPI table presence (e.g., CMRC table) to determine event enablement. - Use ACPI RMDD's own "Max RMID" field for MMIO access instead of relying on CPUID's max RMID (which applies to MSR). - Enforce the SNC constraint in code rather than burying it behind a comment WARN. Disable mon_capable in rdt_get_l3_mon_config() when ERDT is enabled and snc_nodes_per_l3_cache > 1. - Split non-resctrl changes (topology.c, apic.h) into a separate preparatory patch prefixed with x86/topology. - Move the "depends on X86" to "X86_64" adjustment to a separate patch with explicit justification in its changelog. Changes from V3 to V4: - Remove the redundant table length check in subtbl_valid() (Thomas Gleixner) - Reuse subtbl_valid() for all the table iteration (Thomas Gleixner) - Refine the commit log of [PATCH 5/6] to state that this change is a preparation for [PATCH 6/6] rather than fixing an existing issue (Thomas Gleixner, Reinette Chatre, Tony Luck) - Fix if CACD lists all CPUs in the LLC domain (sashiko) - Deal with a corner case that if there is no valid RMDD tables, the erdt_enabled_flag should remain false.(sashiko) - Add Thomas's Reviewed-by and Hongyu's Tested-by. Changes from V2 to V3: - Wrap __resctrl_arch_late_init() to avoid the goto logic. (Thomas Gleixner) - Make the variables in struct erdt_domain_info tabular format (Thomas Gleixner) - Remove tail comments (Thomas Gleixner) - Make the name of erdt_enabled() and variable in it consistent and comprehensible. (Thomas Gleixner) - Use topo_lookup_cpuid() to search the CPU id according to the x2apic id (Thomas Gleixner) - Fix kernel doc comment format (Thomas Gleixner) - Use brackets for multiple lines "if" case. (Thomas Gleixner) - Let the parameter for cacd_init() to fully utilize 100 characters. (Thomas Gleixner) - Variables are reordered in reverse fir-tree.(Thomas Gleixner) - Added a named constant and use it in the rmdd->flags check. (Thomas Gleixner) - Introduce helper functions to make the code readable when iterating the RMDD tables. (Thomas Gleixner) - Make the macros tabular format. (Thomas Gleixner) Changes from V1 to V2: - Add #include to follow the "include-what-you-use" best practice (Tony Luck) - Fix 3 issues reported by: https://sashiko.dev/#/patchset/cover.1779872016.git.yu.c.chen%40intel.com Remove the variable of cacd in struct erdt_domain_info as it will never be used after initialization. Invoke erdt_exit() to avoid resource leak if rdt_alloc_capable and rdt_mon_capable are both false. Adjust the comments suggested by sashiko. Anil S Keshavamurthy (1): x86/resctrl: Parse ACPI ERDT table and save CACD cpumask for RMDD domains Chen Yu (7): x86/topology: Export topo_lookup_cpuid() for resctrl use x86/resctrl: Require 64-bit x86 for resctrl support x86/resctrl: Attach ACPI ERDT information to L3 mon domain on CPU online x86/resctrl: Parse ACPI CMRC table x86/resctrl: Refactor the monitor read function x86/resctrl: Introduce erdt_cpu_has() and erdt_support() x86/resctrl: Add MMIO-based LLC occupancy monitoring support Tony Luck (1): fs/resctrl: Do not invoke smp_processor_id() in preemptible context arch/x86/Kconfig | 4 +- arch/x86/include/asm/apic.h | 1 + arch/x86/include/asm/resctrl.h | 11 +- arch/x86/kernel/cpu/resctrl/Makefile | 1 + arch/x86/kernel/cpu/resctrl/core.c | 53 ++- arch/x86/kernel/cpu/resctrl/erdt.c | 453 +++++++++++++++++++++++++ arch/x86/kernel/cpu/resctrl/internal.h | 49 ++- arch/x86/kernel/cpu/resctrl/monitor.c | 36 +- arch/x86/kernel/cpu/topology.c | 2 +- fs/resctrl/monitor.c | 44 ++- 10 files changed, 627 insertions(+), 27 deletions(-) create mode 100644 arch/x86/kernel/cpu/resctrl/erdt.c -- 2.25.1