From owner-dev-commits-src-main@freebsd.org Sat Jul 10 20:00:34 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C0CA65AB9A; Sat, 10 Jul 2021 20:00:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4GMgr20Lgrz4qby; Sat, 10 Jul 2021 20:00:34 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E80B5668E; Sat, 10 Jul 2021 20:00:33 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 16AK0Xqt011425; Sat, 10 Jul 2021 20:00:33 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 16AK0Xdt011424; Sat, 10 Jul 2021 20:00:33 GMT (envelope-from git) Date: Sat, 10 Jul 2021 20:00:33 GMT Message-Id: <202107102000.16AK0Xdt011424@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Hans Petter Selasky Subject: git: 05f56ac92fe4 - main - LinuxKPI: Force the usleep_range() function to sleep instead of spinning on the timer. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: hselasky X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 05f56ac92fe4bcb00be5bd01574991a50c548b8b Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 10 Jul 2021 20:00:34 -0000 The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=05f56ac92fe4bcb00be5bd01574991a50c548b8b commit 05f56ac92fe4bcb00be5bd01574991a50c548b8b Author: Hans Petter Selasky AuthorDate: 2021-07-10 19:56:29 +0000 Commit: Hans Petter Selasky 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);