Messages in this thread | | | From | Thomas Gleixner <> | Subject | Re: [timekeeping] 3aeaac747d: PANIC:early_exception | Date | Fri, 06 May 2022 18:01:29 +0200 |
| |
On Fri, May 06 2022 at 12:12, Jason A. Donenfeld wrote: > On Fri, May 06, 2022 at 09:59:13AM +0200, Thomas Gleixner wrote: >> +/** >> + * random_get_entropy_fallback - Returns the raw clock source value, >> + * used by random.c for platforms with no valid random_get_entropy(). >> + */ >> +unsigned long random_get_entropy_fallback(void) >> +{ >> + struct tk_read_base *tkr = &tk_core.timekeeper.tkr_mono; >> + struct clocksource *clock = READ_ONCE(tkr->clock); >> + >> + if (!timekeeping_suspended && clock) >> + return clock->read(clock); >> + return 0; >> +} >> +EXPORT_SYMBOL_GPL(random_get_entropy_fallback); > > I tried to address this already in > <https://lore.kernel.org/lkml/20220505002910.IAcnpEOE2zR2ibERl4Lh3Y_PMmtb0Rf43lVevgztJiM@z/>, > though yours looks better with the READ_ONCE() around clock, and I'll > send a v8 doing it that way. I didn't realize that clock could become > NULL again after becoming non-NULL.
This happens at early boot where clock is NULL.
> I'm not quite sure I understand the purpose of !timekeeping_suspended > there, though. I'm not seeing the path where reading with it suspended > negatively affects things. I'll take your word for it though.
Some clocks are not accessible during suspend.
Thanks,
tglx
| |