From nobody Wed Mar 16 14:44:46 2022 X-Original-To: dev-commits-src-main@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 0F8321A1CB74; Wed, 16 Mar 2022 14:44:47 +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 4KJY2k6cTHz3PH5; Wed, 16 Mar 2022 14:44:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647441886; 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=HNaf4WtnM/2ymXjmrbwIH1h6eHkaD7ISw1l1BM7K9SA=; b=JwlamPuUJ9je5XQ47paSMrQO78smaQEbbfmPPZaWZWBir6xwwdQePOuLFKsG0KbxY3nhFh NCu0bnQV1AJ3S+xbK/5ahxZpf4/mA71TnFSgG0Tpn7O8k8ySc0EqvV2s5PUCWIazBnngWZ OItCp7gPAhEmH6X92DhHtTQohZrm8VfgjyPxZ5hyw6WEK/K5e1z8uXabtoLTrDuEyCnI1y CqmlGLS2wavXO5HDi9EW5eu4x4pleRvAQ1kZ5MNFKXJ6aRU2b5R6xLivytW9yfi74eNw82 JT9ZST5PEep+WCwFMOxEwZWgPk7l1K8QbD9OJSPcvXvIH9QRex9bc6uewCBfCA== 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 BF6FA17D5C; Wed, 16 Mar 2022 14:44:46 +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 22GEiknU029564; Wed, 16 Mar 2022 14:44:46 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22GEikbi029563; Wed, 16 Mar 2022 14:44:46 GMT (envelope-from git) Date: Wed, 16 Mar 2022 14:44:46 GMT Message-Id: <202203161444.22GEikbi029563@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: c6cf874c7de3 - main - LinuxKPI: Add comment describing proper use of the on_each_cpu() function. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: c6cf874c7de3bcc092a58a932c732221b2933043 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647441886; 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=HNaf4WtnM/2ymXjmrbwIH1h6eHkaD7ISw1l1BM7K9SA=; b=CMlzG37mqWix9Ij5jf9jywUF6u0sBAWQ4Whd85z1AKDh10bJWM+qJnsMKyYkQ1mARY03+s Z1Ps8kIsnZaBbnqtM50qeol9ejVGUNxo0oKk+NKk/W7vSYguDx1wPAvdM/i/N5OcvmU6Lc /BcNUlmyEyAUHa3UgwXFdHlCUFLae4X7btZbUU+uY6sx6v9ZHyKP/Lhzyog+E5FHZUh5Xo 7I3UxwVSfUqIp0oAsBsHjiStCbxvD1Y2Q76zGo0Fe8Atz8o7HIB1EKGyt0X1fU93rk0LdL qJHQ/1/6BXuSNdZhO7PB69c9ly88BccG8vqftUKVmvqGki8GuPLPcpOP28cM+Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647441886; a=rsa-sha256; cv=none; b=Bh3ckV5sX2/myihy1qUajPSo6rtgIafUUJjA8A34WaMfF2MM6NUsjjJK8SrQY7qX+Js0lR ycWJD56A5KxbY21YkHBY0pDjVQE7I6vSqzWbGdPZKqdcdWMkevx5WGBvMdbeT2GtnMiWDf Yl+gwKqaRT8nX3ku8c0HOtsv+i1B/RhnuAEaFWTW4Kr7pi3uPICJ0cNKQ4DWa2kGTNl7a2 c5FYEo45mAK1LGA8K+zE69bFKbzfz8nKaAh0KCblQYy7oVxsLDzs+E/QgBEf2+LOhgTGRL qKTgponeaSuNkNHnxJzGxQob4UWdeWBHZnS6qAeAy0JLF6kTXfqU24kUXXpDww== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by hselasky: URL: https://cgit.FreeBSD.org/src/commit/?id=c6cf874c7de3bcc092a58a932c732221b2933043 commit c6cf874c7de3bcc092a58a932c732221b2933043 Author: Hans Petter Selasky AuthorDate: 2022-03-16 14:40:09 +0000 Commit: Hans Petter Selasky CommitDate: 2022-03-16 14:44:07 +0000 LinuxKPI: Add comment describing proper use of the on_each_cpu() function. MFC after: 1 week Sponsored by: NVIDIA Networking --- 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); \