Skip to content

Commit 24c242e

Browse files
geertuKAGA-KOKO
authored andcommitted
ntp: Use freezable workqueue for RTC synchronization
The bug fixed by commit e3fab2f ("ntp: Fix RTC synchronization on 32-bit platforms") revealed an underlying issue: RTC synchronization may happen anytime, even while the system is partially suspended. On systems where the RTC is connected to an I2C bus, the I2C bus controller may already or still be suspended, triggering a WARNING during suspend or resume from s2ram: WARNING: CPU: 0 PID: 124 at drivers/i2c/i2c-core.h:54 __i2c_transfer+0x634/0x680 i2c i2c-6: Transfer while suspended [...] Workqueue: events_power_efficient sync_hw_clock [...] (__i2c_transfer) (i2c_transfer) (regmap_i2c_read) ... (da9063_rtc_set_time) (rtc_set_time) (sync_hw_clock) (process_one_work) Fix this race condition by using the freezable instead of the normal power-efficient workqueue. Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Rafael J. Wysocki <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ebb22a0 commit 24c242e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/time/ntp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ static struct hrtimer sync_hrtimer;
502502

503503
static enum hrtimer_restart sync_timer_callback(struct hrtimer *timer)
504504
{
505-
queue_work(system_power_efficient_wq, &sync_work);
505+
queue_work(system_freezable_power_efficient_wq, &sync_work);
506506

507507
return HRTIMER_NORESTART;
508508
}
@@ -668,7 +668,7 @@ void ntp_notify_cmos_timer(void)
668668
* just a pointless work scheduled.
669669
*/
670670
if (ntp_synced() && !hrtimer_is_queued(&sync_hrtimer))
671-
queue_work(system_power_efficient_wq, &sync_work);
671+
queue_work(system_freezable_power_efficient_wq, &sync_work);
672672
}
673673

674674
static void __init ntp_init_cmos_sync(void)

0 commit comments

Comments
 (0)