Date: Sat, 10 Jul 2021 20:00:33 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: 05f56ac92fe4 - main - LinuxKPI: Force the usleep_range() function to sleep instead of spinning on the timer. Message-ID: <202107102000.16AK0Xdt011424@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=05f56ac92fe4bcb00be5bd01574991a50c548b8b commit 05f56ac92fe4bcb00be5bd01574991a50c548b8b Author: Hans Petter Selasky <hselasky@FreeBSD.org> AuthorDate: 2021-07-10 19:56:29 +0000 Commit: Hans Petter Selasky <hselasky@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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202107102000.16AK0Xdt011424>