Skip to contentSkip to conversation

rtc: cmos: avoid UIP when writing/reading alarm time

PATCH In review Kane Chen 3 participants 8 messages Dec 7, 2022 – Dec 11, 2022 Stable branch

lore
Share & tools
lore

Kane Chen

author
#0 lore raw

PATCH 1/1 rtc: cmos: avoid UIP when writing/reading alarm time

While runnings s0ix cycling test based on rtc alarm wakeup on ADL-P devices, We found the data from CMOS_READ is not reasonable and causes RTC wake up fail.

With the below changes, we don't see unreasonable data from cmos and issue is gone.

cd17420: rtc: cmos: avoid UIP when writing alarm time
cdedc45: rtc: cmos: avoid UIP when reading alarm time
ec5895c: rtc: mc146818-lib: extract mc146818_avoid_UIP
ea6fa49: rtc: mc146818-lib: fix RTC presence check
13be2ef: rtc: cmos: Disable irq around direct invocation of cmos_interrupt() 0dd8d6c: rtc: Check return value from mc146818_get_time()
e1aba37: rtc: cmos: remove stale REVISIT comments
6950d04: rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ
d35786b: rtc: mc146818-lib: change return values of mc146818_get_time()
ebb22a0: rtc: mc146818: Dont test for bit 0-5 in Register D 211e5db: rtc: mc146818: Detect and handle broken RTCs
dcf257e: rtc: mc146818: Reduce spinlock section in mc146818_set_time() 05a0302: rtc: mc146818: Prevent reading garbage

All of the above patches are landed on 6.0.11 stable kernel I'd like pick the above patches back to 5.10 longterm kernel Thanks

Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 4 lines · Kane Chen

While runnings s0ix cycling test based on rtc alarm wakeup on ADL-P devices, We found the data from CMOS_READ is not reasonable and causes RTC wake up fail.

With the below changes, we don't see unreasonable data from cmos and issue is gone.

Thanks for the analysis, I can queue most of these up. There are two which won't go in:

Quoted 8 lines

cd17420: rtc: cmos: avoid UIP when writing alarm time
cdedc45: rtc: cmos: avoid UIP when reading alarm time
ec5895c: rtc: mc146818-lib: extract mc146818_avoid_UIP
ea6fa49: rtc: mc146818-lib: fix RTC presence check
13be2ef: rtc: cmos: Disable irq around direct invocation of cmos_interrupt() 0dd8d6c: rtc: Check return value from mc146818_get_time()
e1aba37: rtc: cmos: remove stale REVISIT comments
6950d04: rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ

This one fixes a commit which isn't in the 5.10 tree.

Quoted 4 lines

d35786b: rtc: mc146818-lib: change return values of mc146818_get_time()
ebb22a0: rtc: mc146818: Dont test for bit 0-5 in Register D 211e5db: rtc: mc146818: Detect and handle broken RTCs
dcf257e: rtc: mc146818: Reduce spinlock section in mc146818_set_time()

This one looks like an optimization.

Signature · 2 lines
Thanks,
Sasha
author
#2 lore raw
Quoted 33 lines

-----Original Message-----
From: Sasha Levin <[email protected]>
Sent: Wednesday, December 7, 2022 1:13 PM
To: Chen, Kane <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v1] rtc: cmos: avoid UIP when writing/reading alarm time

Quoted 2 lines · Kane Chen

While runnings s0ix cycling test based on rtc alarm wakeup on ADL-P devices, We found the data from CMOS_READ is not reasonable and causes

RTC wake up fail.

Quoted 2 lines

With the below changes, we don't see unreasonable data from cmos and

issue is gone.

Thanks for the analysis, I can queue most of these up. There are two which won't go in:

Quoted 10 lines

cd17420: rtc: cmos: avoid UIP when writing alarm time
cdedc45: rtc: cmos: avoid UIP when reading alarm time
ec5895c: rtc: mc146818-lib: extract mc146818_avoid_UIP
ea6fa49: rtc: mc146818-lib: fix RTC presence check 13be2ef: rtc: cmos: Disable irq around direct invocation of cmos_interrupt()
0dd8d6c: rtc: Check return value from mc146818_get_time()
e1aba37: rtc: cmos: remove stale REVISIT comments 6950d04: rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ

This one fixes a commit which isn't in the 5.10 tree.

Quoted 8 lines
Quoted 4 lines

d35786b: rtc: mc146818-lib: change return values of mc146818_get_time()
ebb22a0: rtc: mc146818: Dont test for bit 0-5 in Register D 211e5db: rtc: mc146818: Detect and handle broken RTCs
dcf257e: rtc: mc146818: Reduce spinlock section in mc146818_set_time()

This one looks like an optimization.

--

I'm sorry,
I thought dcf257e and 6950d04, 13be2ef are also required to avoid cherry-pick conflict After checking again, dcf257e, 6950d04, 13be2ef are not needed.

Here is the list I would like to pick
cd17420: rtc: cmos: avoid UIP when writing alarm time
cdedc45: rtc: cmos: avoid UIP when reading alarm time
ec5895c: rtc: mc146818-lib: extract mc146818_avoid_UIP
ea6fa49: rtc: mc146818-lib: fix RTC presence check
0dd8d6c: rtc: Check return value from mc146818_get_time()
e1aba37: rtc: cmos: remove stale REVISIT comments
d35786b: rtc: mc146818-lib: change return values of mc146818_get_time()
ebb22a0: rtc: mc146818: Dont test for bit 0-5 in Register D 211e5db: rtc: mc146818: Detect and handle broken RTCs 05a0302: rtc: mc146818: Prevent reading garbage

Thanks a lot

Quoted 2 lines

Thanks,
Sasha

#3 lore raw

W dniu 7.12.2022 o 07:51, Chen, Kane pisze:

Quoted 52 lines
Quoted 29 lines

-----Original Message-----
From: Sasha Levin <[email protected]>
Sent: Wednesday, December 7, 2022 1:13 PM
To: Chen, Kane <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v1] rtc: cmos: avoid UIP when writing/reading alarm time

Quoted 2 lines · Kane Chen

While runnings s0ix cycling test based on rtc alarm wakeup on ADL-P devices, We found the data from CMOS_READ is not reasonable and causes

RTC wake up fail.

Quoted 1 line

With the below changes, we don't see unreasonable data from cmos and

issue is gone.

Thanks for the analysis, I can queue most of these up. There are two which won't go in:

Quoted 10 lines

cd17420: rtc: cmos: avoid UIP when writing alarm time
cdedc45: rtc: cmos: avoid UIP when reading alarm time
ec5895c: rtc: mc146818-lib: extract mc146818_avoid_UIP
ea6fa49: rtc: mc146818-lib: fix RTC presence check 13be2ef: rtc: cmos: Disable irq around direct invocation of cmos_interrupt()
0dd8d6c: rtc: Check return value from mc146818_get_time()
e1aba37: rtc: cmos: remove stale REVISIT comments 6950d04: rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ

This one fixes a commit which isn't in the 5.10 tree.

Quoted 7 lines
Quoted 4 lines

d35786b: rtc: mc146818-lib: change return values of mc146818_get_time()
ebb22a0: rtc: mc146818: Dont test for bit 0-5 in Register D 211e5db: rtc: mc146818: Detect and handle broken RTCs
dcf257e: rtc: mc146818: Reduce spinlock section in mc146818_set_time()

This one looks like an optimization.

--

I'm sorry,
I thought dcf257e and 6950d04, 13be2ef are also required to avoid cherry-pick conflict After checking again, dcf257e, 6950d04, 13be2ef are not needed.

Here is the list I would like to pick
cd17420: rtc: cmos: avoid UIP when writing alarm time
cdedc45: rtc: cmos: avoid UIP when reading alarm time
ec5895c: rtc: mc146818-lib: extract mc146818_avoid_UIP
ea6fa49: rtc: mc146818-lib: fix RTC presence check
0dd8d6c: rtc: Check return value from mc146818_get_time()
e1aba37: rtc: cmos: remove stale REVISIT comments
d35786b: rtc: mc146818-lib: change return values of mc146818_get_time()
ebb22a0: rtc: mc146818: Dont test for bit 0-5 in Register D 211e5db: rtc: mc146818: Detect and handle broken RTCs 05a0302: rtc: mc146818: Prevent reading garbage

Quoted 5 lines

Thanks a lot

Quoted 3 lines

Thanks,
Sasha

Hello,

I think that you should also pick these patches which fix issues in the series that is prepared for 5.4:

1) commit 7372971c1be5 ("rtc: mc146818-lib: fix signedness bug in mc146818_get_time()")

which fixes d35786b: rtc: mc146818-lib: change return values of mc146818_get_time()

2) commit 13be2efc390a ("rtc: cmos: Disable irq around direct invocation of cmos_interrupt()")

which fixes 6950d04: rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ and is not prepared for 5.4 stable even though it was mentioned above.

3) commit 811f5559270f ("rtc: mc146818-lib: fix locking in mc146818_set_time")

which fixes dcf257e: rtc: mc146818: Reduce spinlock section in mc146818_set_time()

When it comes to these two patches:

cd17420: rtc: cmos: avoid UIP when writing alarm time
cdedc45: rtc: cmos: avoid UIP when reading alarm time

I used to think that the issues they fix were very unlikely to happen in practice, so I did not submit them into stable. So thanks for proving me wrong.

Greetings,
Mateusz

maintainer
#4 lore raw
Quoted 67 lines · Mateusz Jończyk

W dniu 7.12.2022 o 07:51, Chen, Kane pisze:

Quoted 52 lines
Quoted 29 lines

-----Original Message-----
From: Sasha Levin <[email protected]>
Sent: Wednesday, December 7, 2022 1:13 PM
To: Chen, Kane <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v1] rtc: cmos: avoid UIP when writing/reading alarm time

Quoted 2 lines · Kane Chen

While runnings s0ix cycling test based on rtc alarm wakeup on ADL-P devices, We found the data from CMOS_READ is not reasonable and causes

RTC wake up fail.

Quoted 1 line

With the below changes, we don't see unreasonable data from cmos and

issue is gone.

Thanks for the analysis, I can queue most of these up. There are two which won't go in:

Quoted 10 lines

cd17420: rtc: cmos: avoid UIP when writing alarm time
cdedc45: rtc: cmos: avoid UIP when reading alarm time
ec5895c: rtc: mc146818-lib: extract mc146818_avoid_UIP
ea6fa49: rtc: mc146818-lib: fix RTC presence check 13be2ef: rtc: cmos: Disable irq around direct invocation of cmos_interrupt()
0dd8d6c: rtc: Check return value from mc146818_get_time()
e1aba37: rtc: cmos: remove stale REVISIT comments 6950d04: rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ

This one fixes a commit which isn't in the 5.10 tree.

Quoted 7 lines
Quoted 4 lines

d35786b: rtc: mc146818-lib: change return values of mc146818_get_time()
ebb22a0: rtc: mc146818: Dont test for bit 0-5 in Register D 211e5db: rtc: mc146818: Detect and handle broken RTCs
dcf257e: rtc: mc146818: Reduce spinlock section in mc146818_set_time()

This one looks like an optimization.

--

I'm sorry,
I thought dcf257e and 6950d04, 13be2ef are also required to avoid cherry-pick conflict After checking again, dcf257e, 6950d04, 13be2ef are not needed.

Here is the list I would like to pick
cd17420: rtc: cmos: avoid UIP when writing alarm time
cdedc45: rtc: cmos: avoid UIP when reading alarm time
ec5895c: rtc: mc146818-lib: extract mc146818_avoid_UIP
ea6fa49: rtc: mc146818-lib: fix RTC presence check
0dd8d6c: rtc: Check return value from mc146818_get_time()
e1aba37: rtc: cmos: remove stale REVISIT comments
d35786b: rtc: mc146818-lib: change return values of mc146818_get_time()
ebb22a0: rtc: mc146818: Dont test for bit 0-5 in Register D 211e5db: rtc: mc146818: Detect and handle broken RTCs 05a0302: rtc: mc146818: Prevent reading garbage

Quoted 5 lines

Thanks a lot

Quoted 3 lines

Thanks,
Sasha

Hello,

I think that you should also pick these patches which fix issues in the series that is prepared for 5.4:

1) commit 7372971c1be5 ("rtc: mc146818-lib: fix signedness bug in mc146818_get_time()")

which fixes d35786b: rtc: mc146818-lib: change return values of mc146818_get_time()

Quoted 8 lines

2) commit 13be2efc390a ("rtc: cmos: Disable irq around direct invocation of cmos_interrupt()")

which fixes 6950d04: rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ and is not prepared for 5.4 stable even though it was mentioned above.

3) commit 811f5559270f ("rtc: mc146818-lib: fix locking in mc146818_set_time")

which fixes dcf257e: rtc: mc146818: Reduce spinlock section in mc146818_set_time()

Ack, will do, thanks.

Signature · 2 lines
Thanks,
Sasha
#5 lore raw

W dniu 9.12.2022 o 01:37, Sasha Levin pisze:

Quoted 70 lines · Mateusz Jończyk
Quoted 69 lines

W dniu 7.12.2022 o 07:51, Chen, Kane pisze:

Quoted 52 lines
Quoted 27 lines

-----Original Message-----
From: Sasha Levin <[email protected]>
Sent: Wednesday, December 7, 2022 1:13 PM
To: Chen, Kane <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v1] rtc: cmos: avoid UIP when writing/reading alarm time

Quoted 2 lines · Kane Chen

While runnings s0ix cycling test based on rtc alarm wakeup on ADL-P devices, We found the data from CMOS_READ is not reasonable and causes

RTC wake up fail.

Quoted 1 line

With the below changes, we don't see unreasonable data from cmos and

issue is gone.

Thanks for the analysis, I can queue most of these up. There are two which won't go in:

Quoted 10 lines

cd17420: rtc: cmos: avoid UIP when writing alarm time
cdedc45: rtc: cmos: avoid UIP when reading alarm time
ec5895c: rtc: mc146818-lib: extract mc146818_avoid_UIP
ea6fa49: rtc: mc146818-lib: fix RTC presence check 13be2ef: rtc: cmos: Disable irq around direct invocation of cmos_interrupt()
0dd8d6c: rtc: Check return value from mc146818_get_time()
e1aba37: rtc: cmos: remove stale REVISIT comments 6950d04: rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ

Quoted 9 lines

This one fixes a commit which isn't in the 5.10 tree.

Quoted 4 lines

d35786b: rtc: mc146818-lib: change return values of mc146818_get_time()
ebb22a0: rtc: mc146818: Dont test for bit 0-5 in Register D 211e5db: rtc: mc146818: Detect and handle broken RTCs
dcf257e: rtc: mc146818: Reduce spinlock section in mc146818_set_time()

This one looks like an optimization.

I'm sorry,
I thought dcf257e and  6950d04, 13be2ef  are also required to avoid cherry-pick conflict After checking again, dcf257e, 6950d04, 13be2ef are not needed.

Here is the list I would like to pick
cd17420: rtc: cmos: avoid UIP when writing alarm time
cdedc45: rtc: cmos: avoid UIP when reading alarm time
ec5895c: rtc: mc146818-lib: extract mc146818_avoid_UIP
ea6fa49: rtc: mc146818-lib: fix RTC presence check
0dd8d6c: rtc: Check return value from mc146818_get_time()
e1aba37: rtc: cmos: remove stale REVISIT comments
d35786b: rtc: mc146818-lib: change return values of mc146818_get_time()
ebb22a0: rtc: mc146818: Dont test for bit 0-5 in Register D 211e5db: rtc: mc146818: Detect and handle broken RTCs 05a0302: rtc: mc146818: Prevent reading garbage

Quoted 5 lines

Thanks a lot

Quoted 3 lines

Thanks,
Sasha

Hello,

I think that you should also pick these patches which fix issues in the series that is prepared for 5.4:

1) commit 7372971c1be5 ("rtc: mc146818-lib: fix signedness bug in mc146818_get_time()")

which fixes d35786b: rtc: mc146818-lib: change return values of mc146818_get_time()

2) commit 13be2efc390a ("rtc: cmos: Disable irq around direct invocation of cmos_interrupt()")

Quoted 8 lines
Quoted 6 lines

which fixes 6950d04: rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ and is not prepared for 5.4 stable even though it was mentioned above.

3) commit 811f5559270f ("rtc: mc146818-lib: fix locking in mc146818_set_time")

which fixes dcf257e: rtc: mc146818: Reduce spinlock section in mc146818_set_time()

Ack, will do, thanks.

Hello,

However, I would like to ask: is it really necessary to include all of these patches in stable? I think that it is very likely that only these patches are sufficient to fix the original problem reported by Kane Chen:

cd17420: rtc: cmos: avoid UIP when writing alarm time
cdedc45: rtc: cmos: avoid UIP when reading alarm time
ec5895c: rtc: mc146818-lib: extract mc146818_avoid_UIP

These patches should be most relevant when using the RTC alarm and are self-contained. So I would like to ask Kane Chen to recheck with these patches only. Other patches change the CMOS RTC reading routines significantly and have a higher risk of introducing regressions (but I am not aware of any outstanding problems).

The last patch of the three:
ec5895c: rtc: mc146818-lib: extract mc146818_avoid_UIP introduces only a new function; it won't apply cleanly over kernel 5.4, but this is straightforward to fix.

Greetings,

Mateusz

maintainer
#6 lore raw
Quoted 82 lines · Mateusz Jończyk

W dniu 9.12.2022 o 01:37, Sasha Levin pisze:

Quoted 70 lines · Mateusz Jończyk
Quoted 69 lines

W dniu 7.12.2022 o 07:51, Chen, Kane pisze:

Quoted 52 lines
Quoted 29 lines

-----Original Message-----
From: Sasha Levin <[email protected]>
Sent: Wednesday, December 7, 2022 1:13 PM
To: Chen, Kane <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v1] rtc: cmos: avoid UIP when writing/reading alarm time

Quoted 2 lines · Kane Chen

While runnings s0ix cycling test based on rtc alarm wakeup on ADL-P devices, We found the data from CMOS_READ is not reasonable and causes

RTC wake up fail.

Quoted 1 line

With the below changes, we don't see unreasonable data from cmos and

issue is gone.

Thanks for the analysis, I can queue most of these up. There are two which won't go in:

Quoted 10 lines

cd17420: rtc: cmos: avoid UIP when writing alarm time
cdedc45: rtc: cmos: avoid UIP when reading alarm time
ec5895c: rtc: mc146818-lib: extract mc146818_avoid_UIP
ea6fa49: rtc: mc146818-lib: fix RTC presence check 13be2ef: rtc: cmos: Disable irq around direct invocation of cmos_interrupt()
0dd8d6c: rtc: Check return value from mc146818_get_time()
e1aba37: rtc: cmos: remove stale REVISIT comments 6950d04: rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ

This one fixes a commit which isn't in the 5.10 tree.

Quoted 7 lines
Quoted 4 lines

d35786b: rtc: mc146818-lib: change return values of mc146818_get_time()
ebb22a0: rtc: mc146818: Dont test for bit 0-5 in Register D 211e5db: rtc: mc146818: Detect and handle broken RTCs
dcf257e: rtc: mc146818: Reduce spinlock section in mc146818_set_time()

This one looks like an optimization.

--

I'm sorry,
I thought dcf257e and  6950d04, 13be2ef  are also required to avoid cherry-pick conflict After checking again, dcf257e, 6950d04, 13be2ef are not needed.

Here is the list I would like to pick
cd17420: rtc: cmos: avoid UIP when writing alarm time
cdedc45: rtc: cmos: avoid UIP when reading alarm time
ec5895c: rtc: mc146818-lib: extract mc146818_avoid_UIP
ea6fa49: rtc: mc146818-lib: fix RTC presence check
0dd8d6c: rtc: Check return value from mc146818_get_time()
e1aba37: rtc: cmos: remove stale REVISIT comments
d35786b: rtc: mc146818-lib: change return values of mc146818_get_time()
ebb22a0: rtc: mc146818: Dont test for bit 0-5 in Register D 211e5db: rtc: mc146818: Detect and handle broken RTCs 05a0302: rtc: mc146818: Prevent reading garbage

Quoted 5 lines

Thanks a lot

Quoted 3 lines

Thanks,
Sasha

Hello,

I think that you should also pick these patches which fix issues in the series that is prepared for 5.4:

1) commit 7372971c1be5 ("rtc: mc146818-lib: fix signedness bug in mc146818_get_time()")

which fixes d35786b: rtc: mc146818-lib: change return values of mc146818_get_time()

2) commit 13be2efc390a ("rtc: cmos: Disable irq around direct invocation of cmos_interrupt()")

Quoted 8 lines
Quoted 6 lines

which fixes 6950d04: rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ and is not prepared for 5.4 stable even though it was mentioned above.

3) commit 811f5559270f ("rtc: mc146818-lib: fix locking in mc146818_set_time")

which fixes dcf257e: rtc: mc146818: Reduce spinlock section in mc146818_set_time()

Ack, will do, thanks.

Hello,

Quoted 7 lines

However, I would like to ask: is it really necessary to include all of these patches in stable? I think that it is very likely that only these patches are sufficient to fix the original problem reported by Kane Chen:

cd17420: rtc: cmos: avoid UIP when writing alarm time
cdedc45: rtc: cmos: avoid UIP when reading alarm time
ec5895c: rtc: mc146818-lib: extract mc146818_avoid_UIP

I would agree that this could be enough to fix the issue that was described, but...

Quoted 5 lines

These patches should be most relevant when using the RTC alarm and are self-contained. So I would like to ask Kane Chen to recheck with these patches only. Other patches change the CMOS RTC reading routines significantly and have a higher risk of introducing regressions (but I am not aware of any outstanding problems).

The rest of the patches do look like fixes that should have been added to stable (or are dependencies of such fixes) on their own. Given those patches are pretty old, any reason to not just include them?

The process works better if we address issues before making users come and complain on the mailing list :)

Signature · 2 lines
Thanks,
Sasha
author
#7 lore raw
Quoted 89 lines

-----Original Message-----
From: Sasha Levin <[email protected]>
Sent: Sunday, December 11, 2022 2:10 PM
To: Mateusz Jończyk <[email protected]>
Cc: Chen, Kane <[email protected]>; [email protected]; Alexandre Belloni <[email protected]>
Subject: Re: [PATCH v1] rtc: cmos: avoid UIP when writing/reading alarm time

Quoted 47 lines · Mateusz Jończyk

W dniu 9.12.2022 o 01:37, Sasha Levin pisze:

Quoted 46 lines · Mateusz Jończyk
Quoted 45 lines

W dniu 7.12.2022 o 07:51, Chen, Kane pisze:

Quoted 44 lines
Quoted 38 lines

-----Original Message-----
From: Sasha Levin <[email protected]>
Sent: Wednesday, December 7, 2022 1:13 PM
To: Chen, Kane <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v1] rtc: cmos: avoid UIP when writing/reading alarm time

Quoted 3 lines · Kane Chen

While runnings s0ix cycling test based on rtc alarm wakeup on ADL-P devices, We found the data from CMOS_READ is not reasonable and causes

RTC wake up fail.

Quoted 2 lines

With the below changes, we don't see unreasonable data from cmos and

issue is gone.

Thanks for the analysis, I can queue most of these up. There are two which won't go in:

Quoted 10 lines

cd17420: rtc: cmos: avoid UIP when writing alarm time
cdedc45: rtc: cmos: avoid UIP when reading alarm time
ec5895c: rtc: mc146818-lib: extract mc146818_avoid_UIP
ea6fa49: rtc: mc146818-lib: fix RTC presence check 13be2ef: rtc: cmos: Disable irq around direct invocation of cmos_interrupt()
0dd8d6c: rtc: Check return value from mc146818_get_time()
e1aba37: rtc: cmos: remove stale REVISIT comments 6950d04: rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ

This one fixes a commit which isn't in the 5.10 tree.

Quoted 6 lines

d35786b: rtc: mc146818-lib: change return values of mc146818_get_time()
ebb22a0: rtc: mc146818: Dont test for bit 0-5 in Register D 211e5db: rtc: mc146818: Detect and handle broken RTCs
dcf257e: rtc: mc146818: Reduce spinlock section in mc146818_set_time()

Quoted 3 lines

This one looks like an optimization.

--

I'm sorry,
I thought dcf257e and  6950d04, 13be2ef  are also required to avoid cherry-pick conflict After checking again, dcf257e, 6950d04, 13be2ef are

not needed.

Quoted 30 lines
Quoted 30 lines
Quoted 30 lines
Quoted 14 lines

Here is the list I would like to pick
cd17420: rtc: cmos: avoid UIP when writing alarm time
cdedc45: rtc: cmos: avoid UIP when reading alarm time
ec5895c: rtc: mc146818-lib: extract mc146818_avoid_UIP
ea6fa49: rtc: mc146818-lib: fix RTC presence check 0dd8d6c: rtc: Check return value from mc146818_get_time()
e1aba37: rtc: cmos: remove stale REVISIT comments
d35786b: rtc: mc146818-lib: change return values of mc146818_get_time()
ebb22a0: rtc: mc146818: Dont test for bit 0-5 in Register D 211e5db: rtc: mc146818: Detect and handle broken RTCs 05a0302: rtc: mc146818: Prevent reading garbage

Quoted 5 lines

Thanks a lot

Quoted 3 lines

Thanks,
Sasha

Hello,

I think that you should also pick these patches which fix issues in the series that is prepared for 5.4:

1) commit 7372971c1be5 ("rtc: mc146818-lib: fix signedness bug in mc146818_get_time()")

which fixes d35786b: rtc: mc146818-lib: change return values of mc146818_get_time()

Quoted 25 lines
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines

2) commit 13be2efc390a ("rtc: cmos: Disable irq around direct invocation of cmos_interrupt()")

which fixes 6950d04: rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ and is not prepared for 5.4 stable even though it was

mentioned above.

Quoted 18 lines
Quoted 8 lines
Quoted 6 lines

3) commit 811f5559270f ("rtc: mc146818-lib: fix locking in mc146818_set_time")

which fixes dcf257e: rtc: mc146818: Reduce spinlock section in mc146818_set_time()

Ack, will do, thanks.

Hello,

However, I would like to ask: is it really necessary to include all of these patches in stable? I think that it is very likely that only these patches are sufficient to fix the original problem reported by Kane Chen:

cd17420: rtc: cmos: avoid UIP when writing alarm time
cdedc45: rtc: cmos: avoid UIP when reading alarm time
ec5895c: rtc: mc146818-lib: extract mc146818_avoid_UIP

"05a0302: rtc: mc146818: Prevent reading garbage" this helps the issue as well I think.

I didn't test these 3 patches alone because it will create conflicts when I pick ec5895c. I'm worried I made things wrong and thought those dependencies are landed for a long time So decided to pick related dependencies eventually.

Pls let me know if you have concern :)

Quoted 18 lines

I would agree that this could be enough to fix the issue that was described, but...

Quoted 5 lines

These patches should be most relevant when using the RTC alarm and are self-contained. So I would like to ask Kane Chen to recheck with these patches only. Other patches change the CMOS RTC reading routines significantly and have a higher risk of introducing regressions (but I am not aware of any outstanding problems).

The rest of the patches do look like fixes that should have been added to stable (or are dependencies of such fixes) on their own. Given those patches are pretty old, any reason to not just include them?

The process works better if we address issues before making users come and complain on the mailing list :)

--
Thanks,
Sasha