Thanks Rodrigo for reviewing this. On Mon, 2023-08-07 at 13:56 -0400, Vivi, Rodrigo wrote: > On Wed, Aug 02, 2023 at 04:35:01PM -0700, Alan Previn wrote: > > When suspending, add a timeout when calling > > intel_gt_pm_wait_for_idle else if we have a lost > > G2H event that holds a wakeref (which would be > > indicating of a bug elsewhere in the driver), we > > get to complete the suspend-resume cycle, albeit > > without all the lower power hw counters hitting > > its targets, instead of hanging in the kernel. > > alan:snip
> > -int intel_wakeref_wait_for_idle(struct intel_wakeref *wf) > > +int intel_wakeref_wait_for_idle(struct intel_wakeref *wf, int timeout_ms) > > { > > - int err; > > + int err = 0; > > > > might_sleep(); > > > > - err = wait_var_event_killable(&wf->wakeref, > > - !intel_wakeref_is_active(wf)); > > + if (!timeout_ms) > > + err = wait_var_event_killable(&wf->wakeref, > > + !intel_wakeref_is_active(wf)); > > + else if (wait_var_event_timeout(&wf->wakeref, > > + !intel_wakeref_is_active(wf), > > + msecs_to_jiffies(timeout_ms)) < 1) > > + err = -ETIME; > > it looks to me that -ETIMEDOUT would be a better error. alan: okay - will do, thanks.