Re: [PATCH 7/7] Revert "rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ"
From: Ville Syrjälä <hidden>
Date: 2021-09-14 08:07:22
On Sun, Sep 12, 2021 at 02:42:14PM +0200, Mateusz Jończyk wrote:
Revert
commit 6950d046eb6e ("rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ")
and add a comment.
As described in a previous
commit 66e4f4a9cc38 ("rtc: cmos: Use spin_lock_irqsave() in cmos_interrupt()")
from February 2020:
cmos_interrupt() isn't always called from hardirq context, so
we must use spin_lock_irqsave() & co.
Indeed, cmos_interrupt() is called from cmos_check_wkalrm(), which is
called from cmos_resume() - apparently not in an interrupt context.
A later
commit 6950d046eb6e ("rtc: cmos: Replace spin_lock_irqsave with spin_lock in hard IRQ")
did not take account of this and changed spin_lock_irqsave() to spin_lock().
This may cause a deadlock as quoted in the body of
commit 66e4f4a9cc38 ("rtc: cmos: Use spin_lock_irqsave() in cmos_interrupt()")
mentioned earlier.This regression was supposed to be fixed by https://lore.kernel.org/linux-rtc/20210305122140.28774-1-chris@chris-wilson.co.uk/ (local) What happened to that one? I don't see it in Linus's tree... -- Ville Syrjälä Intel