@@ -496,6 +496,7 @@ struct dpm_watchdog {
496
496
struct device * dev ;
497
497
struct task_struct * tsk ;
498
498
struct timer_list timer ;
499
+ bool fatal ;
499
500
};
500
501
501
502
#define DECLARE_DPM_WATCHDOG_ON_STACK (wd ) \
@@ -512,11 +513,23 @@ struct dpm_watchdog {
512
513
static void dpm_watchdog_handler (struct timer_list * t )
513
514
{
514
515
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 );
515
530
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 );
520
533
}
521
534
522
535
/**
@@ -530,10 +543,11 @@ static void dpm_watchdog_set(struct dpm_watchdog *wd, struct device *dev)
530
543
531
544
wd -> dev = dev ;
532
545
wd -> tsk = current ;
546
+ wd -> fatal = CONFIG_DPM_WATCHDOG_TIMEOUT == CONFIG_DPM_WATCHDOG_WARNING_TIMEOUT ;
533
547
534
548
timer_setup_on_stack (timer , dpm_watchdog_handler , 0 );
535
549
/* 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 ;
537
551
add_timer (timer );
538
552
}
539
553
0 commit comments