Skip to content

Commit 19c1940

Browse files
committed
Merge tag 'pm+acpi-3.16-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm
Pull more ACPI and power management updates from Rafael Wysocki: "These are fixups on top of the previous PM+ACPI pull request, regression fixes (ACPI hotplug, cpufreq ppc-corenet), other bug fixes (ACPI reset, cpufreq), new PM trace points for system suspend profiling and a copyright notice update. Specifics: - I didn't remember correctly that the Hans de Goede's ACPI video patches actually didn't flip the video.use_native_backlight default, although we had discussed that and decided to do that. Since I said we would do that in the previous PM+ACPI pull request, make that change for real now. - ACPI bus check notifications for PCI host bridges don't cause the bus below the host bridge to be checked for changes as they should because of a mistake in the ACPI-based PCI hotplug (ACPIPHP) subsystem that forgets to add hotplug contexts to PCI host bridge ACPI device objects. Create hotplug contexts for PCI host bridges too as appropriate. - Revert recent cpufreq commit related to the big.LITTLE cpufreq driver that breaks arm64 builds. - Fix for a regression in the ppc-corenet cpufreq driver introduced during the 3.15 cycle and causing the driver to use the remainder from do_div instead of the quotient. From Ed Swarthout. - Resets triggered by panic activate a BUG_ON() in vmalloc.c on systems where the ACPI reset register is located in memory address space. Fix from Randy Wright. - Fix for a problem with cpufreq governors that decisions made by them may be suboptimal due to the fact that deferrable timers are used by them for CPU load sampling. From Srivatsa S Bhat. - Fix for a problem with the Tegra cpufreq driver where the CPU frequency is temporarily switched to a "stable" level that is different from both the initial and target frequencies during transitions which causes udelay() to expire earlier than it should sometimes. From Viresh Kumar. - New trace points and rework of some existing trace points for system suspend/resume profiling from Todd Brandt. - Assorted cpufreq fixes and cleanups from Stratos Karafotis and Viresh Kumar. - Copyright notice update for suspend-and-cpuhotplug.txt from Srivatsa S Bhat" * tag 'pm+acpi-3.16-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: ACPI / hotplug / PCI: Add hotplug contexts to PCI host bridges PM / sleep: trace events for device PM callbacks cpufreq: cpufreq-cpu0: remove dependency on THERMAL and REGULATOR cpufreq: tegra: update comment for clarity cpufreq: intel_pstate: Remove duplicate CPU ID check cpufreq: Mark CPU0 driver with CPUFREQ_NEED_INITIAL_FREQ_CHECK flag PM / Documentation: Update copyright in suspend-and-cpuhotplug.txt cpufreq: governor: remove copy_prev_load from 'struct cpu_dbs_common_info' cpufreq: governor: Be friendly towards latency-sensitive bursty workloads PM / sleep: trace events for suspend/resume cpufreq: ppc-corenet-cpu-freq: do_div use quotient Revert "cpufreq: Enable big.LITTLE cpufreq driver on arm64" cpufreq: Tegra: implement intermediate frequency callbacks cpufreq: add support for intermediate (stable) frequencies ACPI / video: Change the default for video.use_native_backlight to 1 ACPI: Fix bug when ACPI reset register is implemented in system memory
2 parents 7c574cf + d715a22 commit 19c1940

24 files changed

Lines changed: 437 additions & 113 deletions

‎Documentation/cpu-freq/cpu-drivers.txt‎

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Contents:
2626
1.4 target/target_index or setpolicy?
2727
1.5 target/target_index
2828
1.6 setpolicy
29+
1.7 get_intermediate and target_intermediate
2930
2. Frequency Table Helpers
3031

3132

@@ -79,6 +80,10 @@ cpufreq_driver.attr - A pointer to a NULL-terminated list of
7980
"struct freq_attr" which allow to
8081
export values to sysfs.
8182

83+
cpufreq_driver.get_intermediate
84+
and target_intermediate Used to switch to stable frequency while
85+
changing CPU frequency.
86+
8287

8388
1.2 Per-CPU Initialization
8489
--------------------------
@@ -151,7 +156,7 @@ Some cpufreq-capable processors switch the frequency between certain
151156
limits on their own. These shall use the ->setpolicy call
152157

153158

154-
1.4. target/target_index
159+
1.5. target/target_index
155160
-------------
156161

157162
The target_index call has two arguments: struct cpufreq_policy *policy,
@@ -160,6 +165,9 @@ and unsigned int index (into the exposed frequency table).
160165
The CPUfreq driver must set the new frequency when called here. The
161166
actual frequency must be determined by freq_table[index].frequency.
162167

168+
It should always restore to earlier frequency (i.e. policy->restore_freq) in
169+
case of errors, even if we switched to intermediate frequency earlier.
170+
163171
Deprecated:
164172
----------
165173
The target call has three arguments: struct cpufreq_policy *policy,
@@ -179,7 +187,7 @@ Here again the frequency table helper might assist you - see section 2
179187
for details.
180188

181189

182-
1.5 setpolicy
190+
1.6 setpolicy
183191
---------------
184192

185193
The setpolicy call only takes a struct cpufreq_policy *policy as
@@ -190,6 +198,23 @@ setting when policy->policy is CPUFREQ_POLICY_PERFORMANCE, and a
190198
powersaving-oriented setting when CPUFREQ_POLICY_POWERSAVE. Also check
191199
the reference implementation in drivers/cpufreq/longrun.c
192200

201+
1.7 get_intermediate and target_intermediate
202+
--------------------------------------------
203+
204+
Only for drivers with target_index() and CPUFREQ_ASYNC_NOTIFICATION unset.
205+
206+
get_intermediate should return a stable intermediate frequency platform wants to
207+
switch to, and target_intermediate() should set CPU to to that frequency, before
208+
jumping to the frequency corresponding to 'index'. Core will take care of
209+
sending notifications and driver doesn't have to handle them in
210+
target_intermediate() or target_index().
211+
212+
Drivers can return '0' from get_intermediate() in case they don't wish to switch
213+
to intermediate frequency for some target frequency. In that case core will
214+
directly call ->target_index().
215+
216+
NOTE: ->target_index() should restore to policy->restore_freq in case of
217+
failures as core would send notifications for that.
193218

194219

195220
2. Frequency Table Helpers

‎Documentation/power/suspend-and-cpuhotplug.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Interaction of Suspend code (S3) with the CPU hotplug infrastructure
22

3-
(C) 2011 Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
3+
(C) 2011 - 2014 Srivatsa S. Bhat <srivatsa.bhat@linux.vnet.ibm.com>
44

55

66
I. How does the regular CPU hotplug code differ from how the Suspend-to-RAM

‎drivers/acpi/osl.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1810,6 +1810,16 @@ acpi_status __init acpi_os_initialize(void)
18101810
acpi_os_map_generic_address(&acpi_gbl_FADT.xpm1b_event_block);
18111811
acpi_os_map_generic_address(&acpi_gbl_FADT.xgpe0_block);
18121812
acpi_os_map_generic_address(&acpi_gbl_FADT.xgpe1_block);
1813+
if (acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER) {
1814+
/*
1815+
* Use acpi_os_map_generic_address to pre-map the reset
1816+
* register if it's in system memory.
1817+
*/
1818+
int rv;
1819+
1820+
rv = acpi_os_map_generic_address(&acpi_gbl_FADT.reset_register);
1821+
pr_debug(PREFIX "%s: map reset_reg status %d\n", __func__, rv);
1822+
}
18131823

18141824
return AE_OK;
18151825
}
@@ -1838,6 +1848,8 @@ acpi_status acpi_os_terminate(void)
18381848
acpi_os_unmap_generic_address(&acpi_gbl_FADT.xgpe0_block);
18391849
acpi_os_unmap_generic_address(&acpi_gbl_FADT.xpm1b_event_block);
18401850
acpi_os_unmap_generic_address(&acpi_gbl_FADT.xpm1a_event_block);
1851+
if (acpi_gbl_FADT.flags & ACPI_FADT_RESET_REGISTER)
1852+
acpi_os_unmap_generic_address(&acpi_gbl_FADT.reset_register);
18411853

18421854
destroy_workqueue(kacpid_wq);
18431855
destroy_workqueue(kacpi_notify_wq);

‎drivers/acpi/sleep.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <linux/acpi.h>
2020
#include <linux/module.h>
2121
#include <asm/io.h>
22+
#include <trace/events/power.h>
2223

2324
#include "internal.h"
2425
#include "sleep.h"
@@ -501,6 +502,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
501502

502503
ACPI_FLUSH_CPU_CACHE();
503504

505+
trace_suspend_resume(TPS("acpi_suspend"), acpi_state, true);
504506
switch (acpi_state) {
505507
case ACPI_STATE_S1:
506508
barrier();
@@ -516,6 +518,7 @@ static int acpi_suspend_enter(suspend_state_t pm_state)
516518
pr_info(PREFIX "Low-level resume complete\n");
517519
break;
518520
}
521+
trace_suspend_resume(TPS("acpi_suspend"), acpi_state, false);
519522

520523
/* This violates the spec but is required for bug compatibility. */
521524
acpi_write_bit_register(ACPI_BITREG_SCI_ENABLE, 1);

‎drivers/acpi/video.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ module_param(allow_duplicates, bool, 0644);
8282
* For Windows 8 systems: used to decide if video module
8383
* should skip registering backlight interface of its own.
8484
*/
85-
static int use_native_backlight_param = -1;
85+
static int use_native_backlight_param = 1;
8686
module_param_named(use_native_backlight, use_native_backlight_param, int, 0444);
8787
static bool use_native_backlight_dmi = false;
8888

‎drivers/base/power/main.c‎

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -214,9 +214,6 @@ static void initcall_debug_report(struct device *dev, ktime_t calltime,
214214
pr_info("call %s+ returned %d after %Ld usecs\n", dev_name(dev),
215215
error, (unsigned long long)nsecs >> 10);
216216
}
217-
218-
trace_device_pm_report_time(dev, info, nsecs, pm_verb(state.event),
219-
error);
220217
}
221218

222219
/**
@@ -387,7 +384,9 @@ static int dpm_run_callback(pm_callback_t cb, struct device *dev,
387384
calltime = initcall_debug_start(dev);
388385

389386
pm_dev_dbg(dev, state, info);
387+
trace_device_pm_callback_start(dev, info, state.event);
390388
error = cb(dev);
389+
trace_device_pm_callback_end(dev, error);
391390
suspend_report_result(cb, error);
392391

393392
initcall_debug_report(dev, calltime, error, state, info);
@@ -545,6 +544,7 @@ static void dpm_resume_noirq(pm_message_t state)
545544
struct device *dev;
546545
ktime_t starttime = ktime_get();
547546

547+
trace_suspend_resume(TPS("dpm_resume_noirq"), state.event, true);
548548
mutex_lock(&dpm_list_mtx);
549549
pm_transition = state;
550550

@@ -587,6 +587,7 @@ static void dpm_resume_noirq(pm_message_t state)
587587
dpm_show_time(starttime, state, "noirq");
588588
resume_device_irqs();
589589
cpuidle_resume();
590+
trace_suspend_resume(TPS("dpm_resume_noirq"), state.event, false);
590591
}
591592

592593
/**
@@ -664,6 +665,7 @@ static void dpm_resume_early(pm_message_t state)
664665
struct device *dev;
665666
ktime_t starttime = ktime_get();
666667

668+
trace_suspend_resume(TPS("dpm_resume_early"), state.event, true);
667669
mutex_lock(&dpm_list_mtx);
668670
pm_transition = state;
669671

@@ -703,6 +705,7 @@ static void dpm_resume_early(pm_message_t state)
703705
mutex_unlock(&dpm_list_mtx);
704706
async_synchronize_full();
705707
dpm_show_time(starttime, state, "early");
708+
trace_suspend_resume(TPS("dpm_resume_early"), state.event, false);
706709
}
707710

708711
/**
@@ -834,6 +837,7 @@ void dpm_resume(pm_message_t state)
834837
struct device *dev;
835838
ktime_t starttime = ktime_get();
836839

840+
trace_suspend_resume(TPS("dpm_resume"), state.event, true);
837841
might_sleep();
838842

839843
mutex_lock(&dpm_list_mtx);
@@ -875,6 +879,7 @@ void dpm_resume(pm_message_t state)
875879
dpm_show_time(starttime, state, NULL);
876880

877881
cpufreq_resume();
882+
trace_suspend_resume(TPS("dpm_resume"), state.event, false);
878883
}
879884

880885
/**
@@ -913,7 +918,9 @@ static void device_complete(struct device *dev, pm_message_t state)
913918

914919
if (callback) {
915920
pm_dev_dbg(dev, state, info);
921+
trace_device_pm_callback_start(dev, info, state.event);
916922
callback(dev);
923+
trace_device_pm_callback_end(dev, 0);
917924
}
918925

919926
device_unlock(dev);
@@ -932,6 +939,7 @@ void dpm_complete(pm_message_t state)
932939
{
933940
struct list_head list;
934941

942+
trace_suspend_resume(TPS("dpm_complete"), state.event, true);
935943
might_sleep();
936944

937945
INIT_LIST_HEAD(&list);
@@ -951,6 +959,7 @@ void dpm_complete(pm_message_t state)
951959
}
952960
list_splice(&list, &dpm_list);
953961
mutex_unlock(&dpm_list_mtx);
962+
trace_suspend_resume(TPS("dpm_complete"), state.event, false);
954963
}
955964

956965
/**
@@ -1086,6 +1095,7 @@ static int dpm_suspend_noirq(pm_message_t state)
10861095
ktime_t starttime = ktime_get();
10871096
int error = 0;
10881097

1098+
trace_suspend_resume(TPS("dpm_suspend_noirq"), state.event, true);
10891099
cpuidle_pause();
10901100
suspend_device_irqs();
10911101
mutex_lock(&dpm_list_mtx);
@@ -1126,6 +1136,7 @@ static int dpm_suspend_noirq(pm_message_t state)
11261136
} else {
11271137
dpm_show_time(starttime, state, "noirq");
11281138
}
1139+
trace_suspend_resume(TPS("dpm_suspend_noirq"), state.event, false);
11291140
return error;
11301141
}
11311142

@@ -1222,6 +1233,7 @@ static int dpm_suspend_late(pm_message_t state)
12221233
ktime_t starttime = ktime_get();
12231234
int error = 0;
12241235

1236+
trace_suspend_resume(TPS("dpm_suspend_late"), state.event, true);
12251237
mutex_lock(&dpm_list_mtx);
12261238
pm_transition = state;
12271239
async_error = 0;
@@ -1257,6 +1269,7 @@ static int dpm_suspend_late(pm_message_t state)
12571269
} else {
12581270
dpm_show_time(starttime, state, "late");
12591271
}
1272+
trace_suspend_resume(TPS("dpm_suspend_late"), state.event, false);
12601273
return error;
12611274
}
12621275

@@ -1295,7 +1308,9 @@ static int legacy_suspend(struct device *dev, pm_message_t state,
12951308

12961309
calltime = initcall_debug_start(dev);
12971310

1311+
trace_device_pm_callback_start(dev, info, state.event);
12981312
error = cb(dev, state);
1313+
trace_device_pm_callback_end(dev, error);
12991314
suspend_report_result(cb, error);
13001315

13011316
initcall_debug_report(dev, calltime, error, state, info);
@@ -1461,6 +1476,7 @@ int dpm_suspend(pm_message_t state)
14611476
ktime_t starttime = ktime_get();
14621477
int error = 0;
14631478

1479+
trace_suspend_resume(TPS("dpm_suspend"), state.event, true);
14641480
might_sleep();
14651481

14661482
cpufreq_suspend();
@@ -1498,6 +1514,7 @@ int dpm_suspend(pm_message_t state)
14981514
dpm_save_failed_step(SUSPEND_SUSPEND);
14991515
} else
15001516
dpm_show_time(starttime, state, NULL);
1517+
trace_suspend_resume(TPS("dpm_suspend"), state.event, false);
15011518
return error;
15021519
}
15031520

@@ -1549,8 +1566,11 @@ static int device_prepare(struct device *dev, pm_message_t state)
15491566
callback = dev->driver->pm->prepare;
15501567
}
15511568

1552-
if (callback)
1569+
if (callback) {
1570+
trace_device_pm_callback_start(dev, info, state.event);
15531571
ret = callback(dev);
1572+
trace_device_pm_callback_end(dev, ret);
1573+
}
15541574

15551575
device_unlock(dev);
15561576

@@ -1582,6 +1602,7 @@ int dpm_prepare(pm_message_t state)
15821602
{
15831603
int error = 0;
15841604

1605+
trace_suspend_resume(TPS("dpm_prepare"), state.event, true);
15851606
might_sleep();
15861607

15871608
mutex_lock(&dpm_list_mtx);
@@ -1612,6 +1633,7 @@ int dpm_prepare(pm_message_t state)
16121633
put_device(dev);
16131634
}
16141635
mutex_unlock(&dpm_list_mtx);
1636+
trace_suspend_resume(TPS("dpm_prepare"), state.event, false);
16151637
return error;
16161638
}
16171639

‎drivers/base/syscore.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include <linux/mutex.h>
1111
#include <linux/module.h>
1212
#include <linux/interrupt.h>
13+
#include <trace/events/power.h>
1314

1415
static LIST_HEAD(syscore_ops_list);
1516
static DEFINE_MUTEX(syscore_ops_lock);
@@ -49,6 +50,7 @@ int syscore_suspend(void)
4950
struct syscore_ops *ops;
5051
int ret = 0;
5152

53+
trace_suspend_resume(TPS("syscore_suspend"), 0, true);
5254
pr_debug("Checking wakeup interrupts\n");
5355

5456
/* Return error code if there are any wakeup interrupts pending. */
@@ -70,6 +72,7 @@ int syscore_suspend(void)
7072
"Interrupts enabled after %pF\n", ops->suspend);
7173
}
7274

75+
trace_suspend_resume(TPS("syscore_suspend"), 0, false);
7376
return 0;
7477

7578
err_out:
@@ -92,6 +95,7 @@ void syscore_resume(void)
9295
{
9396
struct syscore_ops *ops;
9497

98+
trace_suspend_resume(TPS("syscore_resume"), 0, true);
9599
WARN_ONCE(!irqs_disabled(),
96100
"Interrupts enabled before system core resume.\n");
97101

@@ -103,6 +107,7 @@ void syscore_resume(void)
103107
WARN_ONCE(!irqs_disabled(),
104108
"Interrupts enabled after %pF\n", ops->resume);
105109
}
110+
trace_suspend_resume(TPS("syscore_resume"), 0, false);
106111
}
107112
EXPORT_SYMBOL_GPL(syscore_resume);
108113
#endif /* CONFIG_PM_SLEEP */

‎drivers/cpufreq/Kconfig‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ config CPU_FREQ_GOV_CONSERVATIVE
185185

186186
config GENERIC_CPUFREQ_CPU0
187187
tristate "Generic CPU0 cpufreq driver"
188-
depends on HAVE_CLK && REGULATOR && OF && THERMAL && CPU_THERMAL
188+
depends on HAVE_CLK && OF
189189
select PM_OPP
190190
help
191191
This adds a generic cpufreq driver for CPU0 frequency management.

‎drivers/cpufreq/Kconfig.arm‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@
55
# big LITTLE core layer and glue drivers
66
config ARM_BIG_LITTLE_CPUFREQ
77
tristate "Generic ARM big LITTLE CPUfreq driver"
8-
depends on (BIG_LITTLE && ARM_CPU_TOPOLOGY) || (ARM64 && SMP)
9-
depends on HAVE_CLK
8+
depends on ARM && BIG_LITTLE && ARM_CPU_TOPOLOGY && HAVE_CLK
109
select PM_OPP
1110
help
1211
This enables the Generic CPUfreq driver for ARM big.LITTLE platforms.

‎drivers/cpufreq/cpufreq-cpu0.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ static int cpu0_cpufreq_init(struct cpufreq_policy *policy)
104104
}
105105

106106
static struct cpufreq_driver cpu0_cpufreq_driver = {
107-
.flags = CPUFREQ_STICKY,
107+
.flags = CPUFREQ_STICKY | CPUFREQ_NEED_INITIAL_FREQ_CHECK,
108108
.verify = cpufreq_generic_frequency_table_verify,
109109
.target_index = cpu0_set_target,
110110
.get = cpufreq_generic_get,

0 commit comments

Comments
 (0)