* [PATCH v2] cacheinfo: clear cache_leaves(cpu) in free_cache_attributes()
@ 2021-07-14 1:32 Xiongfeng Wang
2021-07-14 9:03 ` Sudeep Holla
0 siblings, 1 reply; 2+ messages in thread
From: Xiongfeng Wang @ 2021-07-14 1:32 UTC (permalink / raw)
To: sudeep.holla, james.morse, gregkh, rafael
Cc: linux-kernel, bobo.shaobowang, wangxiongfeng2
On ARM64, when PPTT(Processor Properties Topology Table) is not
implemented in ACPI boot, we will goto 'free_ci' with the following
print:
Unable to detect cache hierarchy for CPU 0
But some other codes may still use 'num_leaves' to iterate through the
'info_list', such as get_cpu_cacheinfo_id(). If 'info_list' is NULL , it
would crash. So clear 'num_leaves' in free_cache_attributes().
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
---
v1 -> v2: Drop the Fixes tag as it doesn't fix anything in upstream.
---
drivers/base/cacheinfo.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c
index bfc0959..dad2962 100644
--- a/drivers/base/cacheinfo.c
+++ b/drivers/base/cacheinfo.c
@@ -297,6 +297,7 @@ static void free_cache_attributes(unsigned int cpu)
kfree(per_cpu_cacheinfo(cpu));
per_cpu_cacheinfo(cpu) = NULL;
+ cache_leaves(cpu) = 0;
}
int __weak init_cache_level(unsigned int cpu)
--
1.7.12.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] cacheinfo: clear cache_leaves(cpu) in free_cache_attributes()
2021-07-14 1:32 [PATCH v2] cacheinfo: clear cache_leaves(cpu) in free_cache_attributes() Xiongfeng Wang
@ 2021-07-14 9:03 ` Sudeep Holla
0 siblings, 0 replies; 2+ messages in thread
From: Sudeep Holla @ 2021-07-14 9:03 UTC (permalink / raw)
To: Xiongfeng Wang
Cc: james.morse, gregkh, rafael, linux-kernel, bobo.shaobowang, Sudeep Holla
On Wed, Jul 14, 2021 at 09:32:55AM +0800, Xiongfeng Wang wrote:
> On ARM64, when PPTT(Processor Properties Topology Table) is not
> implemented in ACPI boot, we will goto 'free_ci' with the following
> print:
> Unable to detect cache hierarchy for CPU 0
>
> But some other codes may still use 'num_leaves' to iterate through the
> 'info_list', such as get_cpu_cacheinfo_id(). If 'info_list' is NULL , it
> would crash. So clear 'num_leaves' in free_cache_attributes().
>
Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-07-14 9:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-14 1:32 [PATCH v2] cacheinfo: clear cache_leaves(cpu) in free_cache_attributes() Xiongfeng Wang
2021-07-14 9:03 ` Sudeep Holla
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).