From: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
To: Sudeep Holla <sudeep.holla@arm.com>
Cc: x86@kernel.org, Andreas Herrmann <aherrmann@suse.com>,
Catalin Marinas <catalin.marinas@arm.com>,
Chen Yu <yu.c.chen@intel.com>, Len Brown <len.brown@intel.com>,
Radu Rendec <rrendec@redhat.com>,
Pierre Gondois <Pierre.Gondois@arm.com>, Pu Wen <puwen@hygon.cn>,
"Rafael J. Wysocki" <rafael.j.wysocki@intel.com>,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
Will Deacon <will@kernel.org>, Zhang Rui <rui.zhang@intel.com>,
Huang Ying <ying.huang@intel.com>,
"Ravi V. Shankar" <ravi.v.shankar@intel.com>,
stable@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v4 1/4] cacheinfo: Check for null last-level cache info
Date: Thu, 25 Jan 2024 06:35:33 -0800 [thread overview]
Message-ID: <20240125143533.GA16226@ranerica-svr.sc.intel.com> (raw)
In-Reply-To: <20240125111544.xhiomitgeazxm7cw@bogus>
On Thu, Jan 25, 2024 at 11:15:44AM +0000, Sudeep Holla wrote:
> On Tue, Dec 12, 2023 at 02:25:16PM -0800, Ricardo Neri wrote:
> > Before determining the validity of the last-level cache info, ensure that
> > it has been allocated. Simply checking for non-zero cache_leaves() is not
> > sufficient, as some architectures (e.g., Intel processors) have non-zero
> > cache_leaves() before allocation.
> >
> > Dereferencing NULL cacheinfo can occur in update_per_cpu_data_slice_size().
> > This function iterates over all online CPUs. However, a CPU may have come
> > online recently, but its cacheinfo may not have been allocated yet.
> >
> > Cc: Andreas Herrmann <aherrmann@suse.com>
> > Cc: Catalin Marinas <catalin.marinas@arm.com>
> > Cc: Chen Yu <yu.c.chen@intel.com>
> > Cc: Huang Ying <ying.huang@intel.com>
> > Cc: Len Brown <len.brown@intel.com>
> > Cc: Radu Rendec <rrendec@redhat.com>
> > Cc: Pierre Gondois <Pierre.Gondois@arm.com>
> > Cc: Pu Wen <puwen@hygon.cn>
> > Cc: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
> > Cc: Sudeep Holla <sudeep.holla@arm.com>
>
> If you respin, you can address the below minor nit. I am fine as is as
> well.
>
> Reviewed-by: Sudeep Holla <sudeep.holla@arm.com>
Thank you for your review Sudeep!
>
> [...]
>
> > diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c
> > index f1e79263fe61..967c5cf3fb1d 100644
> > --- a/drivers/base/cacheinfo.c
> > +++ b/drivers/base/cacheinfo.c
> > @@ -61,6 +61,9 @@ bool last_level_cache_is_valid(unsigned int cpu)
> > if (!cache_leaves(cpu))
> > return false;
> >
> > + if (!per_cpu_cacheinfo(cpu))
> > + return false;
> > +
>
> [nit] You can even combine this with above if condition.
Sure, I can take care of this if a new version is needed as per feedback
from the x86 maintainers.
next prev parent reply other threads:[~2024-01-25 14:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-12 22:25 [PATCH v4 0/4] x86/cacheinfo: Set the number of leaves per CPU Ricardo Neri
2023-12-12 22:25 ` [PATCH v4 1/4] cacheinfo: Check for null last-level cache info Ricardo Neri
2024-01-25 11:15 ` Sudeep Holla
2024-01-25 14:35 ` Ricardo Neri [this message]
2023-12-12 22:25 ` [PATCH v4 2/4] cacheinfo: Allocate memory for memory if not done from the primary CPU Ricardo Neri
2023-12-12 22:25 ` [PATCH v4 3/4] x86/cacheinfo: Delete global num_cache_leaves Ricardo Neri
2023-12-12 22:25 ` [PATCH v4 4/4] x86/cacheinfo: Clean out init_cache_level() Ricardo Neri
2024-01-25 2:56 ` [PATCH v4 0/4] x86/cacheinfo: Set the number of leaves per CPU Ricardo Neri
2024-01-25 11:17 ` 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=20240125143533.GA16226@ranerica-svr.sc.intel.com \
--to=ricardo.neri-calderon@linux.intel.com \
--cc=Pierre.Gondois@arm.com \
--cc=aherrmann@suse.com \
--cc=catalin.marinas@arm.com \
--cc=len.brown@intel.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=puwen@hygon.cn \
--cc=rafael.j.wysocki@intel.com \
--cc=ravi.v.shankar@intel.com \
--cc=rrendec@redhat.com \
--cc=rui.zhang@intel.com \
--cc=srinivas.pandruvada@linux.intel.com \
--cc=stable@vger.kernel.org \
--cc=sudeep.holla@arm.com \
--cc=will@kernel.org \
--cc=x86@kernel.org \
--cc=ying.huang@intel.com \
--cc=yu.c.chen@intel.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®