On Tue, Sep 05, 2023 at 05:24:29PM -0500, Stephen Boyd wrote: > Quoting Andy Shevchenko (2023-08-31 06:53:14) > > On Wed, Aug 30, 2023 at 06:14:01PM -0700, Stephen Boyd wrote: > > > It's possible for the polling loop in busy_loop() to get scheduled away > > > for a long time. > > > > > > status = ipc_read_status(scu); > > > <long time scheduled away> > > > if (!(status & IPC_STATUS_BUSY)) > > > > > > If this happens, then the status bit could change and this function > > > would never test it again after checking the jiffies against the timeout > > > limit. Polling code should check the condition one more time after the > > > timeout in case this happens. > > > > > > The read_poll_timeout() helper implements this logic, and is shorter, so > > > simply use that helper here. > > > > I don't remember by heart, but on some older Intel hardware this might have > > been called during early stages where ktime() is not functional yet. > > > > Is this still a case here? > > I have no idea if that happens in early stages. I briefly browsed the current tree and it seems it's not the case. > What about > suspend/resume though? I suppose timekeeping could be suspended in that > case, so we can't really check anything with ktime. Hmm... SCU itself is running all the time I think. The timekeeping depends on the platform, but is it really the case? I dunno. > I can rework this patch to simply recheck the busy bit so that we don't > have to figure out if the code is called early or from suspend paths. Yeah, probably we can do this and leave this nice cleanup in place. -- With Best Regards, Andy Shevchenko