Index | Thread | Search

From:
Claudio Jeker <cjeker@diehard.n-r-g.com>
Subject:
Re: vio: Reduce code duplication in control queue handling
To:
Stefan Fritsch <sf@openbsd.org>
Cc:
Alexander Bluhm <alexander.bluhm@gmx.net>, tech@openbsd.org
Date:
Fri, 6 Sep 2024 10:24:19 +0200

Download raw body.

Thread
On Fri, Sep 06, 2024 at 10:18:52AM +0200, Stefan Fritsch wrote:
> Hi,
> 
> On Wed, 4 Sep 2024, Alexander Bluhm wrote:
> > Comments inline.
> 
> Some answers inline. New diff below.
> 
> > >  
> > > -	if ((r = vio_wait_ctrl(sc)) != 0)
> > > -		return r;
> > > +	while (sc->sc_ctrl_inuse != FREE) {
> > > +		if (sc->sc_ctrl_inuse == RESET || vio_needs_reset(sc))
> > > +			return ENXIO;
> > > +		r = tsleep_nsec(&sc->sc_ctrl_inuse, PRIBIO, "viowait", INFSLP);
> > 
> > The old code aborted if sleep() returned an error.
> 
> In the absence of PCATCH or a timeout, tsleep should not return an error. 
> But I added a return anyway.

Correct. This should not return an error. Maybe a KASSERT is enough.
I wonder why this uses PRIBIO here? This is not a disk IO wait.

-- 
:wq Claudio