Skip to content

Commit 1225bb4

Browse files
committed
Merge branches 'pm-sleep', 'pm-cpuidle' and 'pm-em'
Merge updates related to system sleep, a cpuidle update and an Energy Model handling code update for 6.14-rc1: - Allow configuring the system suspend-resume (DPM) watchdog to warn earlier than panic (Douglas Anderson). - Implement devm_device_init_wakeup() helper and introduce a device- managed variant of dev_pm_set_wake_irq() (Joe Hattori, Peng Fan). - Remove direct inclusions of 'pm_wakeup.h' which should be only included via 'device.h' (Wolfram Sang). - Clean up two comments in the core system-wide PM code (Rafael Wysocki, Randy Dunlap). - Add Clearwater Forest processor support to the intel_idle cpuidle driver (Artem Bityutskiy). - Move sched domains rebuild function from the schedutil cpufreq governor to the Energy Model handling code (Rafael Wysocki). * pm-sleep: PM: sleep: wakeirq: Introduce device-managed variant of dev_pm_set_wake_irq() PM: sleep: Allow configuring the DPM watchdog to warn earlier than panic PM: sleep: convert comment from kernel-doc to plain comment PM: wakeup: implement devm_device_init_wakeup() helper PM: sleep: sysfs: don't include 'pm_wakeup.h' directly PM: sleep: autosleep: don't include 'pm_wakeup.h' directly PM: sleep: Update stale comment in device_resume() * pm-cpuidle: intel_idle: add Clearwater Forest SoC support * pm-em: PM: EM: Move sched domains rebuild function from schedutil to EM
4 parents 3744b08 + fd8318a + 9c782cc + ebeeee3 commit 1225bb4

File tree

13 files changed

+117
-38
lines changed

13 files changed

+117
-38
lines changed

drivers/base/power/main.c

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -496,6 +496,7 @@ struct dpm_watchdog {
496496
struct device *dev;
497497
struct task_struct *tsk;
498498
struct timer_list timer;
499+
bool fatal;
499500
};
500501

501502
#define DECLARE_DPM_WATCHDOG_ON_STACK(wd) \
@@ -512,11 +513,23 @@ struct dpm_watchdog {
512513
static void dpm_watchdog_handler(struct timer_list *t)
513514
{
514515
struct dpm_watchdog *wd = from_timer(wd, t, timer);
516+
struct timer_list *timer = &wd->timer;
517+
unsigned int time_left;
518+
519+
if (wd->fatal) {
520+
dev_emerg(wd->dev, "**** DPM device timeout ****\n");
521+
show_stack(wd->tsk, NULL, KERN_EMERG);
522+
panic("%s %s: unrecoverable failure\n",
523+
dev_driver_string(wd->dev), dev_name(wd->dev));
524+
}
525+
526+
time_left = CONFIG_DPM_WATCHDOG_TIMEOUT - CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT;
527+
dev_warn(wd->dev, "**** DPM device timeout after %u seconds; %u seconds until panic ****\n",
528+
CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT, time_left);
529+
show_stack(wd->tsk, NULL, KERN_WARNING);
515530

516-
dev_emerg(wd->dev, "**** DPM device timeout ****\n");
517-
show_stack(wd->tsk, NULL, KERN_EMERG);
518-
panic("%s %s: unrecoverable failure\n",
519-
dev_driver_string(wd->dev), dev_name(wd->dev));
531+
wd->fatal = true;
532+
mod_timer(timer, jiffies + HZ * time_left);
520533
}
521534

522535
/**
@@ -530,10 +543,11 @@ static void dpm_watchdog_set(struct dpm_watchdog *wd, struct device *dev)
530543

531544
wd->dev = dev;
532545
wd->tsk = current;
546+
wd->fatal = CONFIG_DPM_WATCHDOG_TIMEOUT == CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT;
533547

534548
timer_setup_on_stack(timer, dpm_watchdog_handler, 0);
535549
/* use same timeout value for both suspend and resume */
536-
timer->expires = jiffies + HZ * CONFIG_DPM_WATCHDOG_TIMEOUT;
550+
timer->expires = jiffies + HZ * CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT;
537551
add_timer(timer);
538552
}
539553

@@ -914,7 +928,7 @@ static void device_resume(struct device *dev, pm_message_t state, bool async)
914928
goto Complete;
915929

916930
if (dev->power.direct_complete) {
917-
/* Match the pm_runtime_disable() in __device_suspend(). */
931+
/* Match the pm_runtime_disable() in device_suspend(). */
918932
pm_runtime_enable(dev);
919933
goto Complete;
920934
}

drivers/base/power/sysfs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include <linux/export.h>
77
#include <linux/pm_qos.h>
88
#include <linux/pm_runtime.h>
9-
#include <linux/pm_wakeup.h>
109
#include <linux/atomic.h>
1110
#include <linux/jiffies.h>
1211
#include "power.h"

drivers/base/power/wakeirq.c

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,32 @@ void dev_pm_clear_wake_irq(struct device *dev)
103103
}
104104
EXPORT_SYMBOL_GPL(dev_pm_clear_wake_irq);
105105

106+
static void devm_pm_clear_wake_irq(void *dev)
107+
{
108+
dev_pm_clear_wake_irq(dev);
109+
}
110+
111+
/**
112+
* devm_pm_set_wake_irq - device-managed variant of dev_pm_set_wake_irq
113+
* @dev: Device entry
114+
* @irq: Device IO interrupt
115+
*
116+
*
117+
* Attach a device IO interrupt as a wake IRQ, same with dev_pm_set_wake_irq,
118+
* but the device will be auto clear wake capability on driver detach.
119+
*/
120+
int devm_pm_set_wake_irq(struct device *dev, int irq)
121+
{
122+
int ret;
123+
124+
ret = dev_pm_set_wake_irq(dev, irq);
125+
if (ret)
126+
return ret;
127+
128+
return devm_add_action_or_reset(dev, devm_pm_clear_wake_irq, dev);
129+
}
130+
EXPORT_SYMBOL_GPL(devm_pm_set_wake_irq);
131+
106132
/**
107133
* handle_threaded_wake_irq - Handler for dedicated wake-up interrupts
108134
* @irq: Device specific dedicated wake-up interrupt

drivers/cpufreq/cpufreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1538,7 +1538,7 @@ static int cpufreq_online(unsigned int cpu)
15381538

15391539
/*
15401540
* Register with the energy model before
1541-
* sugov_eas_rebuild_sd() is called, which will result
1541+
* em_rebuild_sched_domains() is called, which will result
15421542
* in rebuilding of the sched domains, which should only be done
15431543
* once the energy model is properly initialized for the policy
15441544
* first.

drivers/idle/intel_idle.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1651,6 +1651,7 @@ static const struct x86_cpu_id intel_idle_ids[] __initconst = {
16511651
X86_MATCH_VFM(INTEL_ATOM_TREMONT_D, &idle_cpu_snr),
16521652
X86_MATCH_VFM(INTEL_ATOM_CRESTMONT, &idle_cpu_grr),
16531653
X86_MATCH_VFM(INTEL_ATOM_CRESTMONT_X, &idle_cpu_srf),
1654+
X86_MATCH_VFM(INTEL_ATOM_DARKMONT_X, &idle_cpu_srf),
16541655
{}
16551656
};
16561657

include/linux/energy_model.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ int em_dev_compute_costs(struct device *dev, struct em_perf_state *table,
179179
int em_dev_update_chip_binning(struct device *dev);
180180
int em_update_performance_limits(struct em_perf_domain *pd,
181181
unsigned long freq_min_khz, unsigned long freq_max_khz);
182+
void em_rebuild_sched_domains(void);
182183

183184
/**
184185
* em_pd_get_efficient_state() - Get an efficient performance state from the EM
@@ -404,6 +405,7 @@ int em_update_performance_limits(struct em_perf_domain *pd,
404405
{
405406
return -EINVAL;
406407
}
408+
static inline void em_rebuild_sched_domains(void) {}
407409
#endif
408410

409411
#endif

include/linux/pm_wakeirq.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ extern int dev_pm_set_wake_irq(struct device *dev, int irq);
1010
extern int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq);
1111
extern int dev_pm_set_dedicated_wake_irq_reverse(struct device *dev, int irq);
1212
extern void dev_pm_clear_wake_irq(struct device *dev);
13+
extern int devm_pm_set_wake_irq(struct device *dev, int irq);
1314

1415
#else /* !CONFIG_PM */
1516

@@ -32,5 +33,10 @@ static inline void dev_pm_clear_wake_irq(struct device *dev)
3233
{
3334
}
3435

36+
static inline int devm_pm_set_wake_irq(struct device *dev, int irq)
37+
{
38+
return 0;
39+
}
40+
3541
#endif /* CONFIG_PM */
3642
#endif /* _LINUX_PM_WAKEIRQ_H */

include/linux/pm_wakeup.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,4 +240,21 @@ static inline int device_init_wakeup(struct device *dev, bool enable)
240240
return 0;
241241
}
242242

243+
static void device_disable_wakeup(void *dev)
244+
{
245+
device_init_wakeup(dev, false);
246+
}
247+
248+
/**
249+
* devm_device_init_wakeup - Resource managed device wakeup initialization.
250+
* @dev: Device to handle.
251+
*
252+
* This function is the devm managed version of device_init_wakeup(dev, true).
253+
*/
254+
static inline int devm_device_init_wakeup(struct device *dev)
255+
{
256+
device_init_wakeup(dev, true);
257+
return devm_add_action_or_reset(dev, device_disable_wakeup, dev);
258+
}
259+
243260
#endif /* _LINUX_PM_WAKEUP_H */

kernel/power/Kconfig

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,11 +257,30 @@ config DPM_WATCHDOG
257257
boot session.
258258

259259
config DPM_WATCHDOG_TIMEOUT
260-
int "Watchdog timeout in seconds"
260+
int "Watchdog timeout to panic in seconds"
261261
range 1 120
262262
default 120
263263
depends on DPM_WATCHDOG
264264

265+
config DPM_WATCHDOG_WARNING_TIMEOUT
266+
int "Watchdog timeout to warn in seconds"
267+
range 1 DPM_WATCHDOG_TIMEOUT
268+
default DPM_WATCHDOG_TIMEOUT
269+
depends on DPM_WATCHDOG
270+
help
271+
If the DPM watchdog warning timeout and main timeout are
272+
different then a non-fatal warning (with a stack trace of
273+
the stuck suspend routine) will be printed when the warning
274+
timeout expires. If the suspend routine gets un-stuck
275+
before the main timeout expires then no other action is
276+
taken. If the routine continues to be stuck and the main
277+
timeout expires then an emergency-level message and stack
278+
trace will be printed and the system will panic.
279+
280+
If the warning timeout is equal to the main timeout (the
281+
default) then the warning will never happen and the system
282+
will jump straight to panic when the main timeout expires.
283+
265284
config PM_TRACE
266285
bool
267286
help

kernel/power/autosleep.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
#include <linux/device.h>
1111
#include <linux/mutex.h>
12-
#include <linux/pm_wakeup.h>
1312

1413
#include "power.h"
1514

0 commit comments

Comments
 (0)