From owner-dev-commits-src-all@freebsd.org Mon Jul 5 00:23:45 2021 Return-Path: Delivered-To: dev-commits-src-all@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 5C8306504B5; Mon, 5 Jul 2021 00:23:45 +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 4GJ5yT0c7Qz4tBX; Mon, 5 Jul 2021 00:23:45 +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 E4D8B1C31A; Mon, 5 Jul 2021 00:23:44 +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 1650NimU022583; Mon, 5 Jul 2021 00:23:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1650Ni4I022582; Mon, 5 Jul 2021 00:23:44 GMT (envelope-from git) Date: Mon, 5 Jul 2021 00:23:44 GMT Message-Id: <202107050023.1650Ni4I022582@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Vladimir Kondratyev Subject: git: 1ab61a193241 - main - LinuxKPI: Do not wait for a grace period in rcu_barrier() MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: wulf X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1ab61a193241f832e63f97ca37880b010469cb38 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-all@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for all branches of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Jul 2021 00:23:45 -0000 The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=1ab61a193241f832e63f97ca37880b010469cb38 commit 1ab61a193241f832e63f97ca37880b010469cb38 Author: Vladimir Kondratyev AuthorDate: 2021-07-05 00:19:50 +0000 Commit: Vladimir Kondratyev CommitDate: 2021-07-05 00:19:50 +0000 LinuxKPI: Do not wait for a grace period in rcu_barrier() Linux docs explicitly state that this is not required [1]: "Important note: The rcu_barrier() function is not, repeat, not, obligated to wait for a grace period. It is instead only required to wait for RCU callbacks that have already been posted. Therefore, if there are no RCU callbacks posted anywhere in the system, rcu_barrier() is within its rights to return immediately. Even if there are callbacks posted, rcu_barrier() does not necessarily need to wait for a grace period." [1] https://www.kernel.org/doc/Documentation/RCU/Design/Requirements/Requirements.html Reviewed by: emaste, hselasky, manu MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D30809 --- sys/compat/linuxkpi/common/src/linux_rcu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_rcu.c b/sys/compat/linuxkpi/common/src/linux_rcu.c index a39949cf5013..2179faa2c05e 100644 --- a/sys/compat/linuxkpi/common/src/linux_rcu.c +++ b/sys/compat/linuxkpi/common/src/linux_rcu.c @@ -367,8 +367,12 @@ linux_rcu_barrier(unsigned type) MPASS(type < RCU_TYPE_MAX); - linux_synchronize_rcu(type); - + /* + * This function is not obligated to wait for a grace period. + * It only waits for RCU callbacks that have already been posted. + * If there are no RCU callbacks posted, rcu_barrier() can return + * immediately. + */ head = &linux_epoch_head[type]; /* wait for callbacks to complete */