Re: Intermittent boot failure after 6492fed7d8c9 (v6.0-rc1)

From: Mel Gorman
Date: Mon Oct 10 2022 - 13:50:24 EST


On Mon, Oct 10, 2022 at 04:47:50PM +0200, Rafael J. Wysocki wrote:
> Hi Mel,
>
> Thanks for the report!
>
> On Mon, Oct 10, 2022 at 4:25 PM Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> wrote:
> >
> > Hi Rafael,
> >
> > I'm seeing intermittent boot failures after 6492fed7d8c9 ("rtc: rtc-cmos:
> > Do not check ACPI_FADT_LOW_POWER_S0") due to a NULL pointer exception
> > early in boot. It fails to boot 5 times after 10 boot attempts and I've
> > only observed it on one machine so far. Either a revert or the patch below
> > fixes it but it's unlikely it is the correct fix.
> >
> > --- drivers/rtc/rtc-cmos.c.orig 2022-10-10 15:11:50.335756567 +0200
> > +++ drivers/rtc/rtc-cmos.c 2022-10-10 15:11:53.211756691 +0200
> > @@ -1209,7 +1209,7 @@
> > * Or else, ACPI SCI is enabled during suspend/resume only,
> > * update rtc irq in that case.
> > */
> > - if (cmos_use_acpi_alarm())
> > + if (cmos_use_acpi_alarm() && cmos)
> > cmos_interrupt(0, (void *)cmos->rtc);
> > else {
> > /* Fix me: can we use cmos_interrupt() here as well? */
>
> It looks like I've exposed a race condition there.
>
> Generally speaking, it is misguided to install an event handler that
> is not ready to handle the event at that time before making sure that
> the event is disabled.
>
> Does the attached patch help?
>

It failed 3/10 times. That's less than the previous 5/10 failures but I
cannot be certain it helped without running a lot more boot tests. The
failure happens in the same function as before.

--
Mel Gorman
SUSE Labs