linux/drivers/rtc
Esben Haabendal 795cda8338 rtc: interface: Fix long-standing race when setting alarm
As described in the old comment dating back to
commit 6610e0893b ("RTC: Rework RTC code to use timerqueue for events")
from 2010, we have been living with a race window when setting alarm
with an expiry in the near future (i.e. next second).
With 1 second resolution, it can happen that the second ticks after the
check for the timer having expired, but before the alarm is actually set.
When this happen, no alarm IRQ is generated, at least not with some RTC
chips (isl12022 is an example of this).

With UIE RTC timer being implemented on top of alarm irq, being re-armed
every second, UIE will occasionally fail to work, as an alarm irq lost
due to this race will stop the re-arming loop.

For now, I have limited the additional expiry check to only be done for
alarms set to next seconds. I expect it should be good enough, although I
don't know if we can now for sure that systems with loads could end up
causing the same problems for alarms set 2 seconds or even longer in the
future.

I haven't been able to reproduce the problem with this check in place.

Cc: stable@vger.kernel.org
Signed-off-by: Esben Haabendal <esben@geanix.com>
Link: https://lore.kernel.org/r/20250516-rtc-uie-irq-fixes-v2-1-3de8e530a39e@geanix.com
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
2025-10-09 23:34:51 +02:00
..
Kconfig rtc: Kconfig: move symbols to proper section 2025-10-05 22:44:51 +02:00
Makefile rtc: spacemit: support the SpacemiT P1 RTC 2025-09-16 17:38:21 +02:00
class.c rtc: Fix offset calculation for .start_secs < 0 2025-06-02 00:10:18 +02:00
dev.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
interface.c rtc: interface: Fix long-standing race when setting alarm 2025-10-09 23:34:51 +02:00
lib.c rtc: Optimize calculations in rtc_time64_to_tm() 2025-07-23 23:48:06 +02:00
nvmem.c nvmem: add explicit config option to read old syntax fixed OF cells 2023-10-21 19:19:06 +02:00
proc.c
rtc-88pm80x.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-88pm860x.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-88pm886.c rtc: add driver for Marvell 88PM886 PMIC RTC 2024-11-11 23:37:50 +01:00
rtc-ab-b5ze-s3.c rtc: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-07-07 00:40:29 +02:00
rtc-ab-eoz9.c rtc: ab-eoz9: Use HWMON_CHANNEL_INFO macro to simplify code 2025-03-03 23:04:37 +01:00
rtc-ab8500.c rtc: ab8500: Use resource managed API to simplify code 2025-03-03 22:52:29 +01:00
rtc-abx80x.c rtc: abx80x: Fix WDT bit position of the status register 2024-11-11 22:10:26 +01:00
rtc-ac100.c rtc: Switch back to struct platform_driver::remove() 2024-11-10 22:58:28 +01:00
rtc-amlogic-a4.c rtc: amlogic-a4: Optimize global variables 2025-10-05 23:11:00 +02:00
rtc-armada38x.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-as3722.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-asm9260.c rtc: Switch back to struct platform_driver::remove() 2024-11-10 22:58:28 +01:00
rtc-aspeed.c rtc: aspeed: drop needless struct aspeed_rtc::rtc_dev member 2025-03-05 23:08:00 +01:00
rtc-at91rm9200.c rtc: at91rm9200: drop unused module alias 2025-05-24 23:58:23 +02:00
rtc-at91sam9.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-au1xxx.c
rtc-bd70528.c mfd: rtc: bd7xxxx Drop IC name from IRQ 2024-11-01 15:53:05 +00:00
rtc-bq32k.c rtc: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-07-07 00:40:29 +02:00
rtc-bq4802.c
rtc-brcmstb-waketimer.c rtc: brcmstb-waketimer: don't include 'pm_wakeup.h' directly 2024-11-18 14:47:40 +01:00
rtc-cadence.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-cmos.c rtc: cmos: use spin_lock_irqsave in cmos_interrupt 2025-06-24 00:27:51 +02:00
rtc-core.h
rtc-cpcap.c rtc: cpcap: drop unused module alias 2025-05-24 23:58:23 +02:00
rtc-cros-ec.c rtc: cros-ec: Avoid a couple of -Wflex-array-member-not-at-end warnings 2025-03-17 23:32:15 +01:00
rtc-cv1800.c rtc: sophgo: add rtc support for Sophgo CV1800 SoC 2025-05-25 00:15:13 +02:00
rtc-da9052.c
rtc-da9055.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-da9063.c rtc: da9063: drop unused module alias 2025-05-24 23:58:23 +02:00
rtc-digicolor.c
rtc-ds1216.c
rtc-ds1286.c
rtc-ds1302.c
rtc-ds1305.c rtc: ds1305: Report maximum alarm limit to rtc core 2023-08-27 23:50:22 +02:00
rtc-ds1307.c rtc: ds1307: convert from round_rate() to determine_rate() 2025-08-03 02:57:05 +02:00
rtc-ds1343.c rtc: ds1343: Use devm_pm_set_wake_irq 2025-03-03 22:52:29 +01:00
rtc-ds1347.c
rtc-ds1374.c rtc: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-07-07 00:40:29 +02:00
rtc-ds1390.c
rtc-ds1511.c rtc: ds1511: set alarm offset limit 2024-02-29 22:16:52 +01:00
rtc-ds1553.c
rtc-ds1672.c rtc: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-07-07 00:40:29 +02:00
rtc-ds1685.c rtc: ds1685: Update Joshua Kinard's email address. 2025-08-03 03:28:52 +02:00
rtc-ds1742.c rtc: Explicitly include correct DT includes 2023-07-27 23:31:29 +02:00
rtc-ds2404.c rtc: ds2404: drop needless struct ds2404::rtc member 2025-03-05 23:08:00 +01:00
rtc-ds3232.c rtc: ds3232: Use HWMON_CHANNEL_INFO macro to simplify code 2025-03-03 23:04:37 +01:00
rtc-efi.c rtc: efi: Remove wakeup functionality 2025-09-16 17:38:21 +02:00
rtc-em3027.c rtc: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-07-07 00:40:29 +02:00
rtc-ep93xx.c rtc: ep93xx: drop needless struct ep93xx_rtc::rtc member 2025-03-05 23:08:00 +01:00
rtc-fm3130.c rtc: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-07-07 00:40:29 +02:00
rtc-fsl-ftm-alarm.c rtc: fsl-ftm-alarm: Mark acpi_id table as maybe unused 2025-02-28 17:56:22 +01:00
rtc-ftrtc010.c rtc: ftrtc010: drop needless struct ftrtc010_rtc::rtc_dev member 2025-03-05 23:08:00 +01:00
rtc-gamecube.c
rtc-generic.c
rtc-goldfish.c rtc: add missing MODULE_DESCRIPTION() macro 2024-06-28 00:24:43 +02:00
rtc-hid-sensor-time.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
rtc-hym8563.c rtc: hym8563: convert from round_rate() to determine_rate() 2025-08-03 02:57:05 +02:00
rtc-imx-sc.c
rtc-imx-sm-bbm.c rtc: support i.MX95 BBM RTC 2024-08-28 21:54:51 +01:00
rtc-imxdi.c rtc: Switch back to struct platform_driver::remove() 2024-11-10 22:58:28 +01:00
rtc-isl1208.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-isl12022.c rtc: isl12022: Replace uint8_t types with u8 2024-11-11 00:06:46 +01:00
rtc-isl12026.c rtc: isl12026: Drop "_new" from probe callback name 2023-07-27 23:32:08 +02:00
rtc-jz4740.c rtc: jz4740: drop unused module alias 2025-05-24 23:58:23 +02:00
rtc-loongson.c rtc: loongson: Add missing alarm notifications for ACPI RTC events 2025-05-25 00:18:29 +02:00
rtc-lp8788.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-lpc24xx.c rtc: Switch back to struct platform_driver::remove() 2024-11-10 22:58:28 +01:00
rtc-lpc32xx.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-m41t80.c rtc: m41t80: convert from round_rate() to determine_rate() 2025-08-03 02:57:05 +02:00
rtc-m41t93.c
rtc-m41t94.c
rtc-m48t35.c
rtc-m48t59.c rtc: m48t59: Use platform_data struct for year offset value 2024-11-18 14:31:57 +01:00
rtc-m48t86.c rtc: m48t86: drop needless struct m48t86_rtc_info::rtc member 2025-03-05 23:08:00 +01:00
rtc-ma35d1.c rtc: ma35d1: remove hardcoded UIE support 2024-01-08 01:33:27 +01:00
rtc-max6900.c rtc: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-07-07 00:40:29 +02:00
rtc-max6902.c
rtc-max6916.c
rtc-max8907.c
rtc-max8925.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-max8997.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-max8998.c
rtc-max31335.c rtc: max31335: convert from round_rate() to determine_rate() 2025-08-03 02:57:05 +02:00
rtc-max77686.c rtc: max77686: use dev_err_probe() where appropriate 2025-03-05 23:08:01 +01:00
rtc-mc13xxx.c rtc: Switch back to struct platform_driver::remove() 2024-11-10 22:58:28 +01:00
rtc-mc146818-lib.c rtc: rtc-mc146818-lib: Use is_leap_year instead of calculate leap years 2024-11-10 23:02:43 +01:00
rtc-mcp795.c rtc: mcp795: drop unneeded MODULE_ALIAS 2024-04-17 01:39:35 +02:00
rtc-meson-vrtc.c rtc: meson-vrtc: drop needless struct meson_vrtc_data::rtc member 2025-03-05 23:08:00 +01:00
rtc-meson.c rtc: remove unneeded 'fast_io' parameter in regmap_config 2025-09-16 17:38:21 +02:00
rtc-moxart.c
rtc-mpc5121.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-mpfs.c rtc: mpfs: switch to devm_device_init_wakeup 2025-03-17 11:51:49 +01:00
rtc-msc313.c
rtc-msm6242.c
rtc-mt2712.c
rtc-mt6397.c rtc: mt6359: Add mt6357 support 2025-06-02 00:25:32 +02:00
rtc-mt7622.c rtc: Switch back to struct platform_driver::remove() 2024-11-10 22:58:28 +01:00
rtc-mv.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-mxc.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-mxc_v2.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-nct3018y.c rtc: nct3018y: convert from round_rate() to determine_rate() 2025-08-03 02:57:05 +02:00
rtc-ntxec.c
rtc-nxp-bbnsm.c rtc: nxp-bbnsm: Use resource managed API to simplify code 2025-03-03 22:52:29 +01:00
rtc-omap.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-opal.c
rtc-optee.c rtc: optee: make optee_rtc_pm_ops static 2025-10-05 22:44:16 +02:00
rtc-palmas.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-pcap.c rtc: pcap: Drop no-op remove function 2023-10-13 12:29:08 +02:00
rtc-pcf2123.c
rtc-pcf2127.c rtc: pcf2127: fix watchdog interrupt mask on pcf2131 2025-10-05 23:30:10 +02:00
rtc-pcf8523.c rtc: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-07-07 00:40:29 +02:00
rtc-pcf8563.c rtc: pcf8563: convert from round_rate() to determine_rate() 2025-08-03 02:57:06 +02:00
rtc-pcf8583.c rtc: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-07-07 00:40:29 +02:00
rtc-pcf85063.c rtc: pcf85063: convert from round_rate() to determine_rate() 2025-08-03 02:57:05 +02:00
rtc-pcf85363.c rtc: pcf85363: fix wrong mask/val parameters in regmap_update_bits call 2023-10-15 22:37:57 +02:00
rtc-pic32.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-pl030.c rtc: pl030: drop needless struct pl030_rtc::rtc member 2025-03-05 23:08:00 +01:00
rtc-pl031.c rtc: pl031: document struct pl031_vendor_data members 2025-03-07 22:46:29 +01:00
rtc-pm8xxx.c rtc: pm8xxx: drop unused module alias 2025-05-24 23:58:23 +02:00
rtc-ps3.c
rtc-pxa.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-r7301.c rtc: rtc7301: Support byte-addressed IO 2023-10-15 22:37:25 +02:00
rtc-r9701.c
rtc-rc5t583.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-rc5t619.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-renesas-rtca3.c rtc: renesas-rtca3: Disable interrupts only if the RTC is enabled 2025-03-11 15:11:20 +01:00
rtc-rk808.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-rp5c01.c
rtc-rs5c313.c
rtc-rs5c348.c
rtc-rs5c372.c rtc: rs5c372: fix Wvoid-pointer-to-enum-cast warning 2023-08-16 01:32:08 +02:00
rtc-rtd119x.c rtc: Switch back to struct platform_driver::remove() 2024-11-10 22:58:28 +01:00
rtc-rv3028.c rtc: rv3028: convert from round_rate() to determine_rate() 2025-08-03 02:57:06 +02:00
rtc-rv3029c2.c rtc: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-07-07 00:40:29 +02:00
rtc-rv3032.c rtc: rv3032: convert from round_rate() to determine_rate() 2025-08-03 02:57:06 +02:00
rtc-rv8803.c rtc: rv8803: add wakeup-source support 2024-01-15 22:29:48 +01:00
rtc-rx4581.c
rtc-rx6110.c rtc: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-07-07 00:40:29 +02:00
rtc-rx8010.c rtc: Drop explicit initialization of struct i2c_device_id::driver_data to 0 2024-07-07 00:40:29 +02:00
rtc-rx8025.c
rtc-rx8111.c rtc: rx8111: handle VLOW flag 2024-05-07 23:40:10 +02:00
rtc-rx8581.c rtc: rx8581: drop needless struct rx8581 2025-03-05 23:08:01 +01:00
rtc-rzn1.c rtc: rzn1: support input frequencies other than 32768Hz 2025-06-01 23:53:02 +02:00
rtc-s3c.c rtc: s3c: Drop support for S3C2410 2025-09-16 17:38:20 +02:00
rtc-s3c.h rtc: s3c: Drop support for S3C2410 2025-09-16 17:38:20 +02:00
rtc-s5m.c rtc: s5m: replace open-coded read/modify/write registers with regmap helpers 2025-06-23 23:58:40 +02:00
rtc-s32g.c rtc: s32g: add NXP S32G2/S32G3 SoC support 2025-05-25 23:27:56 +02:00
rtc-s35390a.c rtc: s35390a: drop needless struct s35390a::rtc member 2025-03-05 23:08:01 +01:00
rtc-sa1100.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-sa1100.h
rtc-sc27xx.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-sd2405al.c rtc: sd2405al: Add I2C address. 2025-10-05 22:51:06 +02:00
rtc-sd3078.c rtc: sd3078: drop needless struct sd3078 2025-03-05 23:08:01 +01:00
rtc-sh.c rtc: sh: Convert to DEFINE_SIMPLE_DEV_PM_OPS() 2025-07-22 12:59:22 +02:00
rtc-snvs.c
rtc-spacemit-p1.c rtc: spacemit: support the SpacemiT P1 RTC 2025-09-16 17:38:21 +02:00
rtc-spear.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-ssd202d.c rtc: Add support for the SSD202D RTC 2023-10-16 16:54:15 +02:00
rtc-st-lpc.c rtc: st-lpc: Use IRQF_NO_AUTOEN flag in request_irq() 2024-11-10 23:01:59 +01:00
rtc-starfire.c
rtc-stk17ta8.c
rtc-stm32.c rtc: stm32: Constify static 'pinctrl_desc' 2025-06-18 13:26:37 +02:00
rtc-stmp3xxx.c rtc: Switch back to struct platform_driver::remove() 2024-11-10 22:58:28 +01:00
rtc-sun4v.c
rtc-sun6i.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-sunplus.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-sunxi.c rtc: Explicitly include correct DT includes 2023-07-27 23:31:29 +02:00
rtc-tegra.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-test.c treewide, timers: Rename from_timer() to timer_container_of() 2025-06-08 09:07:37 +02:00
rtc-ti-k3.c rtc: Explicitly include correct DT includes 2023-07-27 23:31:29 +02:00
rtc-tps6586x.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-tps6594.c rtc: tps6594: Fix integer overflow on 32bit systems 2025-01-13 00:20:55 +01:00
rtc-tps65910.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-twl.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-vt8500.c rtc: Switch back to struct platform_driver::remove() 2024-11-10 22:58:28 +01:00
rtc-wilco-ec.c
rtc-wm831x.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-wm8350.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-x1205.c rtc: x1205: Fix Xicor X1205 vendor prefix 2025-09-16 17:38:21 +02:00
rtc-xgene.c rtc: use boolean values with device_init_wakeup() 2025-01-09 18:29:24 +01:00
rtc-zynqmp.c rtc: zynqmp: Restore alarm functionality after kexec transition 2025-10-05 23:17:46 +02:00
sysfs.c rtc: sysfs: use __ATTRIBUTE_GROUPS() 2025-07-22 13:06:19 +02:00
test_rtc_lib.c rtc: Rename lib_test to test_rtc_lib 2025-07-22 12:56:58 +02:00