Date: Mon, 1 Jul 2019 11:25:12 -0600 From: Warner Losh <imp@bsdimp.com> To: Poul-Henning Kamp <phk@phk.freebsd.dk> Cc: Ian Lepore <ian@freebsd.org>, Andriy Gapon <avg@freebsd.org>, FreeBSD Current <freebsd-current@freebsd.org> Subject: Re: i2c bit banging timeout for SCL Message-ID: <CANCZdfp9MKkq7s4F%2BOHBa%2Bu%2Bb_OfExe0B0cWeZ1aPS5xBG8mXA@mail.gmail.com> In-Reply-To: <93148.1562001288@critter.freebsd.dk> References: <a3538c10-2438-a287-77db-ad390078b274@FreeBSD.org> <7e5d8a06bc2d46263262369464e9348b82263847.camel@freebsd.org> <CANCZdfoFBvmxPtnEL4GOqXTvp6Zd-xrtja4rmUO1rAcy0JdeSw@mail.gmail.com> <93148.1562001288@critter.freebsd.dk>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jul 1, 2019 at 11:14 AM Poul-Henning Kamp <phk@phk.freebsd.dk> wrote: > -------- > In message < > CANCZdfoFBvmxPtnEL4GOqXTvp6Zd-xrtja4rmUO1rAcy0JdeSw@mail.gmail.com>, > Warner Losh writes: > > >The only issue, really, is that this timeout is a busy loop and there may > >be I/O bus contention introduced on these systems. > > Does it have to be a busy loop for the entire duration ? > > Spin for the median, timeout+poll for the rest of the time ? > That's a good suggestion. I'd be inclined to spin for 1 tick or so, then do a timeout per tick after that (eg, shift from DELAY to pause(1)). It won't be super accurate or high performance, but when the devices are slow, that would add only a little extra time. Ideally, that's what we'd do. In the short term, bumping the timeout wouldn't be horrible. Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfp9MKkq7s4F%2BOHBa%2Bu%2Bb_OfExe0B0cWeZ1aPS5xBG8mXA>