Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Mar 2018 20:28:26 +0100
From:      Hans Petter Selasky <hps@selasky.org>
To:        Ian Lepore <ian@freebsd.org>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   Re: svn commit: r330352 - in head/sys/compat/linuxkpi/common: include/linux src
Message-ID:  <3534a8fa-4018-9b35-47cd-6ffa72a0c2b6@selasky.org>
In-Reply-To: <1520104482.23690.15.camel@freebsd.org>
References:  <201803031854.w23IsHxm086835@repo.freebsd.org> <1520104482.23690.15.camel@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 03/03/18 20:14, Ian Lepore wrote:
> 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 <johalun0@gmail.com>
>>    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.
> 

You're right. See r330353. Really, this only makes a noticable 
difference for larger timeouts.

--HPS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3534a8fa-4018-9b35-47cd-6ffa72a0c2b6>