]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
rtc: cmos: avoid taking rtc_lock for extended period of time
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 25 Oct 2024 20:14:57 +0000 (13:14 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 19:04:09 +0000 (20:04 +0100)
commitf43324df566a29cf48b466584bd127663f3fe0a4
tree572a02620797d4c57bbfd4f51e018ce0b0f8c1cf
parent65570470175cc6a4d6bad5116bc48b2e4e63e516
rtc: cmos: avoid taking rtc_lock for extended period of time

[ Upstream commit 0a6efab33eab4e973db26d9f90c3e97a7a82e399 ]

On my device reading entirety of /sys/devices/pnp0/00:03/cmos_nvram0/nvmem
takes about 9 msec during which time interrupts are off on the CPU that
does the read and the thread that performs the read can not be migrated
or preempted by another higher priority thread (RT or not).

Allow readers and writers be preempted by taking and releasing rtc_lock
spinlock for each individual byte read or written rather than once per
read/write request.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Reviewed-by: Mateusz Jończyk <mat.jonczyk@o2.pl>
Link: https://lore.kernel.org/r/Zxv8QWR21AV4ztC5@google.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/rtc/rtc-cmos.c