Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 02 Sep 2016 12:22:42 -0700
From:      John Baldwin <jhb@freebsd.org>
To:        FreeBSD-arch Arch <freebsd-arch@freebsd.org>
Subject:   pause_ms() wrapper
Message-ID:  <2960854.iLOY0Gxipb@ralph.baldwin.cx>

next in thread | raw e-mail | index | archive | help
Figuring out the 3 arguments required for pause_sbt() can be a bit
non-obvious (at least to me).  To that end, I'd like to have a simple
wrapper around pause_sbt() that accepts milliseconds.  It would align
itself on hardclock similar to the hz-based wrapper.  OTOH, we could
change the implementation at some point to use something more resaonable
in terms of precision, etc.  However, most of the time when I want to
sleep for N milliseconds (or N microseconds) due to some hardware spec,
I don't really have a strong opinion on the precision.  Having all the
callers try to figure out a precision would seem to inevitably result
in inconsistencies.  To start with I'd like to just add this:

#define	pause_ms(wmesg, msecs)						\
	pause_sbt((wmesg), SBT_1MS * (msecs), 0, C_HARDCLOCK)

Which you can use as 'pause_ms("pcieflr", 100);'.

Are there any objections?  Do people want other wrappers?  Should we
use more nuanced math similar to what was done in r296775?

-- 
John Baldwin



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