summaryrefslogtreecommitdiffstats
path: root/drivers/dio
diff options
context:
space:
mode:
authorTrent Piepho2018-05-17 01:45:51 +0200
committerAlexandre Belloni2018-07-11 20:41:09 +0200
commitcd7f3a249dbed2858e6c2f30e5be7f1f7a709ee2 (patch)
treefe0e55dcbe6fd38aefb3b39136145cb6a90c655c /drivers/dio
parentrtc: bq4802: add error handling for devm_ioremap (diff)
downloadkernel-qcow2-linux-cd7f3a249dbed2858e6c2f30e5be7f1f7a709ee2.tar.gz
kernel-qcow2-linux-cd7f3a249dbed2858e6c2f30e5be7f1f7a709ee2.tar.xz
kernel-qcow2-linux-cd7f3a249dbed2858e6c2f30e5be7f1f7a709ee2.zip
rtc: snvs: Add timeouts to avoid kernel lockups
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. It's also necessary to wait for three RTC clock ticks for certain operations. There are no timeouts in this code and these operations could possibly loop forever. To avoid kernel hangs, put in timeouts. The iMX7d can be configured to stop the SRTC on a tamper event, which will lockup the kernel inside this driver as described above. These hangs can happen when running under qemu, which doesn't emulate the SNVS RTC, though currently the driver will refuse to load on qemu due to a timeout in the driver probe method. It could also happen if the SRTC block where somehow placed into reset or the slow speed clock that drives the SRTC counter (but not the CPU) were to stop. The symptoms on a two core iMX7d 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. Cc: Alexandre Belloni <alexandre.belloni@free-electrons.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Fabio Estevam <fabio.estevam@nxp.com> Cc: Shawn Guo <shawn.guo@linaro.org> Cc: Bryan O'Donoghue <pure.logic@nexus-software.ie> Signed-off-by: Trent Piepho <tpiepho@impinj.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/dio')
0 files changed, 0 insertions, 0 deletions