Re: [PATCH RESEND 2/6] rtc-cmos: dont touch alarm registers during update

Greg KH
2021-10-18T05:58:57Z

On Sun, Oct 17, 2021 at 09:39:23PM +0200, Mateusz Jończyk wrote:
> Some Intel chipsets disconnect the time and date RTC registers when the
> clock update is in progress: during this time reads may return bogus
> values and writes fail silently. This includes the RTC alarm registers.
> [1]
>
> cmos_read_alarm() and cmos_set_alarm() did not take account for that,
> which caused alarm time reads to sometimes return bogus values. This can
> be shown with a test patch that I am attaching to this patch series.
> Setting the alarm clock also probably did fail sometimes.
>
> To make this patch suitable for inclusion in stable kernels, I'm using a
> simple method for avoiding the RTC update cycle. This method is used in
> mach_set_rtc_mmss() in arch/x86/kernel/rtc.c. A more elaborate algorithm
> - as in mc146818_get_time() in drivers/rtc/rtc-mc146818-lib.c - would be
> too complcated for stable. [2]

No, just do it properly the first time, do not worry about stable
kernels, we can just take the also-correct version for backporting if
needed.

thanks,

greg k-h