From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Message-ID: <541C3329.3010409@elproma.com.pl> Date: Fri, 19 Sep 2014 15:44:09 +0200 From: =?windows-1250?Q?Janusz_U=BFycki?= MIME-Version: 1.0 To: Greg Kroah-Hartman CC: Guenter Roeck , linux-watchdog@vger.kernel.org, Wim Van Sebroeck , linux-kernel@vger.kernel.org Subject: Re: timers vs drivers suspend race References: <541BFB63.3060006@elproma.com.pl> <541C122D.10305@elproma.com.pl> In-Reply-To: <541C122D.10305@elproma.com.pl> Content-Type: multipart/alternative; boundary="------------090509010208000501080801" List-ID: This is a multi-part message in MIME format. --------------090509010208000501080801 Content-Type: text/plain; charset=windows-1250; format=flowed Content-Transfer-Encoding: 8bit W dniu 2014-09-19 13:23, Janusz Użycki pisze: > Hi. > > I have a doubt about suspending of timers. > I found the patch (not included to linux-next): > https://lkml.org/lkml/2014/7/21/493 > but it concerns timers only. > > I'm adding PM to the watchdog driver (below). > The driver is capable to stop the watchdog. > However I implemented "keep-on" feature to ping > active watchdog if userland doesn't do it. > For the feature I used a timer. > Now, on wdt_suspend() call I don't know > if timers are suspended before the watchdog driver or > there is no guarantee (race): wdt_suspend() calls wdt_stop() > and after timer's callback will ping watchdog and reenable it. > > I found also: > https://lkml.org/lkml/2007/10/25/9 > Here del_timer_sync() is called and it solves > the problem. > In my case the timer is serviced in watchdog_dev, > not in the specific-driver. > I can add a flag in the specific-driver > to block watchdog's ping before wdt_stop() > or export new function to suspend/resume > watchdog_dev's timer from the specific-driver. > > Could you advice is it necessary? Does changing SIMPLE_DEV_PM_OPS to SET_LATE_SYSTEM_SLEEP_PM_OPS solve the race problem with timer? best regards Janusz --------------090509010208000501080801 Content-Type: text/html; charset=windows-1250 Content-Transfer-Encoding: 8bit
W dniu 2014-09-19 13:23, Janusz Użycki pisze:
Hi.

I have a doubt about suspending of timers.
I found the patch (not included to linux-next):
https://lkml.org/lkml/2014/7/21/493
but it concerns timers only.

I'm adding PM to the watchdog driver (below).
The driver is capable to stop the watchdog.
However I implemented "keep-on" feature to ping
active watchdog if userland doesn't do it.
For the feature I used a timer.
Now, on wdt_suspend() call I don't know
if timers are suspended before the watchdog driver or
there is no guarantee (race): wdt_suspend() calls wdt_stop()
and after timer's callback will ping watchdog and reenable it.

I found also:
https://lkml.org/lkml/2007/10/25/9
Here del_timer_sync() is called and it solves
the problem.
In my case the timer is serviced in watchdog_dev,
not in the specific-driver.
I can add a flag in the specific-driver
to block watchdog's ping before wdt_stop()
or export new function to suspend/resume
watchdog_dev's timer from the specific-driver.

Could you advice is it necessary?

Does changing SIMPLE_DEV_PM_OPS to SET_LATE_SYSTEM_SLEEP_PM_OPS
solve the race problem with timer?

best regards
Janusz


--------------090509010208000501080801--