Skip to contentSkip to conversation

Potential cpufreq backports for v3.10 LTS

PATCH Mark Brown 3 participants 11 messages Oct 7, 2014 CPU frequency scaling framework

lore
Share & tools
lore

Mark Brown

author
#0 lore raw

Hi,

The power management team at Linaro has had a look at the cpufreq updates since the v3.10 LTS and identified a few patches that look like they should be in there. The most recent of these is from v3.12 so they won't apply to any of the more recent stable kernels.

- 59a6342203a7a cpufreq: Fix governor start/stop race condition

This looks like a straight race condition fix.

- 19c763031acb8 cpufreq: serialize calls to __cpufreq_governor()

The commit message here outlines a scenario where this change fixes a crash which seems like stable material to me. There is a context change that needs a fixup but it's fairly trivial:

drivers/cpufreq/cpufreq.c +0 -0
diff --cc drivers/cpufreq/cpufreq.c
index c34d4423f298,7e6baa58a7f2..000000000000
@@@ -1586,8 -1692,10 +1586,9 @@@ static int __cpufreq_governor(struct cp
  						policy->cpu, event);
  
  	mutex_lock(&cpufreq_governor_lock);
- 	if ((!policy->governor_enabled && (event == CPUFREQ_GOV_STOP)) ||
 -	if (policy->governor_busy
 -	    || (policy->governor_enabled && event == CPUFREQ_GOV_START)
 -	    || (!policy->governor_enabled
 -	    && (event == CPUFREQ_GOV_LIMITS || event == CPUFREQ_GOV_STOP))) {
++	if (policy->governor_busy ||
++	    (!policy->governor_enabled && (event == CPUFREQ_GOV_STOP)) ||
 +	    (policy->governor_enabled && (event == CPUFREQ_GOV_START))) {
  		mutex_unlock(&cpufreq_governor_lock);
  		return -EBUSY;
  	}

- a857c0b9e24e3 cpufreq: Fix wrong time unit conversion

As noted in the changelog this is a bugfix for non-tick based systems like full dynticks ones.

There's also this:

- dfa5bb622555d cpufreq: ondemand: Change the calculation of target frequency

This is a small patch which delivers a useful performance improvement but it's not a bug fix and it does touch the cpufreq core so it doesn't seem to really fit. On the other hand I've got user reports that it fixes problems with some multicluster systems that can scale cluster frequencies independently (the additional stability in the frequencies selected avoids poor interaction with scheduler as cpufreq ramps the frequency while the scheduler moves load away from the cluster), it's simple and it's quite well isolated so I wanted to mention it.

Thanks,
Mark

author
#1 lore raw
Quoted 6 lines · Mark Brown

Hi,

The power management team at Linaro has had a look at the cpufreq updates since the v3.10 LTS and identified a few patches that look like they should be in there. The most recent of these is from v3.12 so they won't apply to any of the more recent stable kernels.

CCing in the actual stable list rather than the nonexistant linux-stable.

Quoted 51 lines

- 59a6342203a7a cpufreq: Fix governor start/stop race condition

This looks like a straight race condition fix.

- 19c763031acb8 cpufreq: serialize calls to __cpufreq_governor()

The commit message here outlines a scenario where this change fixes a crash which seems like stable material to me. There is a context change that needs a fixup but it's fairly trivial:

drivers/cpufreq/cpufreq.c +2 -1
diff --cc drivers/cpufreq/cpufreq.c
index c34d4423f298,7e6baa58a7f2..000000000000
@@@ -1586,8 -1692,10 +1586,9 @@@ static int __cpufreq_governor(struct cp
  						policy->cpu, event);
 
  	mutex_lock(&cpufreq_governor_lock);
- 	if ((!policy->governor_enabled && (event == CPUFREQ_GOV_STOP)) ||
 -	if (policy->governor_busy
 -	    || (policy->governor_enabled && event == CPUFREQ_GOV_START)
 -	    || (!policy->governor_enabled
 -	    && (event == CPUFREQ_GOV_LIMITS || event == CPUFREQ_GOV_STOP))) {
++	if (policy->governor_busy ||
++	    (!policy->governor_enabled && (event == CPUFREQ_GOV_STOP)) ||
 +	    (policy->governor_enabled && (event == CPUFREQ_GOV_START))) {
  		mutex_unlock(&cpufreq_governor_lock);
  		return -EBUSY;
  	}
 
 - a857c0b9e24e3 cpufreq: Fix wrong time unit conversion
 
   As noted in the changelog this is a bugfix for non-tick based
   systems like full dynticks ones.

There's also this:

- dfa5bb622555d cpufreq: ondemand: Change the calculation of target frequency

This is a small patch which delivers a useful performance improvement but it's not a bug fix and it does touch the cpufreq core so it doesn't seem to really fit. On the other hand I've got user reports that it fixes problems with some multicluster systems that can scale cluster frequencies independently (the additional stability in the frequencies selected avoids poor interaction with scheduler as cpufreq ramps the frequency while the scheduler moves load away from the cluster), it's simple and it's quite well isolated so I wanted to mention it.

Thanks,
Mark

#2 lore raw
In reply to Mark Brown
Quoted 10 lines · Mark Brown

Hi,

The power management team at Linaro has had a look at the cpufreq updates since the v3.10 LTS and identified a few patches that look like they should be in there. The most recent of these is from v3.12 so they won't apply to any of the more recent stable kernels.

- 59a6342203a7a cpufreq: Fix governor start/stop race condition

This looks like a straight race condition fix.

That is not a commit id in Linus's tree :(

author
#3 lore raw
Quoted 7 lines · Greg Kroah-Hartman
Quoted 4 lines · Mark Brown

The power management team at Linaro has had a look at the cpufreq updates since the v3.10 LTS and identified a few patches that look like they should be in there. The most recent of these is from v3.12 so they won't apply to any of the more recent stable kernels.

Quoted 5 lines
Quoted 3 lines

- 59a6342203a7a cpufreq: Fix governor start/stop race condition

This looks like a straight race condition fix.

That is not a commit id in Linus's tree :(

Interesting, I was able to cherry-pick it... looks like the upstream version is 95731eb. In any case at roughly the same time you sent your mail it's been drawn to my attention off-list that this was subsequently reverted so please ignore this one. The others should be fine though.

#4 lore raw
Quoted 10 lines · Mark Brown
Quoted 8 lines · Greg Kroah-Hartman
Quoted 6 lines · Mark Brown

The power management team at Linaro has had a look at the cpufreq updates since the v3.10 LTS and identified a few patches that look like they should be in there. The most recent of these is from v3.12 so they won't apply to any of the more recent stable kernels.

- 59a6342203a7a cpufreq: Fix governor start/stop race condition

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

This looks like a straight race condition fix.

That is not a commit id in Linus's tree :(

Interesting, I was able to cherry-pick it... looks like the upstream version is 95731eb. In any case at roughly the same time you sent your mail it's been drawn to my attention off-list that this was subsequently reverted so please ignore this one. The others should be fine though.

Ok, I've queued the others up now.

thanks,

greg k-h

author
#5 lore raw
Quoted 6 lines · Greg Kroah-Hartman
Quoted 3 lines · Mark Brown
Quoted 3 lines
Quoted 3 lines

- 59a6342203a7a cpufreq: Fix governor start/stop race condition

This looks like a straight race condition fix.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

That is not a commit id in Linus's tree :(

Interesting, I was able to cherry-pick it... looks like the upstream version is 95731eb. In any case at roughly the same time you sent your mail it's been drawn to my attention off-list that this was subsequently reverted so please ignore this one. The others should be fine though.

Ok, I've queued the others up now.

Actually I thinkoed here, as I said in reply to the stable mail the problematic patch was "19c763031acb8 cpufreq: serialize calls to __cpufreq_governor()" which was reverted in "56d07db cpufreq: Remove temporary fix for race between CPU hotplug and sysfs-writes". The above commit ID (95731eb) should be good.

Sorry about the confusion here.

#6 lore raw
Quoted 16 lines · Mark Brown
Quoted 6 lines · Greg Kroah-Hartman
Quoted 3 lines · Mark Brown
Quoted 3 lines
Quoted 3 lines

- 59a6342203a7a cpufreq: Fix governor start/stop race condition

This looks like a straight race condition fix.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

That is not a commit id in Linus's tree :(

Interesting, I was able to cherry-pick it... looks like the upstream version is 95731eb. In any case at roughly the same time you sent your mail it's been drawn to my attention off-list that this was subsequently reverted so please ignore this one. The others should be fine though.

Ok, I've queued the others up now.

Quoted 7 lines

Actually I thinkoed here, as I said in reply to the stable mail the problematic patch was "19c763031acb8 cpufreq: serialize calls to __cpufreq_governor()" which was reverted in "56d07db cpufreq: Remove temporary fix for race between CPU hotplug and sysfs-writes". The above commit ID (95731eb) should be good.

Sorry about the confusion here.

Ok, I'm still confused. I've applied 3 patches to the 3.10-stable queue, in this order:

	19c763031acb831a5ab9c1a701b7fedda073eb3f	cpufreq: serialize calls to __cpufreq_governor()
	a857c0b9e24e39fe5be82451b65377795f9538d8	cpufreq: Fix wrong time unit conversion
	dfa5bb622555d9da0df21b50f46ebdeef390041b	cpufreq: ondemand: Change the calculation of target frequency

Are those correct? Is there anything else I need to apply?

Note, 95731eb does not apply to 3.10-stable as it is already in there, it showed up in 3.10.37.

thanks,

greg k-h

author
#7 lore raw
Quoted 8 lines · Greg Kroah-Hartman
Quoted 5 lines · Mark Brown

Actually I thinkoed here, as I said in reply to the stable mail the problematic patch was "19c763031acb8 cpufreq: serialize calls to __cpufreq_governor()" which was reverted in "56d07db cpufreq: Remove temporary fix for race between CPU hotplug and sysfs-writes". The above commit ID (95731eb) should be good.

Quoted 4 lines
Quoted 1 line

Sorry about the confusion here.

Ok, I'm still confused. I've applied 3 patches to the 3.10-stable queue, in this order:

To the best of my ability to assess:

Quoted 1 line
	19c763031acb831a5ab9c1a701b7fedda073eb3f	cpufreq: serialize calls to __cpufreq_governor()

This one is bad.

Quoted 2 lines
	a857c0b9e24e39fe5be82451b65377795f9538d8	cpufreq: Fix wrong time unit conversion
	dfa5bb622555d9da0df21b50f46ebdeef390041b	cpufreq: ondemand: Change the calculation of target frequency

These two should be good.

Quoted 4 lines

Are those correct? Is there anything else I need to apply?

Note, 95731eb does not apply to 3.10-stable as it is already in there, it showed up in 3.10.37.

Ah, good - I think whatever made my cut'n'paste of the commit ID go wrong will have been responsible for making my search for it fail.

#8 lore raw
Quoted 11 lines · Mark Brown
Quoted 9 lines · Greg Kroah-Hartman
Quoted 7 lines · Mark Brown

Actually I thinkoed here, as I said in reply to the stable mail the problematic patch was "19c763031acb8 cpufreq: serialize calls to __cpufreq_governor()" which was reverted in "56d07db cpufreq: Remove temporary fix for race between CPU hotplug and sysfs-writes". The above commit ID (95731eb) should be good.

Sorry about the confusion here.

Quoted 8 lines
Quoted 2 lines

Ok, I'm still confused. I've applied 3 patches to the 3.10-stable queue, in this order:

To the best of my ability to assess:

Quoted 1 line
	19c763031acb831a5ab9c1a701b7fedda073eb3f	cpufreq: serialize calls to __cpufreq_governor()

This one is bad.

Ok, now deleted, thanks for letting me know.

greg k-h

#9 lore raw
In reply to Greg Kroah-Hartman

Hi,

Quoted 13 lines · Greg Kroah-Hartman
Quoted 12 lines · Mark Brown
Quoted 10 lines · Greg Kroah-Hartman
Quoted 8 lines · Mark Brown

The power management team at Linaro has had a look at the cpufreq updates since the v3.10 LTS and identified a few patches that look like they should be in there. The most recent of these is from v3.12 so they won't apply to any of the more recent stable kernels.

- 59a6342203a7a cpufreq: Fix governor start/stop race condition

This looks like a straight race condition fix.

Quoted 9 lines
Quoted 6 lines
Quoted 1 line

That is not a commit id in Linus's tree :(

Interesting, I was able to cherry-pick it... looks like the upstream version is 95731eb. In any case at roughly the same time you sent your mail it's been drawn to my attention off-list that this was subsequently reverted so please ignore this one. The others should be fine though.

Ok, I've queued the others up now.

For your information, commits:

- 61c63e5ed3b9 cpufreq: Remove unused APERF/MPERF support
- cffe4e0e7413 cpufreq: Remove unused function __cpufreq_driver_getavg()

remove unused code (no other functional changes) as a result of commit dfa5bb622555. They all were part of the same patch set.

I'm not familiar with the procedure of patch inclusion in stable trees, so please forgive me if this mail is just noise.

Thanks,
Stratos

author
#10 lore raw
Quoted 10 lines · Stratos Karafotis

For your information, commits:

- 61c63e5ed3b9 cpufreq: Remove unused APERF/MPERF support
- cffe4e0e7413 cpufreq: Remove unused function __cpufreq_driver_getavg()

remove unused code (no other functional changes) as a result of commit dfa5bb622555. They all were part of the same patch set.

I'm not familiar with the procedure of patch inclusion in stable trees, so please forgive me if this mail is just noise.

If they're just cleanups and not producing a functional change then the standard thing would be to leave them out of stable.