Re: [PATCH] rtc-snvs: Add timeouts to avoid kernel lockups

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Trent,

On 16/03/2018 11:12:02-0700, Trent Piepho wrote:
> In order to read correctly from asynchronously updated RTC registers, it's
> necessary to read repeatedly until their values do not change from read to
> read.  There is no timeout in this code and it could possibly loop
> forever.
> 
> It's also necessary to wait for three RTC clock ticks for certain
> operations to take effect and the driver might wait forever for this to
> happen.
> 
> To avoid kernel hangs, put in timeouts.
> 
> These hangs will happen when running under qemu, which doesn't emulate the
> SNVS RTC.  It could also happen if the RTC block where somehow placed into
> reset or the slow speed clock that drives the RTC counter (but not the
> CPU) were to stop.
> 
> The symptoms are a work queue hang on rtc_timer_do_work(), which
> eventually blocks a systemd fsnotify operation that triggers a work queue
> flush, causing systemd to hang and thus causing all services that should
> be started by systemd, like a console getty, to fail to start or stop.
> 
> Also optimize the wait code to wait less.  It only needs to wait for the
> clock to advance three ticks, not to see it change three times.
> 
> Signed-off-by: Trent Piepho <tpiepho@xxxxxxxxxx>
> Cc: Alessandro Zummo <a.zummo@xxxxxxxxxxxx>
> Cc: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxxxxxxxxx>
> Cc: linux-rtc@xxxxxxxxxxxxxxx
> Cc: Shawn Guo <shawnguo@xxxxxxxxxx>
> Cc: Sascha Hauer <kernel@xxxxxxxxxxxxxx>
> Cc: Fabio Estevam <fabio.estevam@xxxxxxx>
>

Can you rebase that patch on top of rtc-next if you feel this is still
necessary? Also, it would be great to have Shawn or Fabio's ack.

Thanks!

-- 
Alexandre Belloni, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com



[Index of Archives]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux