Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2363370pxb; Fri, 5 Feb 2021 16:28:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxu/1xVwYfRvF+dDnaGRIQxVEaLSTdwyhqeC+k/qQXQIhcWnth3Th7tRNhpK+R31ou5qVUw X-Received: by 2002:a05:6402:2694:: with SMTP id w20mr6104672edd.200.1612571299814; Fri, 05 Feb 2021 16:28:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612571299; cv=none; d=google.com; s=arc-20160816; b=ZhOuLa29pB02SvuApXp91omoWEfWNk+tmOuey0qlAJ1AwZS+26dm4Q1b8K+oqX3j9S T/pj+qqjy01d1f2ZzaHjmjrW8q7YlPLeY83FmoCoCA3gyAu9T8t3dL/9LLQzNZTeyThI 0Udr2r7waCz6NuUuA0WvAgZ/byJyFWaB6jyGY3MQJ/feD1EEBYUGx+4AfvnT1hgnqmwc Di+QZNppqFmLAeGTxkFR5iwQEAc8TRcXw5iVKDp7DOwisNmeSfBY6Md1KBsHzuLLjo4y 3uJgYwfYstziy0MQA1CwtvN4TQCoApsIUYyseRTohgOcqcYrXfj8UkWW44ql62w+I3yJ WGCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version; bh=kuINixcG/J94gESP0yyjqiYb/s22t0ZfSXhCYWQroxI=; b=zaVruDOfveeYBnbPm0bXnbNzQ14K1Oi33NOcxKvuTYLf5fPIty0mDUGqJ3cHWOTh+T 9NNqppE/sUoLZF/lF9zdCLMpMtWsf9gYkwbT0i4Kz3JDTLlZytqMcQ1gd4PJ/T2+iB+q uEo7WRIbB1ds9KiOcW/bG6ZG2Yjeeq8w/NNqN48zy1H3Z1GKPuP29W3ONLx+X38SgI8d qghpoQgAPFY2R6OIweSPsHg9KwbIk3eBlHsGk3o5da3ijAY+5qzF+QoTgtQL0+xHkhwT jeZxV2+QZ8S/QziviEK0n6HY0vV14WoiwPhvstpD7xwM3Cmoz5uC+i3PVXCDjN0DHoxx +zpA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v8si6031372edc.382.2021.02.05.16.27.55; Fri, 05 Feb 2021 16:28:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229705AbhBFAYz (ORCPT + 99 others); Fri, 5 Feb 2021 19:24:55 -0500 Received: from mail-ot1-f43.google.com ([209.85.210.43]:35871 "EHLO mail-ot1-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231822AbhBEMoY (ORCPT ); Fri, 5 Feb 2021 07:44:24 -0500 Received: by mail-ot1-f43.google.com with SMTP id 100so47649otg.3; Fri, 05 Feb 2021 04:44:07 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=kuINixcG/J94gESP0yyjqiYb/s22t0ZfSXhCYWQroxI=; b=obWk6BQ5ZMOBvTVEwhhw2CV0CXPgp9UMDgh0DfNmhgjDix25Xr8d3Q0pas1o4AHB8o WeSBMAom7Ycn4cu0bD85Y1zds+su3CFFnmyBEQYrMuuM8gBcf+JY43T88MY9nHUJoS/R YKnAwMq4sspwJhgen28J/G6etP81X0ZjKat3Ou4Z1eUpZSEi/AI+pWtGrVD2AX9jrAPL VwS0NwYQtXu4BuA2BVfP3RkC2TGIH0eqdEn6/RvaBxmDzb5cfk4kYuOkUgFm1CtwX9K/ TIXLanEK4hIhbA5yoDPhSFJTaRZyALznXAjRuT1RKG6IkP+rzDoYWfWxECGdxtJqpjV9 /7CA== X-Gm-Message-State: AOAM531d/KnSre7SqwXX2t9+aQcdpMb89KQt+P8ih0ZZaWwy+0XZ23Qa NyqyFXYszsKns4yD8Yl2eGXqn024rzyD3kwfHjW1mvt5 X-Received: by 2002:a9d:7a4a:: with SMTP id z10mr3350757otm.206.1612529022635; Fri, 05 Feb 2021 04:43:42 -0800 (PST) MIME-Version: 1.0 References: <20210125143039.1051912-1-geert+renesas@glider.be> In-Reply-To: <20210125143039.1051912-1-geert+renesas@glider.be> From: "Rafael J. Wysocki" Date: Fri, 5 Feb 2021 13:43:28 +0100 Message-ID: Subject: Re: [PATCH] ntp: Use freezable workqueue for RTC synchronization To: Geert Uytterhoeven Cc: John Stultz , Thomas Gleixner , Stephen Boyd , Alexandre Belloni , "Rafael J . Wysocki" , Len Brown , Pavel Machek , Wolfram Sang , Viresh Kumar , Tejun Heo , Lai Jiangshan , Alessandro Zummo , linux-rtc@vger.kernel.org, Linux PM , Linux-Renesas , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 26, 2021 at 6:48 AM Geert Uytterhoeven wrote: > > The bug fixed by commit e3fab2f3de081e98 ("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) from [] (i2c_transfer+0x58/0xf8) > [] (i2c_transfer) from [] (regmap_i2c_read+0x58/0x94) > [] (regmap_i2c_read) from [] (_regmap_raw_read+0x19c/0x2f4) > [] (_regmap_raw_read) from [] (_regmap_bus_read+0x44/0x68) > [] (_regmap_bus_read) from [] (_regmap_read+0x84/0x1a4) > [] (_regmap_read) from [] (_regmap_update_bits+0xa8/0xf4) > [] (_regmap_update_bits) from [] (_regmap_select_page+0xe4/0x100) > [] (_regmap_select_page) from [] (_regmap_raw_write_impl+0xd4/0x6c4) > [] (_regmap_raw_write_impl) from [] (_regmap_raw_write+0xd8/0x114) > [] (_regmap_raw_write) from [] (regmap_raw_write+0x58/0x7c) > [] (regmap_raw_write) from [] (regmap_bulk_write+0x118/0x13c) > [] (regmap_bulk_write) from [] (da9063_rtc_set_time+0x44/0x8c) > [] (da9063_rtc_set_time) from [] (rtc_set_time+0xc8/0x228) > [] (rtc_set_time) from [] (sync_hw_clock+0x128/0x1fc) > [] (sync_hw_clock) from [] (process_one_work+0x330/0x550) > [] (process_one_work) from [] (worker_thread+0x22c/0x2ec) > > Fix this race condition by using the freezable instead of the normal > power-efficient workqueue. > > Signed-off-by: Geert Uytterhoeven LGTM Acked-by: Rafael J. Wysocki > --- > kernel/time/ntp.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c > index 54d52fab201d283e..6310328fe398406a 100644 > --- a/kernel/time/ntp.c > +++ b/kernel/time/ntp.c > @@ -502,7 +502,7 @@ static struct hrtimer sync_hrtimer; > > static enum hrtimer_restart sync_timer_callback(struct hrtimer *timer) > { > - queue_work(system_power_efficient_wq, &sync_work); > + queue_work(system_freezable_power_efficient_wq, &sync_work); > > return HRTIMER_NORESTART; > } > @@ -668,7 +668,7 @@ void ntp_notify_cmos_timer(void) > * just a pointless work scheduled. > */ > if (ntp_synced() && !hrtimer_is_queued(&sync_hrtimer)) > - queue_work(system_power_efficient_wq, &sync_work); > + queue_work(system_freezable_power_efficient_wq, &sync_work); > } > > static void __init ntp_init_cmos_sync(void) > -- > 2.25.1 >