All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v8 0/2] x86/cacheinfo: Set the number of leaves per CPU
@ 2024-11-28  0:22 Ricardo Neri
  2024-11-28  0:22 ` [PATCH v8 1/2] cacheinfo: Allocate memory during CPU hotplug if not done from the primary CPU Ricardo Neri
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Ricardo Neri @ 2024-11-28  0:22 UTC (permalink / raw)
  To: x86
  Cc: Andreas Herrmann, Catalin Marinas, Chen Yu, Len Brown,
	Radu Rendec, Pierre Gondois, Pu Wen, Rafael J. Wysocki,
	Sudeep Holla, Srinivas Pandruvada, Will Deacon, Zhang Rui,
	Nikolay Borisov, Huang Ying, Ricardo Neri, linux-kernel

Hi,

This is v8 of a patchset to fix the cache sysfs interface by setting the
number of cache leaves independently for each CPU. This version merges
patches 2 and 3 from v7 into one as Borislav suggested. I also dropped
the wrappers functions I had added to access per-CPU cache info
(ci_cpu_cacheinfo).

It looked OK to me to keep the Reviewed-by and Tested-by tags collected
so far as all feedback still applies and changes were minor. I hope
reviewers are OK!

Previous versions can be found in [1], [2], [3], [4], [5], [6], and [7].

Below is the (updated) cover letter from v6 for reference:

The interface /sys/devices/system/cpu/cpuX/cache is broken (not populated)
if CPUs have different numbers of subleaves in CPUID 4. This is the case
of Intel Meteor Lake, which now is out in the world. Tools that rely on
sysfs (e.g., lstopo) fail.

Patch 2 fixes the described issue on Meteor Lake. Patch 1 deals with
prework in the cacheinfo base driver to fix issues uncovered while updating
cacheinfo for x86.

All the tests described in detail in [8] and [9] passed. This is the
summary:

  * /sys/devices/system/cpu/cpuX/cache is populated in Meteor Lake.
  * No inconsistencies are found in /sys/devices/system/cpu/cpuX/cache
    and the tools x86info, lstopo, and lscpu.
  * No splat is observed with and without CONFIG_PREEMPT_RT.
  * No new warnings/errors are seen the kernel log.
  * Tests done on assorted Intel and AMD client and server parts.

Changes since v7:
 * Merged patches 2/3 into one. (Borislav)
 * Dropped wrapper functions for ci_cpu_cacheinfo. (Borislav)
 * Check for zero cache leaves in init_cache_level() for x86.
   (Borislav)
 * Removed an ugly line break. (Borislav)

Changes since v6:
  * Merged patches 1 and 2 into one. (Borislav)
  * Fixed an formatting issue in allocate_cache_info(). (Borislav)

Changes since v5:
  * Reordered the arguments of set_num_cache_leaves().
  * Fixed wording on the subject of patch 2.
  * Added Reviewed-by tags from Andreas and Nikolay. Thanks!
  * Added Tested-by tags from Andreas. Thanks!

Changes since v4:
  * Combined two condition checks into one line. (Sudeep)
  * Added one more Reviewed-by tag from Sudeep. Thanks!

Changes since v3:
  * Fixed another NULL-pointer dereference when checking the validity of
    the last-level cache info.
  * Added the Reviewed-by tags from Radu and Sudeep. Thanks!
  * Rebased on v6.7-rc5.

Changes since v2:
  * This version uncovered a NULL-pointer dereference in recent changes to
    cacheinfo[10]. This dereference is observed when the system does not
    configure cacheinfo early during boot nor makes corrections later
    during CPU hotplug; as is the case in x86. Patch 1 fixes this issue.

Changes since v1:
  * Dave Hansen suggested to use the existing per-CPU ci_cpu_cacheinfo
    variable. Now the global variable num_cache_leaves became useless.
  * While here, I noticed that init_cache_level() also became useless:
    x86 does not need ci_cpu_cacheinfo::num_levels.

Thanks and BR,
Ricardo

[1]. https://lore.kernel.org/lkml/20230314231658.30169-1-ricardo.neri-calderon@linux.intel.com/
[2]. https://lore.kernel.org/all/20230424001956.21434-1-ricardo.neri-calderon@linux.intel.com/
[3]. https://lore.kernel.org/lkml/20230805012421.7002-1-ricardo.neri-calderon@linux.intel.com/
[4]. https://lore.kernel.org/all/20231212222519.12834-1-ricardo.neri-calderon@linux.intel.com/
[5]. https://lore.kernel.org/all/20240827051635.9114-1-ricardo.neri-calderon@linux.intel.com/
[6]. https://lore.kernel.org/all/20240905060036.5655-1-ricardo.neri-calderon@linux.intel.com/
[7]. https://lore.kernel.org/all/20240913083155.9783-1-ricardo.neri-calderon@linux.intel.com/
[8]. https://lore.kernel.org/lkml/20230912032350.GA17008@ranerica-svr.sc.intel.com/
[9]. https://lore.kernel.org/all/20240902074140.GA4179@alberich/
[10]. https://lore.kernel.org/all/20230412185759.755408-1-rrendec@redhat.com/

Ricardo Neri (2):
  cacheinfo: Allocate memory during CPU hotplug if not done from the
    primary CPU
  x86/cacheinfo: Delete global num_cache_leaves

 arch/x86/kernel/cpu/cacheinfo.c | 41 +++++++++++++++------------------
 drivers/base/cacheinfo.c        | 11 +++++----
 2 files changed, 25 insertions(+), 27 deletions(-)

-- 
2.34.1


^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2024-12-06 12:24 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-28  0:22 [PATCH v8 0/2] x86/cacheinfo: Set the number of leaves per CPU Ricardo Neri
2024-11-28  0:22 ` [PATCH v8 1/2] cacheinfo: Allocate memory during CPU hotplug if not done from the primary CPU Ricardo Neri
2024-11-29 16:12   ` Radu Rendec
2024-12-01 22:39     ` Ricardo Neri
2024-12-02  6:53   ` Nikolay Borisov
2024-12-03  4:09     ` Ricardo Neri
2024-12-02  8:02   ` Andreas Herrmann
2024-12-03  4:09     ` Ricardo Neri
2024-12-02 11:03   ` Sudeep Holla
2024-12-03  4:08     ` Ricardo Neri
2024-12-06 12:24   ` [tip: x86/urgent] " tip-bot2 for Ricardo Neri
2024-11-28  0:22 ` [PATCH v8 2/2] x86/cacheinfo: Delete global num_cache_leaves Ricardo Neri
2024-12-04 14:32   ` Borislav Petkov
2024-12-04 16:39     ` Ricardo Neri
2024-12-04 19:32       ` Borislav Petkov
2024-12-04 22:22         ` Ricardo Neri
2024-12-05 15:14           ` Borislav Petkov
2024-12-06  1:47             ` Ricardo Neri
2024-12-06 12:08               ` Borislav Petkov
2024-12-06 12:24   ` [tip: x86/urgent] " tip-bot2 for Ricardo Neri
2024-11-28  9:30 ` [PATCH v8 0/2] x86/cacheinfo: Set the number of leaves per CPU Borislav Petkov
2024-12-01 22:41   ` Ricardo Neri
2024-12-02 10:31     ` Borislav Petkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.