[Skiboot] [RFC PATCH] FSP: Solidify timeout poll code

Benjamin Herrenschmidt benh at au1.ibm.com
Tue Dec 9 06:47:03 AEDT 2014


On Mon, 2014-12-08 at 23:36 +1100, Benjamin Herrenschmidt wrote:

> > -static void fsp_timeout_poll(void *data __unused)
> > +static void __fsp_timeout_poll(void *data __unused)
> >  {
> >  	u64 now = mftb();
> >  	u64 timeout_val = 0;
> > @@ -1952,6 +1953,8 @@ static void fsp_timeout_poll(void *data __unused)
> >  				goto next_bit;
> >  			}
> >  			req = list_top(&cmdclass->msgq,	struct fsp_msg, link);
> > +			if (!req)
> > +				goto next_bit;

You didn't drop the fsp lock ... you should also clear the bit and
class->timeout..

I think we might be failing to update these when cancelling requests.

Ben.

> >  			w0 = req->word0;
> >  			w1 = req->word1;
> >  			mstate = req->state;
> > @@ -1976,6 +1979,14 @@ static void fsp_timeout_poll(void *data __unused)
> >  	}
> >  }
> >  
> > +static void fsp_timeout_poll(void *data __unused)
> > +{
> > +	if (try_lock(&fsp_timeout_poller_lock)) {
> > +		__fsp_timeout_poll(data);
> > +		unlock(&fsp_timeout_poller_lock);
> > +	}
> > +}
> 
> I don't like that, we sometimes call poll in a tight loop , I'd rather
> be a little bit smarter and:
> 
> 
> 	/* The lowest granularity for a message timeout is 30 secs.
> 	 * So every 30secs, check if there is any message
> 	 * waiting for a response from the FSP
> 	 */
> 	if ((tb_compare(now, timeout_timer) == TB_AAFTERB) ||
> 		(tb_compare(now, timeout_timer) == TB_AEQUALB))
> 
>       ---> take it here
> 
> 		timeout_timer = now + secs_to_tb(30);
> 
> 
> 	else
> 		return;
> 
> (We might need to re-check we have expired before updating timeout_timer
> so we don't have two racing)
> 
> Cheers,
> Ben.
> 
> >  void fsp_opl(void)
> >  {
> >  	struct dt_node *iplp;
> > 
> > _______________________________________________
> > Skiboot mailing list
> > Skiboot at lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/skiboot
> 
> 
> _______________________________________________
> Skiboot mailing list
> Skiboot at lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot




More information about the Skiboot mailing list