From nobody Thu Mar 17 10:00:20 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 25D871A17973; Thu, 17 Mar 2022 10:00:22 +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 4KK2h472k2z4SlD; Thu, 17 Mar 2022 10:00:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647511221; 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=qcTy+GSI1N9wynHmA/Edk6bwXiBqZXS0XuX+Ipr+QlM=; b=PzkgQUc2LrgTnFbwWNJB0pJeOKskiKHykx1Ul3jvIKSO4o//kvhg7CwhsYNq6+tZBalluH +8bz0bIkAEX4jTHakqILesHFDFh+IN2zPCfWuGD1OtAftBl/1j/9tX7AoRNC1m81W9rXDI gt/wIGOwXoqa11GVNaBVk/0/AW8jxQbwPaTIQfaJHXlKEG2eUAESosZpX3/+ONvrUNXswX TqA6hBOcX1ccPlNDWi3ZJad28iMgLkChSzGnTjK7TO4EKiezK9D0boi65902MuJWgJvlu+ PihCmusRgcTtW33eyIBzL1+T2QhB85P527VQ/S5CTzG8wVpDJQFDxMIS6tNm/Q== 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 7E7F0476; Thu, 17 Mar 2022 10:00:20 +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 22HA0KEY089792; Thu, 17 Mar 2022 10:00:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22HA0KWE089787; Thu, 17 Mar 2022 10:00:20 GMT (envelope-from git) Date: Thu, 17 Mar 2022 10:00:20 GMT Message-Id: <202203171000.22HA0KWE089787@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: d17c5a4f6215 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: d17c5a4f62157c665ecc187e676d52c07e841923 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647511221; 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=qcTy+GSI1N9wynHmA/Edk6bwXiBqZXS0XuX+Ipr+QlM=; b=v+AWykLFmiHlQidQY+IBu2iKwunuCd0uPeT/7zSBfPPO1GFiCu3vgczy80w0O2WvjFGx8B 9JO4pmDkDI3stYa7s6eY909VMW+lVTWZedpuDuB1Sn8BYWzHvuTgYcxsacWTiH+BN6n+cC 0N+SBe1jrlls1Fz8t4mCcwmGCkzJY3FFniXY+HaqE37vxAETYQfApyH6ozzGG1L74Df3zL xPXcqk+Nc/8pR2AsVOxLuFK6qDHMVGGTtRtgICHw+JQ6s/z9WKTYp201mK8ohmB1xpUATu Yi2BVCUOp+PjGRLi1KgJ6t4S3aK8kv9S8Eb2CQqh6mwlHbOlH2/VdNuODHZGNA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647511221; a=rsa-sha256; cv=none; b=WvJvAOYCxr8P/wyTEiejzAtqQ3yh0pFBC6jjIu0Y+KFFLrduwBgJ5Q+7dbsdf+OnG/3aNw 4fuE9+qfjJKwUfO/8kkOipL96HSU30KkSlHnfrO6OseLTP7FjtmKMEcjwfgTOzwNN7mO/H GNm2iGx1Nh9xBo9IgR4thL3r/vDNY+PeMvTGJOvdET1N43svxeIGasyw/pjsfx91/pbHFw pKz8XkkidTdsBMmqgi0JRtWSzBS71GhUA3LCBKFUmyX8O0WYcCJUWByk03D/H488u440bz 7SIdaIZL6Vfp+nb7ta6JRsxVWxyDQrc8uOUvp+ArL6rNMsZ2y51IaOIGb+o+sg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=d17c5a4f62157c665ecc187e676d52c07e841923 commit d17c5a4f62157c665ecc187e676d52c07e841923 Author: Hans Petter Selasky AuthorDate: 2022-03-16 14:40:09 +0000 Commit: Hans Petter Selasky CommitDate: 2022-03-17 09:55:15 +0000 LinuxKPI: Add comment describing proper use of the on_each_cpu() function. Sponsored by: NVIDIA Networking (cherry picked from commit c6cf874c7de3bcc092a58a932c732221b2933043) --- 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); \