From: srinivas pandruvada <srinivas.pandruvada@linux.intel.com>
To: shouyeliu <shouyeliu@gmail.com>,
hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com
Cc: platform-driver-x86@vger.kernel.org,
linux-kernel@vger.kernel.org, Shouye Liu <shouyeliu@tencent.com>
Subject: Re: [PATCH v2] platform/x86/intel-uncore-freq: Fix missing uncore sysfs during CPU hotplug
Date: Wed, 16 Apr 2025 13:40:12 -0700 [thread overview]
Message-ID: <da00e02b7ae32331794314b4d877987a6f2b1cf2.camel@linux.intel.com> (raw)
In-Reply-To: <20250416033842.67394-1-shouyeliu@gmail.com>
On Wed, 2025-04-16 at 11:38 +0800, shouyeliu wrote:
> From: Shouye Liu <shouyeliu@tencent.com>
>
> In certain situations, the sysfs for uncore may not be present when
> all
> CPUs in a package are offlined and then brought back online after
> boot.
>
> This issue can occur if there is an error in adding the sysfs entry
> due
> to a memory allocation failure. Retrying to bring the CPUs online
> will
> not resolve the issue, as the uncore_cpu_mask is already set for the
> package before the failure condition occurs.
>
> This issue does not occur if the failure happens during module
> initialization, as the module will fail to load in the event of any
> error.
>
> To address this, ensure that the uncore_cpu_mask is not set until the
> successful return of uncore_freq_add_entry().
>
Fixes: dbce412a7733 ("platform/x86/intel-uncore-freq: Split common and
enumeration part")
> Signed-off-by: Shouye Liu <shouyeliu@tencent.com>
Cc: stable@vger.kernel.org
Thanks,
Srinivas
> ---
> .../x86/intel/uncore-frequency/uncore-frequency.c | 13 +++++++++--
> --
> 1 file changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/platform/x86/intel/uncore-frequency/uncore-
> frequency.c b/drivers/platform/x86/intel/uncore-frequency/uncore-
> frequency.c
> index 40bbf8e45fa4..bdee5d00f30b 100644
> --- a/drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c
> +++ b/drivers/platform/x86/intel/uncore-frequency/uncore-frequency.c
> @@ -146,15 +146,13 @@ static int uncore_event_cpu_online(unsigned int
> cpu)
> {
> struct uncore_data *data;
> int target;
> + int ret;
>
> /* Check if there is an online cpu in the package for uncore
> MSR */
> target = cpumask_any_and(&uncore_cpu_mask,
> topology_die_cpumask(cpu));
> if (target < nr_cpu_ids)
> return 0;
>
> - /* Use this CPU on this die as a control CPU */
> - cpumask_set_cpu(cpu, &uncore_cpu_mask);
> -
> data = uncore_get_instance(cpu);
> if (!data)
> return 0;
> @@ -163,7 +161,14 @@ static int uncore_event_cpu_online(unsigned int
> cpu)
> data->die_id = topology_die_id(cpu);
> data->domain_id = UNCORE_DOMAIN_ID_INVALID;
>
> - return uncore_freq_add_entry(data, cpu);
> + ret = uncore_freq_add_entry(data, cpu);
> + if (ret)
> + return ret;
> +
> + /* Use this CPU on this die as a control CPU */
> + cpumask_set_cpu(cpu, &uncore_cpu_mask);
> +
> + return 0;
> }
>
> static int uncore_event_cpu_offline(unsigned int cpu)
next prev parent reply other threads:[~2025-04-16 20:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-16 3:38 [PATCH v2] platform/x86/intel-uncore-freq: Fix missing uncore sysfs during CPU hotplug shouyeliu
2025-04-16 20:40 ` srinivas pandruvada [this message]
2025-04-17 2:51 ` liu shouye
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=da00e02b7ae32331794314b4d877987a6f2b1cf2.camel@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
--cc=shouyeliu@gmail.com \
--cc=shouyeliu@tencent.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