From nobody Fri Jan 16 19:40:58 2026 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 4dt9FR4hlGz6NlVv for ; Fri, 16 Jan 2026 19:40:59 +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 "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dt9FQ74GTz3xBG for ; Fri, 16 Jan 2026 19:40:58 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768592459; 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=9f1+PQ+YcAewjzw/v5kE+qmxcahnjDv4sm8M8HhEpik=; b=nCKVz1sgmHiV+LJldvtBe/iKUCFH89PiiYro3mnc8kBNk7Gd0OtqNWulnAoGcg+KTVM+XN BlCTvI+qamZVUnkKBmiqAb0qxXhFWOuylpHtDji3KydFhsvPeHRW4Bx3PahuVOozlFTgKA jWcSQHNQqiAOhpROFb34xWPfLz8+P2bNTKuhz+2hyYoV80if44m0jpjOwuH5nSAo3p8lBL 61MEucw3N5tGdUsAT5CNi9sDWJy85nZrgl/rO0gJlY4ewC2Ndg5pAT7sy3SAWxaORxHiCk Bet6PbWcPETGpjwaKHe3Dd9kmua4UVnmIVnGBJfOMJftR8nbq5MVKR0noeclaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768592459; 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=9f1+PQ+YcAewjzw/v5kE+qmxcahnjDv4sm8M8HhEpik=; b=aE5R2IDJO47XdGuzE6/cFq5MqXT3sIrjKuIVJ+HeAW/ULqhwUpfFR1N2tBbvrb+yY/EWDD SLYfDn2GBN0ez+vVXttW3AxC61XkiDRfq5LkXhKUPgDNQRyRYLLGh5Bx/Uoj/Jhl9uDR+6 NR83lh9p9BcpYyJXxlc8SnQwqLCMCrYoodXhlyzMGcq0PBISh9cO7L1E9+C53JkxqVuSJC GhZekjiweRFXaAgT9HDJi1n7ri0Xnb6O9skdOYYhwFWRDM1bz8XWHsn1V8MYwEx97TmO8K wkjWp9ntpBXIwPIi0nYU/Ocf/ovpCAG3ptpFRecvbses42afz6F5vQk/5kne1A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1768592459; a=rsa-sha256; cv=none; b=mvAeDXxdlkauZrOjn19qyiL0+bEpKt3cFmJO2b5SH652z8Mziota2Pcxb8IjplD/X/rUei kyd5QBx1YWAZM+IWXPGKccoeT3c3fxeKvac/lptm63yfzSdMKkMWWwAxlYjJPXV1vSA5UL 2qXNjaC5QEA21kTyi3hYoN63KFImx9l7XojEWPHnollkqonZ7Ov7UqJpcq2OZlFk8U9m2g i/yvwkr9SnBvOZZ2BgVvdJ5G0IC6sBLFBwEz91StXmul/93p6RoWXGMRalywPCLq1wc1k4 ZNiGfanH12r7yJid1E0okx8r72EBGhbZ+rvM5vrNcu3mmVDk5E6tePt8+rBecw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dt9FQ2YhwzCKF for ; Fri, 16 Jan 2026 19:40:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id e19c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 16 Jan 2026 19:40:58 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Bjoern A. Zeeb Subject: git: 163fe10479a3 - stable/14 - LinuxKPI: add DEFINE_LOCK_GUARD_0 for rcu 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 163fe10479a34071eb860695459999e2575e714c Auto-Submitted: auto-generated Date: Fri, 16 Jan 2026 19:40:58 +0000 Message-Id: <696a944a.e19c.6913d7cd@gitrepo.freebsd.org> The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=163fe10479a34071eb860695459999e2575e714c commit 163fe10479a34071eb860695459999e2575e714c Author: Bjoern A. Zeeb AuthorDate: 2025-09-04 20:25:30 +0000 Commit: Bjoern A. Zeeb CommitDate: 2026-01-16 19:37:48 +0000 LinuxKPI: add DEFINE_LOCK_GUARD_0 for rcu This adds guard support for non-real-types like rcu locking meaning that we need to keep the lock state separately ourselves. _T is still special and needs to be updated. Given it may not be used it needs an __unused attribute (we are using the LinuxKPI __maybe_unused which indeed is more expressive in this case). Sponsored by: The FreeBSD Foundation (initially) Reviewed by: dumbbell Differential Revision: https://reviews.freebsd.org/D52076 (cherry picked from commit 3f48a0fe53ca7e001852f4a406c1bdfab1cd2f6d) (cherry picked from commit 4d5a78c5f40aa2dfd672ccfa4a6fff93e216c32b) --- sys/compat/linuxkpi/common/include/linux/cleanup.h | 35 ++++++++++++++++++++++ .../linuxkpi/common/include/linux/rcupdate.h | 5 +++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/cleanup.h b/sys/compat/linuxkpi/common/include/linux/cleanup.h index 45c2a2359ddf..5bb146f082ed 100644 --- a/sys/compat/linuxkpi/common/include/linux/cleanup.h +++ b/sys/compat/linuxkpi/common/include/linux/cleanup.h @@ -55,4 +55,39 @@ #define __free(_n) __cleanup(__free_##_n) +/* + * Given this is a _0 version it should likely be broken up into parts. + * But we have no idead what a _1, _2, ... version would do different + * until we see a call. + * This is used for a not-real-type (rcu). We use a bool to "simulate" + * the lock held. Also _T still special, may not always be used, so tag + * with __unused (or better the LinuxKPI __maybe_unused). + */ +#define DEFINE_LOCK_GUARD_0(_n, _lock, _unlock, ...) \ + \ + typedef struct { \ + bool lock; \ + __VA_ARGS__; \ + } guard_ ## _n ## _t; \ + \ + static inline void \ + guard_ ## _n ## _destroy(guard_ ## _n ## _t *_T) \ + { \ + if (_T->lock) { \ + _unlock; \ + } \ + } \ + \ + static inline guard_ ## _n ## _t \ + guard_ ## _n ## _create(void) \ + { \ + guard_ ## _n ## _t _tmp; \ + guard_ ## _n ## _t *_T __maybe_unused; \ + \ + _tmp.lock = true; \ + _T = &_tmp; \ + _lock; \ + return (_tmp); \ + } + #endif /* _LINUXKPI_LINUX_CLEANUP_H */ diff --git a/sys/compat/linuxkpi/common/include/linux/rcupdate.h b/sys/compat/linuxkpi/common/include/linux/rcupdate.h index 85d766c8dbc9..4aceb7296cd6 100644 --- a/sys/compat/linuxkpi/common/include/linux/rcupdate.h +++ b/sys/compat/linuxkpi/common/include/linux/rcupdate.h @@ -1,7 +1,7 @@ /*- * Copyright (c) 2016-2017 Mellanox Technologies, Ltd. * All rights reserved. - * Copyright (c) 2024 The FreeBSD Foundation + * Copyright (c) 2024-2025 The FreeBSD Foundation * * Portions of this software were developed by Björn Zeeb * under sponsorship from the FreeBSD Foundation. @@ -35,6 +35,7 @@ #include #include #include +#include #include @@ -162,4 +163,6 @@ void linux_synchronize_rcu(unsigned type); #define init_rcu_head_on_stack(...) #define destroy_rcu_head_on_stack(...) +DEFINE_LOCK_GUARD_0(rcu, rcu_read_lock(), rcu_read_unlock()) + #endif /* _LINUXKPI_LINUX_RCUPDATE_H_ */