From nobody Thu Mar 17 12:28:17 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 2B8D21A25D7A; Thu, 17 Mar 2022 12:28:19 +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 4KK5yp297Qz4r8r; Thu, 17 Mar 2022 12:28:17 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647520099; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SYBp0nGGgAbHw+HAtA0a9t+mz7AOjCCKYV2iwTYsfAo=; b=vdsD9wx94OPwJnixCHAAbIy+Qc+TIYPYRpOl9QT1fI6ZxknttSHZ/AxSeHJCxSovEhsY4b lLIC0p8o7z+OAtj382ypXOhaNqNWzRHXqwYr12dozKSbi/mfzeXxvTHfzlY82/4TEcUO+u UbXhRFH1euCuRuB+iltaCN40iKXrJmPjKRxliQUmAx6ZLpBSZlfzC3zVEnb9xpkF5PX94I 0p8g/zxGtg1HsFfv3gkynTKOqNEsIJiH2GIbn/9qN27gBEwmYj2vTpSP1Dfw2ndVjL2xtF NWKVcBlWg0e9Hdu86bF0ffsUiJUJD8ZyyXt4Os6PiyqWTHUwuMbXRDqtQ2+o2A== 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 CF94E2609; Thu, 17 Mar 2022 12:28:17 +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 22HCSHTr084006; Thu, 17 Mar 2022 12:28:17 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22HCSHUn084005; Thu, 17 Mar 2022 12:28:17 GMT (envelope-from git) Date: Thu, 17 Mar 2022 12:28:17 GMT Message-Id: <202203171228.22HCSHUn084005@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Hans Petter Selasky Subject: git: 5fcfe4717ad0 - releng/13.1 - LinuxKPI: Add comment describing proper use of the on_each_cpu() function. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org 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/releng/13.1 X-Git-Reftype: branch X-Git-Commit: 5fcfe4717ad053f8984afb47fb6aacb822faf6cb Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647520099; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=SYBp0nGGgAbHw+HAtA0a9t+mz7AOjCCKYV2iwTYsfAo=; b=dURuEydSt/0tbiAyup5x0qDHw8Xu6nhwkPjOIicpiCAmy8tLQRqWsxKpTHquse07Fc2VDp Dpi0EcmGFdjKtrEj7nCCL7A8RN89s0E5rMbqu4B0mSplJ+A7EcOGjcrHjJ9QVzrbMRbF19 SmtUKy0EU4ZdRlfLgt7mrDy5zMP9xAatlB04kNMs9dPGTd88PgMRmoYjYiYe/TQZtgxCv4 Cb4Zit5IfN/ycewOxfzWe/WczTAvDitNuGv34qq2gkbZ6q5gQstafTFSkNUtru2DYBAgv+ Klrp2ALPWw3bQ/WdTmpHS9RuH5OJVWyjxKXFSaetIyH/UWD8RTQ3GmI2R+vpAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647520099; a=rsa-sha256; cv=none; b=QI+Nv/Sb5cpW+AK+jstBRXiSlsojPOuJkBL7E6mjxX6Hia9+5z6GlapRzjv9PDxqya6xgI SglgNU8L/S2x0DbQQkox7cs0v7sTBbr7OGyXj4qfthf6m2PCLwUjbTVF9YE4N9iq/bUBe0 WcnlANV8Kjsc8RTktjctuwRpGnUUlch+owTfSp5lHgGnglZamJIK6ixnPuUhK2UoiAvQXM 7d+4LjIyPn285w2n4SDpmTExmebeGmcbAQjkszblxrHRUhgQJueskwGKAuo4xcL1MpLbeC tm5wVSqsu7Wk9XS7uHUcHnHqGePGd4VhDEE3D2c1gqk5J3INafI+A9OjMnBuTw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.1 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=5fcfe4717ad053f8984afb47fb6aacb822faf6cb commit 5fcfe4717ad053f8984afb47fb6aacb822faf6cb Author: Hans Petter Selasky AuthorDate: 2022-03-16 14:40:09 +0000 Commit: Hans Petter Selasky CommitDate: 2022-03-17 12:26:31 +0000 LinuxKPI: Add comment describing proper use of the on_each_cpu() function. Sponsored by: NVIDIA Networking Approved by: re (gjb) (cherry picked from commit c6cf874c7de3bcc092a58a932c732221b2933043) (cherry picked from commit d17c5a4f62157c665ecc187e676d52c07e841923) --- sys/compat/linuxkpi/common/include/linux/smp.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sys/compat/linuxkpi/common/include/linux/smp.h b/sys/compat/linuxkpi/common/include/linux/smp.h index 290b91469b12..c6d011fceb5f 100644 --- a/sys/compat/linuxkpi/common/include/linux/smp.h +++ b/sys/compat/linuxkpi/common/include/linux/smp.h @@ -29,6 +29,18 @@ #ifndef _LINUXKPI_LINUX_SMP_H_ #define _LINUXKPI_LINUX_SMP_H_ +/* + * Important note about the use of the function provided below: + * + * The callback function passed to on_each_cpu() is called from a + * so-called critical section, and if you need a mutex you will have + * to rewrite the code to use native FreeBSD mtx spinlocks instead of + * the spinlocks provided by the LinuxKPI! Be very careful to not call + * any LinuxKPI functions inside the on_each_cpu()'s callback + * function, because they may sleep, unlike in native Linux. + * + * Enabling witness(4) when testing, can catch such issues. + */ #define on_each_cpu(cb, data, wait) ({ \ CTASSERT(wait); \ linux_on_each_cpu(cb, data); \