Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 09 Apr 2016 14:00:42 -0700
From:      John Baldwin <jhb@freebsd.org>
To:        Steven Hartland <steven.hartland@multiplay.co.uk>
Cc:        svn-src-head@freebsd.org
Subject:   Re: svn commit: r297762 - head/sys/dev/ichiic
Message-ID:  <1865392.rtXenzib4K@ralph.baldwin.cx>
In-Reply-To: <57096645.5060105@multiplay.co.uk>
References:  <201604092018.u39KIYf3096159@repo.freebsd.org> <57096645.5060105@multiplay.co.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Saturday, April 09, 2016 09:29:57 PM Steven Hartland wrote:
> Hi John, it would be nice if the commit message clarified why the change 
> was made, as well as what was changed. This would allow others like 
> myself to learn about the reasons for changes like this, which aren't 
> self explanatory.

Sleeping with a timeout doesn't (currently) work during the initial device
time probe.  All sleep requests used to just return immediately without any
delay.  I recently changed it so that infinite sleeps (no timeout) now work
in preparation for ongoing work to start APs earlier during the boot.
However, we still can't manage timeouts until we have timers and interrupts
from timers, so sleeps with timeouts will now panic (instead of just
returning instantly which the code here probably did not expect).  The
assertion highlighted that this driver was using a tight spin loop during
boot-time attach instead of polling the device periodically (as the author
probably thought they were doing).

> On 09/04/2016 21:18, John Baldwin wrote:
> > Author: jhb
> > Date: Sat Apr  9 20:18:34 2016
> > New Revision: 297762
> > URL: https://svnweb.freebsd.org/changeset/base/297762
> >
> > Log:
> >    Use DELAY() instead of sleeping during boot-time attach.
> >    
> >    Tested by:	Wolfgang Zenker <wolfgang@lyxys.ka.sub.org>
> >
> > Modified:
> >    head/sys/dev/ichiic/ig4_iic.c
> >
> > Modified: head/sys/dev/ichiic/ig4_iic.c
> > ==============================================================================
> > --- head/sys/dev/ichiic/ig4_iic.c	Sat Apr  9 20:05:39 2016	(r297761)
> > +++ head/sys/dev/ichiic/ig4_iic.c	Sat Apr  9 20:18:34 2016	(r297762)
> > @@ -117,7 +117,10 @@ set_controller(ig4iic_softc_t *sc, uint3
> >   			error = 0;
> >   			break;
> >   		}
> > -		mtx_sleep(sc, &sc->io_lock, 0, "i2cslv", 1);
> > +		if (cold)
> > +			DELAY(1000);
> > +		else
> > +			mtx_sleep(sc, &sc->io_lock, 0, "i2cslv", 1);
> >   	}
> >   	return (error);
> >   }
> >
> 


-- 
John Baldwin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1865392.rtXenzib4K>