FAILED: patch "[PATCH] cpufreq: CPPC: Select the frequency-invariance callback per CPU" failed to apply to 7.3-stable tree
Sasha Levin
maintainerThe patch below does not apply to the 7.3-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.3.y
git checkout FETCH_HEAD
git cherry-pick -x 21e018235d99bc86249b034c06646df8757b2852
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 7.3.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From 21e018235d99bc86249b034c06646df8757b2852 Mon Sep 17 00:00:00 2001
From: Christian Loehle <[email protected]>
Date: Wed, 16 Sep 2026 17:28:04 +0100
Subject: [PATCH] cpufreq: CPPC: Select the frequency-invariance callback per
CPU
cppc_cpufreq_cpu_fie_init() initializes deferred work only for CPUs whose feedback counters use PCC. However, if any CPU in a shared policy uses PCC, it installs the PCC tick callback for the entire policy. With FIE enabled, a non-PCC CPU then queues an uninitialized irq_work and can call a NULL function pointer when that work runs.
Choose the frequency-invariance callback separately for each CPU using the recorded work-initialization state. Processor removal can unpublish the CPC descriptor before callback registration, so querying its counter transport again can incorrectly select direct reads for a PCC CPU.
Register the callbacks after all counter initialization has completed, so a failed initial read for an online CPU cannot leave a partially registered policy. PCC CPUs use their initialized deferred work, while non-PCC CPUs read their own counters directly from the tick.
--- drivers/cpufreq/cppc_cpufreq.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/cpufreq/cppc_cpufreq.c +10 -4
@@ -150,7 +150,7 @@ static struct scale_freq_data cppc_sftd_pcc = {static void cppc_cpufreq_cpu_fie_init (struct cpufreq_policy *policy) { -struct scale_freq_data *sftd = &cppc_sftd; +struct scale_freq_data *sftd;struct cppc_freq_invariance *cppc_fi;int cpu, ret;
@@ -165,7 +165,6 @@ static void cppc_cpufreq_cpu_fie_init(struct cpufreq_policy *policy)kthread_init_work (&cppc_fi->work, cppc_scale_freq_workfn);init_irq_work (&cppc_fi->irq_work, cppc_irq_work); cppc_fi->pcc_work_initialized = true; - sftd = &cppc_sftd_pcc; } ret =cppc_get_perf_ctrs (cpu, &cppc_fi->prev_perf_fb_ctrs);
@@ -181,8 +180,15 @@ static void cppc_cpufreq_cpu_fie_init(struct cpufreq_policy *policy) } } -/* Register for freq-invariance */ -topology_set_scale_freq_source (sftd, policy->cpus); +/* A shared policy may contain both PCC and non-PCC counters. */ +for_each_cpu (cpu, policy->cpus) { + cppc_fi = &per_cpu (cppc_freq_inv, cpu); +if (cppc_fi->pcc_work_initialized) + sftd = &cppc_sftd_pcc; +else + sftd = &cppc_sftd; +topology_set_scale_freq_source (sftd,cpumask_of (cpu)); + } }/*
Signature · 1 line
2.53.0