From owner-freebsd-arch@freebsd.org Fri Sep 2 19:22:54 2016 Return-Path: Delivered-To: freebsd-arch@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 980F4BCDA8B for ; Fri, 2 Sep 2016 19:22:54 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7A1E3ACE for ; Fri, 2 Sep 2016 19:22:54 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (c-73-231-226-104.hsd1.ca.comcast.net [73.231.226.104]) by mail.baldwin.cx (Postfix) with ESMTPSA id B136810A999 for ; Fri, 2 Sep 2016 15:22:51 -0400 (EDT) From: John Baldwin To: FreeBSD-arch Arch Subject: pause_ms() wrapper Date: Fri, 02 Sep 2016 12:22:42 -0700 Message-ID: <2960854.iLOY0Gxipb@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.0-PRERELEASE; KDE/4.14.10; amd64; ; ) MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 02 Sep 2016 15:22:51 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Sep 2016 19:22:54 -0000 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