From: Xiongfeng Wang <wangxiongfeng2@huawei.com>
To: <sudeep.holla@arm.com>, <james.morse@arm.com>,
<gregkh@linuxfoundation.org>, <rafael@kernel.org>
Cc: <linux-kernel@vger.kernel.org>, <bobo.shaobowang@huawei.com>,
<wangxiongfeng2@huawei.com>
Subject: [PATCH v2] cacheinfo: clear cache_leaves(cpu) in free_cache_attributes()
Date: Wed, 14 Jul 2021 09:32:55 +0800 [thread overview]
Message-ID: <1626226375-58730-1-git-send-email-wangxiongfeng2@huawei.com> (raw)
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
next reply other threads:[~2021-07-14 1:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-14 1:32 Xiongfeng Wang [this message]
2021-07-14 9:03 ` Sudeep Holla
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1626226375-58730-1-git-send-email-wangxiongfeng2@huawei.com \
--to=wangxiongfeng2@huawei.com \
--cc=bobo.shaobowang@huawei.com \
--cc=gregkh@linuxfoundation.org \
--cc=james.morse@arm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=sudeep.holla@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®