From owner-svn-src-head@freebsd.org Sat Mar 3 19:14:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E16EF334FB for ; Sat, 3 Mar 2018 19:14:51 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from pmta2.delivery6.ore.mailhop.org (pmta2.delivery6.ore.mailhop.org [54.200.129.228]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 18A2371369 for ; Sat, 3 Mar 2018 19:14:50 +0000 (UTC) (envelope-from ian@freebsd.org) X-MHO-User: 0796533b-1f17-11e8-b951-f99fef315fd9 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound2.ore.mailhop.org (Halon) with ESMTPSA id 0796533b-1f17-11e8-b951-f99fef315fd9; Sat, 03 Mar 2018 19:14:01 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id w23JEgit090819; Sat, 3 Mar 2018 12:14:42 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <1520104482.23690.15.camel@freebsd.org> Subject: Re: svn commit: r330352 - in head/sys/compat/linuxkpi/common: include/linux src From: Ian Lepore To: Hans Petter Selasky , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sat, 03 Mar 2018 12:14:42 -0700 In-Reply-To: <201803031854.w23IsHxm086835@repo.freebsd.org> References: <201803031854.w23IsHxm086835@repo.freebsd.org> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.18.5.1 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Mar 2018 19:14:51 -0000 On Sat, 2018-03-03 at 18:54 +0000, Hans Petter Selasky wrote: > Author: hselasky > Date: Sat Mar  3 18:54:16 2018 > New Revision: 330352 > URL: https://svnweb.freebsd.org/changeset/base/330352 > > Log: >   Implement msleep_interruptible() in the LinuxKPI. While at it use pause_sbt() >   instead of pause() in the msleep() function to avoid rounding errors when >   converting delay values forth and back. Add a guard for a delay value >   of zero milliseconds which is undefined. >    >   MFC after: 1 week >   Requested by: Johannes Lundberg >   Sponsored by: Mellanox Technologies > > Modified: >   head/sys/compat/linuxkpi/common/include/linux/delay.h >   head/sys/compat/linuxkpi/common/src/linux_schedule.c > > Modified: head/sys/compat/linuxkpi/common/include/linux/delay.h > ============================================================================== > --- head/sys/compat/linuxkpi/common/include/linux/delay.h Sat Mar  3 18:52:19 2018 (r330351) > +++ head/sys/compat/linuxkpi/common/include/linux/delay.h Sat Mar  3 18:54:16 2018 (r330352) > @@ -36,14 +36,20 @@ >  #include >   >  static inline void > -linux_msleep(int ms) > +linux_msleep(unsigned int ms) >  { > - pause("lnxsleep", msecs_to_jiffies(ms)); > + /* guard against invalid values */ > + if (ms == 0) > + ms = 1; > + pause_sbt("lnxsleep", SBT_1MS * ms, 0, C_HARDCLOCK); >  } >   To really avoid roundoff errors, use mstosbt(ms) instead of SBT_1MS*ms. The rounding errors when multiplying or dividing by SBT_1MS is not severe like it is with SBT_1NS, but the inline functions still do the arithmetic more correctly to avoid roundoff error. -- Ian