Linux kernel -stable discussions
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] cpufreq: Reference count policy in cpufreq_update_limits()" failed to apply to 6.14-stable tree
@ 2025-04-17 13:28 gregkh
  2025-04-17 23:52 ` Marek Marczykowski-Górecki
  2025-04-18  2:15 ` [PATCH 6.14.y and others] cpufreq: Reference count policy in cpufreq_update_limits() Marek Marczykowski-Górecki
  0 siblings, 2 replies; 6+ messages in thread
From: gregkh @ 2025-04-17 13:28 UTC (permalink / raw)
  To: rafael.j.wysocki, marmarek, stable, viresh.kumar; +Cc: stable


The patch below does not apply to the 6.14-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 <stable@vger.kernel.org>.

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-6.14.y
git checkout FETCH_HEAD
git cherry-pick -x 9e4e249018d208678888bdf22f6b652728106528
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2025041714-stoke-unripe-5956@gregkh' --subject-prefix 'PATCH 6.14.y' HEAD^..

Possible dependencies:



thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 9e4e249018d208678888bdf22f6b652728106528 Mon Sep 17 00:00:00 2001
From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
Date: Fri, 28 Mar 2025 21:39:08 +0100
Subject: [PATCH] cpufreq: Reference count policy in cpufreq_update_limits()
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Since acpi_processor_notify() can be called before registering a cpufreq
driver or even in cases when a cpufreq driver is not registered at all,
cpufreq_update_limits() needs to check if a cpufreq driver is present
and prevent it from being unregistered.

For this purpose, make it call cpufreq_cpu_get() to obtain a cpufreq
policy pointer for the given CPU and reference count the corresponding
policy object, if present.

Fixes: 5a25e3f7cc53 ("cpufreq: intel_pstate: Driver-specific handling of _PPC updates")
Closes: https://lore.kernel.org/linux-acpi/Z-ShAR59cTow0KcR@mail-itl
Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://patch.msgid.link/1928789.tdWV9SEqCh@rjwysocki.net

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 0cf5a320bb5e..3841c9da6cac 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2809,6 +2809,12 @@ EXPORT_SYMBOL(cpufreq_update_policy);
  */
 void cpufreq_update_limits(unsigned int cpu)
 {
+	struct cpufreq_policy *policy __free(put_cpufreq_policy);
+
+	policy = cpufreq_cpu_get(cpu);
+	if (!policy)
+		return;
+
 	if (cpufreq_driver->update_limits)
 		cpufreq_driver->update_limits(cpu);
 	else


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: FAILED: patch "[PATCH] cpufreq: Reference count policy in cpufreq_update_limits()" failed to apply to 6.14-stable tree
  2025-04-17 13:28 FAILED: patch "[PATCH] cpufreq: Reference count policy in cpufreq_update_limits()" failed to apply to 6.14-stable tree gregkh
@ 2025-04-17 23:52 ` Marek Marczykowski-Górecki
  2025-04-18  1:51   ` Marek Marczykowski-Górecki
  2025-04-18  2:15 ` [PATCH 6.14.y and others] cpufreq: Reference count policy in cpufreq_update_limits() Marek Marczykowski-Górecki
  1 sibling, 1 reply; 6+ messages in thread
From: Marek Marczykowski-Górecki @ 2025-04-17 23:52 UTC (permalink / raw)
  To: gregkh; +Cc: rafael.j.wysocki, stable, viresh.kumar

[-- Attachment #1: Type: text/plain, Size: 3006 bytes --]

On Thu, Apr 17, 2025 at 03:28:14PM +0200, gregkh@linuxfoundation.org wrote:
> 
> The patch below does not apply to the 6.14-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 <stable@vger.kernel.org>.
> 
> To reproduce the conflict and resubmit, you may use the following commands:

What specifically the conflict is? For me it applies cleanly, both on
top of v6.14.2 and v6.14.3-rc1...
And same for 6.12 branch, I haven't checked others.

> git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.14.y
> git checkout FETCH_HEAD
> git cherry-pick -x 9e4e249018d208678888bdf22f6b652728106528
> # <resolve conflicts, build, test, etc.>
> git commit -s
> git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2025041714-stoke-unripe-5956@gregkh' --subject-prefix 'PATCH 6.14.y' HEAD^..
> 
> Possible dependencies:
> 
> 
> 
> thanks,
> 
> greg k-h
> 
> ------------------ original commit in Linus's tree ------------------
> 
> From 9e4e249018d208678888bdf22f6b652728106528 Mon Sep 17 00:00:00 2001
> From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
> Date: Fri, 28 Mar 2025 21:39:08 +0100
> Subject: [PATCH] cpufreq: Reference count policy in cpufreq_update_limits()
> MIME-Version: 1.0
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: 8bit
> 
> Since acpi_processor_notify() can be called before registering a cpufreq
> driver or even in cases when a cpufreq driver is not registered at all,
> cpufreq_update_limits() needs to check if a cpufreq driver is present
> and prevent it from being unregistered.
> 
> For this purpose, make it call cpufreq_cpu_get() to obtain a cpufreq
> policy pointer for the given CPU and reference count the corresponding
> policy object, if present.
> 
> Fixes: 5a25e3f7cc53 ("cpufreq: intel_pstate: Driver-specific handling of _PPC updates")
> Closes: https://lore.kernel.org/linux-acpi/Z-ShAR59cTow0KcR@mail-itl
> Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> Cc: All applicable <stable@vger.kernel.org>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> Link: https://patch.msgid.link/1928789.tdWV9SEqCh@rjwysocki.net
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 0cf5a320bb5e..3841c9da6cac 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -2809,6 +2809,12 @@ EXPORT_SYMBOL(cpufreq_update_policy);
>   */
>  void cpufreq_update_limits(unsigned int cpu)
>  {
> +	struct cpufreq_policy *policy __free(put_cpufreq_policy);
> +
> +	policy = cpufreq_cpu_get(cpu);
> +	if (!policy)
> +		return;
> +
>  	if (cpufreq_driver->update_limits)
>  		cpufreq_driver->update_limits(cpu);
>  	else
> 

-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: FAILED: patch "[PATCH] cpufreq: Reference count policy in cpufreq_update_limits()" failed to apply to 6.14-stable tree
  2025-04-17 23:52 ` Marek Marczykowski-Górecki
@ 2025-04-18  1:51   ` Marek Marczykowski-Górecki
  0 siblings, 0 replies; 6+ messages in thread
From: Marek Marczykowski-Górecki @ 2025-04-18  1:51 UTC (permalink / raw)
  To: gregkh; +Cc: rafael.j.wysocki, stable, viresh.kumar

[-- Attachment #1: Type: text/plain, Size: 3507 bytes --]

On Fri, Apr 18, 2025 at 01:52:07AM +0200, Marek Marczykowski-Górecki wrote:
> On Thu, Apr 17, 2025 at 03:28:14PM +0200, gregkh@linuxfoundation.org wrote:
> > 
> > The patch below does not apply to the 6.14-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 <stable@vger.kernel.org>.
> > 
> > To reproduce the conflict and resubmit, you may use the following commands:
> 
> What specifically the conflict is? For me it applies cleanly, both on
> top of v6.14.2 and v6.14.3-rc1...
> And same for 6.12 branch, I haven't checked others.

Ah, I see, it fails to build as it depends on
97a705dc1a3654d8d2e466433a897be202a7f0ac (the part about DEFINE_FREE).
A backport without this dependency is easy, I'll post it in a moment.

> > git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.14.y
> > git checkout FETCH_HEAD
> > git cherry-pick -x 9e4e249018d208678888bdf22f6b652728106528
> > # <resolve conflicts, build, test, etc.>
> > git commit -s
> > git send-email --to '<stable@vger.kernel.org>' --in-reply-to '2025041714-stoke-unripe-5956@gregkh' --subject-prefix 'PATCH 6.14.y' HEAD^..
> > 
> > Possible dependencies:
> > 
> > 
> > 
> > thanks,
> > 
> > greg k-h
> > 
> > ------------------ original commit in Linus's tree ------------------
> > 
> > From 9e4e249018d208678888bdf22f6b652728106528 Mon Sep 17 00:00:00 2001
> > From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
> > Date: Fri, 28 Mar 2025 21:39:08 +0100
> > Subject: [PATCH] cpufreq: Reference count policy in cpufreq_update_limits()
> > MIME-Version: 1.0
> > Content-Type: text/plain; charset=UTF-8
> > Content-Transfer-Encoding: 8bit
> > 
> > Since acpi_processor_notify() can be called before registering a cpufreq
> > driver or even in cases when a cpufreq driver is not registered at all,
> > cpufreq_update_limits() needs to check if a cpufreq driver is present
> > and prevent it from being unregistered.
> > 
> > For this purpose, make it call cpufreq_cpu_get() to obtain a cpufreq
> > policy pointer for the given CPU and reference count the corresponding
> > policy object, if present.
> > 
> > Fixes: 5a25e3f7cc53 ("cpufreq: intel_pstate: Driver-specific handling of _PPC updates")
> > Closes: https://lore.kernel.org/linux-acpi/Z-ShAR59cTow0KcR@mail-itl
> > Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> > Cc: All applicable <stable@vger.kernel.org>
> > Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> > Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> > Link: https://patch.msgid.link/1928789.tdWV9SEqCh@rjwysocki.net
> > 
> > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> > index 0cf5a320bb5e..3841c9da6cac 100644
> > --- a/drivers/cpufreq/cpufreq.c
> > +++ b/drivers/cpufreq/cpufreq.c
> > @@ -2809,6 +2809,12 @@ EXPORT_SYMBOL(cpufreq_update_policy);
> >   */
> >  void cpufreq_update_limits(unsigned int cpu)
> >  {
> > +	struct cpufreq_policy *policy __free(put_cpufreq_policy);
> > +
> > +	policy = cpufreq_cpu_get(cpu);
> > +	if (!policy)
> > +		return;
> > +
> >  	if (cpufreq_driver->update_limits)
> >  		cpufreq_driver->update_limits(cpu);
> >  	else
> > 
> 
> -- 
> Best Regards,
> Marek Marczykowski-Górecki
> Invisible Things Lab



-- 
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 6.14.y and others] cpufreq: Reference count policy in cpufreq_update_limits()
  2025-04-17 13:28 FAILED: patch "[PATCH] cpufreq: Reference count policy in cpufreq_update_limits()" failed to apply to 6.14-stable tree gregkh
  2025-04-17 23:52 ` Marek Marczykowski-Górecki
@ 2025-04-18  2:15 ` Marek Marczykowski-Górecki
  2025-04-19 11:50   ` Sasha Levin
  2025-04-19 15:31   ` Wysocki, Rafael J
  1 sibling, 2 replies; 6+ messages in thread
From: Marek Marczykowski-Górecki @ 2025-04-18  2:15 UTC (permalink / raw)
  To: stable; +Cc: Rafael J. Wysocki, Marek Marczykowski-Górecki, Viresh Kumar

From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>

Since acpi_processor_notify() can be called before registering a cpufreq
driver or even in cases when a cpufreq driver is not registered at all,
cpufreq_update_limits() needs to check if a cpufreq driver is present
and prevent it from being unregistered.

For this purpose, make it call cpufreq_cpu_get() to obtain a cpufreq
policy pointer for the given CPU and reference count the corresponding
policy object, if present.

Fixes: 5a25e3f7cc53 ("cpufreq: intel_pstate: Driver-specific handling of _PPC updates")
Closes: https://lore.kernel.org/linux-acpi/Z-ShAR59cTow0KcR@mail-itl
Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
Cc: All applicable <stable@vger.kernel.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://patch.msgid.link/1928789.tdWV9SEqCh@rjwysocki.net
(cherry picked from commit 9e4e249018d208678888bdf22f6b652728106528)
[do not use __free(cpufreq_cpu_put) in a backport]
Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
---
This patch is applicable to other stable branches too.
---
 drivers/cpufreq/cpufreq.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 30ffbddc7ece..934e0e19824c 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -2762,10 +2762,18 @@ EXPORT_SYMBOL(cpufreq_update_policy);
  */
 void cpufreq_update_limits(unsigned int cpu)
 {
+	struct cpufreq_policy *policy;
+
+	policy = cpufreq_cpu_get(cpu);
+	if (!policy)
+		return;
+
 	if (cpufreq_driver->update_limits)
 		cpufreq_driver->update_limits(cpu);
 	else
 		cpufreq_update_policy(cpu);
+
+	cpufreq_cpu_put(policy);
 }
 EXPORT_SYMBOL_GPL(cpufreq_update_limits);
 
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 6.14.y and others] cpufreq: Reference count policy in cpufreq_update_limits()
  2025-04-18  2:15 ` [PATCH 6.14.y and others] cpufreq: Reference count policy in cpufreq_update_limits() Marek Marczykowski-Górecki
@ 2025-04-19 11:50   ` Sasha Levin
  2025-04-19 15:31   ` Wysocki, Rafael J
  1 sibling, 0 replies; 6+ messages in thread
From: Sasha Levin @ 2025-04-19 11:50 UTC (permalink / raw)
  To: stable, marmarek; +Cc: Sasha Levin

[ Sasha's backport helper bot ]

Hi,

Summary of potential issues:
⚠️ Found matching upstream commit but patch is missing proper reference to it

Found matching upstream commit: 9e4e249018d208678888bdf22f6b652728106528

WARNING: Author mismatch between patch and found commit:
Backport author: <marmarek@invisiblethingslab.com>
Commit author: Rafael J. Wysocki<rafael.j.wysocki@intel.com>

Note: The patch differs from the upstream commit:
---
1:  9e4e249018d20 ! 1:  cd95c6b965176 cpufreq: Reference count policy in cpufreq_update_limits()
    @@ Commit message
         Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
         Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
         Link: https://patch.msgid.link/1928789.tdWV9SEqCh@rjwysocki.net
    +    (cherry picked from commit 9e4e249018d208678888bdf22f6b652728106528)
    +    [do not use __free(cpufreq_cpu_put) in a backport]
    +    Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
     
      ## drivers/cpufreq/cpufreq.c ##
     @@ drivers/cpufreq/cpufreq.c: EXPORT_SYMBOL(cpufreq_update_policy);
       */
      void cpufreq_update_limits(unsigned int cpu)
      {
    -+	struct cpufreq_policy *policy __free(put_cpufreq_policy);
    ++	struct cpufreq_policy *policy;
     +
     +	policy = cpufreq_cpu_get(cpu);
     +	if (!policy)
    @@ drivers/cpufreq/cpufreq.c: EXPORT_SYMBOL(cpufreq_update_policy);
      	if (cpufreq_driver->update_limits)
      		cpufreq_driver->update_limits(cpu);
      	else
    + 		cpufreq_update_policy(cpu);
    ++
    ++	cpufreq_cpu_put(policy);
    + }
    + EXPORT_SYMBOL_GPL(cpufreq_update_limits);
    + 
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.14.y       |  Success    |  Success   |

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 6.14.y and others] cpufreq: Reference count policy in cpufreq_update_limits()
  2025-04-18  2:15 ` [PATCH 6.14.y and others] cpufreq: Reference count policy in cpufreq_update_limits() Marek Marczykowski-Górecki
  2025-04-19 11:50   ` Sasha Levin
@ 2025-04-19 15:31   ` Wysocki, Rafael J
  1 sibling, 0 replies; 6+ messages in thread
From: Wysocki, Rafael J @ 2025-04-19 15:31 UTC (permalink / raw)
  To: Marek Marczykowski-Górecki, stable; +Cc: Viresh Kumar

On 4/18/2025 4:15 AM, Marek Marczykowski-Górecki wrote:
> From: "Rafael J. Wysocki" <rafael.j.wysocki@intel.com>
>
> Since acpi_processor_notify() can be called before registering a cpufreq
> driver or even in cases when a cpufreq driver is not registered at all,
> cpufreq_update_limits() needs to check if a cpufreq driver is present
> and prevent it from being unregistered.
>
> For this purpose, make it call cpufreq_cpu_get() to obtain a cpufreq
> policy pointer for the given CPU and reference count the corresponding
> policy object, if present.
>
> Fixes: 5a25e3f7cc53 ("cpufreq: intel_pstate: Driver-specific handling of _PPC updates")
> Closes: https://lore.kernel.org/linux-acpi/Z-ShAR59cTow0KcR@mail-itl
> Reported-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> Cc: All applicable <stable@vger.kernel.org>
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
> Link: https://patch.msgid.link/1928789.tdWV9SEqCh@rjwysocki.net
> (cherry picked from commit 9e4e249018d208678888bdf22f6b652728106528)
> [do not use __free(cpufreq_cpu_put) in a backport]
> Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
> ---
> This patch is applicable to other stable branches too.

Thanks a lot for taking care of backporting it!


> ---
>   drivers/cpufreq/cpufreq.c | 8 ++++++++
>   1 file changed, 8 insertions(+)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 30ffbddc7ece..934e0e19824c 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -2762,10 +2762,18 @@ EXPORT_SYMBOL(cpufreq_update_policy);
>    */
>   void cpufreq_update_limits(unsigned int cpu)
>   {
> +	struct cpufreq_policy *policy;
> +
> +	policy = cpufreq_cpu_get(cpu);
> +	if (!policy)
> +		return;
> +
>   	if (cpufreq_driver->update_limits)
>   		cpufreq_driver->update_limits(cpu);
>   	else
>   		cpufreq_update_policy(cpu);
> +
> +	cpufreq_cpu_put(policy);
>   }
>   EXPORT_SYMBOL_GPL(cpufreq_update_limits);
>   

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-04-19 15:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-17 13:28 FAILED: patch "[PATCH] cpufreq: Reference count policy in cpufreq_update_limits()" failed to apply to 6.14-stable tree gregkh
2025-04-17 23:52 ` Marek Marczykowski-Górecki
2025-04-18  1:51   ` Marek Marczykowski-Górecki
2025-04-18  2:15 ` [PATCH 6.14.y and others] cpufreq: Reference count policy in cpufreq_update_limits() Marek Marczykowski-Górecki
2025-04-19 11:50   ` Sasha Levin
2025-04-19 15:31   ` Wysocki, Rafael J

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox