Skip to contentSkip to conversation

Patch "drivers: base: cacheinfo: fix x86 with CONFIG_OF enabled" has been added to the 4.9-stable tree

PATCH [email protected] 1 participant 1 message Jan 24, 2018

Subsystems (3)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

drivers: base: cacheinfo: fix x86 with CONFIG_OF enabled

to the 4.9-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
drivers-base-cacheinfo-fix-x86-with-config_of-enabled.patch
and it can be found in the queue-4.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From fac51482577d5e05bbb0efa8d602a3c2111098bf Mon Sep 17 00:00:00 2001

From: Sudeep Holla <[email protected]>
Date: Fri, 28 Oct 2016 09:45:28 +0100
Subject: drivers: base: cacheinfo: fix x86 with CONFIG_OF enabled

From: Sudeep Holla <[email protected]>

commit fac51482577d5e05bbb0efa8d602a3c2111098bf upstream.

With CONFIG_OF enabled on x86, we get the following error on boot:
"
Failed to find cpu0 device node
Unable to detect cache hierarchy from DT for CPU 0
"
and the cacheinfo fails to get populated in the corresponding sysfs entries. This is because cache_setup_of_node looks for of_node for setting up the shared cpu_map without checking that it's already populated in the architecture specific callback.

In order to indicate that the shared cpu_map is already populated, this patch introduces a boolean cpu_map_populated in struct cpu_cacheinfo that can be used by the generic code to skip cache_shared_cpu_map_setup.

This patch also sets that boolean for x86.

---
 arch/x86/kernel/cpu/intel_cacheinfo.c |    2 ++
 drivers/base/cacheinfo.c              |    3 +++
 include/linux/cacheinfo.h             |    1 +
 3 files changed, 6 insertions(+)
arch/x86/kernel/cpu/intel_cacheinfo.c +2 -0
@@ -934,6 +934,8 @@ static int __populate_cache_leaves(unsig
 		ci_leaf_init(this_leaf++, &id4_regs);
 		__cache_cpumap_setup(cpu, idx, &id4_regs);
 	}
+	this_cpu_ci->cpu_map_populated = true;
+
 	return 0;
 }
 
drivers/base/cacheinfo.c +3 -0
@@ -106,6 +106,9 @@ static int cache_shared_cpu_map_setup(un
 	unsigned int index;
 	int ret;
 
+	if (this_cpu_ci->cpu_map_populated)
+		return 0;
+
 	ret = cache_setup_of_node(cpu);
 	if (ret)
 		return ret;
include/linux/cacheinfo.h +1 -0
@@ -71,6 +71,7 @@ struct cpu_cacheinfo {
 	struct cacheinfo *info_list;
 	unsigned int num_levels;
 	unsigned int num_leaves;
+	bool cpu_map_populated;
 };
 
 /*

Patches currently in stable-queue which might be from [email protected] are

queue-4.9/drivers-base-cacheinfo-fix-x86-with-config_of-enabled.patch queue-4.9/drivers-base-cacheinfo-fix-boot-error-message-when-acpi-is-enabled.patch