git: 05f56ac92fe4 - main - LinuxKPI: Force the usleep_range() function to sleep instead of spinning on the timer.
Hans Petter Selasky
hselasky at FreeBSD.org
Sat Jul 10 20:00:34 UTC 2021
The branch main has been updated by hselasky:
URL: https://cgit.FreeBSD.org/src/commit/?id=05f56ac92fe4bcb00be5bd01574991a50c548b8b
commit 05f56ac92fe4bcb00be5bd01574991a50c548b8b
Author: Hans Petter Selasky <hselasky at FreeBSD.org>
AuthorDate: 2021-07-10 19:56:29 +0000
Commit: Hans Petter Selasky <hselasky at FreeBSD.org>
CommitDate: 2021-07-10 19:59:31 +0000
LinuxKPI: Force the usleep_range() function to sleep instead of spinning on the timer.
This allows other threads to execute, typically during hardware waiting loops.
This also maches how the function works in Linux.
Reviewed by: kib
MFC after: 1 week
Sponsored by: NVIDIA Networking
---
sys/compat/linuxkpi/common/include/linux/delay.h | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/sys/compat/linuxkpi/common/include/linux/delay.h b/sys/compat/linuxkpi/common/include/linux/delay.h
index 860d36368a8e..1ed9dffed359 100644
--- a/sys/compat/linuxkpi/common/include/linux/delay.h
+++ b/sys/compat/linuxkpi/common/include/linux/delay.h
@@ -2,7 +2,7 @@
* Copyright (c) 2010 Isilon Systems, Inc.
* Copyright (c) 2010 iX Systems, Inc.
* Copyright (c) 2010 Panasas, Inc.
- * Copyright (c) 2013-2015 Mellanox Technologies, Ltd.
+ * Copyright (c) 2013-2021 Mellanox Technologies, Ltd.
* Copyright (c) 2014 François Tigeot
* All rights reserved.
*
@@ -68,7 +68,10 @@ ndelay(unsigned long x)
static inline void
usleep_range(unsigned long min, unsigned long max)
{
- DELAY(min);
+ /* guard against invalid values */
+ if (min == 0)
+ min = 1;
+ pause_sbt("lnxsleep", ustosbt(min), 0, C_HARDCLOCK);
}
extern unsigned int linux_msleep_interruptible(unsigned int ms);
More information about the dev-commits-src-all
mailing list