Index | Thread | Search

From:
Jonathan Gray <jsg@jsg.id.au>
Subject:
Re: Small tsleep_nsec(9) fix
To:
Marcus Glocker <marcus@nazgul.ch>
Cc:
tech@openbsd.org
Date:
Sat, 23 May 2026 20:42:55 +1000

Download raw body.

Thread
  • Vitaliy Makkoveev:

    Small tsleep_nsec(9) fix

  • On Sat, May 23, 2026 at 12:19:58PM +0200, Marcus Glocker wrote:
    > On Sat, May 23, 2026 at 04:22:40PM +1000, Jonathan Gray wrote:
    > 
    > > On Sat, May 23, 2026 at 08:11:19AM +0200, Marcus Glocker wrote:
    > > > On Sat, May 23, 2026 at 03:53:18PM +1000, Jonathan Gray wrote:
    > > > 
    > > > > On Sat, May 23, 2026 at 06:50:43AM +0200, Marcus Glocker wrote:
    > > > > > Found while poking around for other stuff:
    > > > > > 
    > > > > > Use the real sc address for tsleep identification instead of the
    > > > > > stack pointer address.
    > > > > > 
    > > > > > Ok?
    > > > > 
    > > > > these would be better as &nowake as there is no wakeup()
    > > > 
    > > > Like that?
    > > 
    > > not quite, use the global nowake
    > > 
    > > sys/sys/systm.h:extern int nowake;		/* dead wakeup(9) channel */
    > > sys/kern/kern_synch.c:int nowake;
    > 
    > Oh, I wasn't aware that we have a global nowake.  Everyday a new
    > learning :-)
    
    ok jsg@
    
    > 
    > 
    > Index: sys/dev/i2c/ietp.c
    > ===================================================================
    > RCS file: /cvs/src/sys/dev/i2c/ietp.c,v
    > diff -u -p -u -p -r1.4 ietp.c
    > --- sys/dev/i2c/ietp.c	23 May 2026 05:11:32 -0000	1.4
    > +++ sys/dev/i2c/ietp.c	23 May 2026 10:17:46 -0000
    > @@ -334,7 +334,7 @@ ietp_sleep(struct ietp_softc *sc, int ms
    >  	if (cold)
    >  		delay(ms * 1000);
    >  	else
    > -		tsleep_nsec(sc, PWAIT, "ietp", MSEC_TO_NSEC(ms));
    > +		tsleep_nsec(&nowake, PWAIT, "ietp", MSEC_TO_NSEC(ms));
    >  }
    >  
    >  int
    > Index: sys/dev/i2c/ihidev.c
    > ===================================================================
    > RCS file: /cvs/src/sys/dev/i2c/ihidev.c,v
    > diff -u -p -u -p -r1.42 ihidev.c
    > --- sys/dev/i2c/ihidev.c	23 May 2026 05:11:32 -0000	1.42
    > +++ sys/dev/i2c/ihidev.c	23 May 2026 10:17:46 -0000
    > @@ -300,7 +300,7 @@ ihidev_sleep(struct ihidev_softc *sc, in
    >  	if (cold)
    >  		delay(ms * 1000);
    >  	else
    > -		tsleep_nsec(sc, PWAIT, "ihidev", MSEC_TO_NSEC(ms));
    > +		tsleep_nsec(&nowake, PWAIT, "ihidev", MSEC_TO_NSEC(ms));
    >  }
    >  
    >  int
    > Index: sys/dev/i2c/sambat.c
    > ===================================================================
    > RCS file: /cvs/src/sys/dev/i2c/sambat.c,v
    > diff -u -p -u -p -r1.2 sambat.c
    > --- sys/dev/i2c/sambat.c	22 May 2026 21:01:06 -0000	1.2
    > +++ sys/dev/i2c/sambat.c	23 May 2026 10:17:46 -0000
    > @@ -276,7 +276,7 @@ sambat_mbox_write(struct sambat_softc *s
    >  	if (cold)
    >  		delay(5000);
    >  	else
    > -		tsleep_nsec(sc, PWAIT, "sambat", USEC_TO_NSEC(5000));
    > +		tsleep_nsec(&nowake, PWAIT, "sambat", USEC_TO_NSEC(5000));
    >  
    >  	return 0;
    >  }
    > 
    
    
  • Vitaliy Makkoveev:

    Small tsleep_nsec(9) fix