From owner-dev-commits-src-all@freebsd.org Fri Apr 16 13:52: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 99AC65D2AB3; Fri, 16 Apr 2021 13:52: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 4FMHhs3gyPz4ST7; Fri, 16 Apr 2021 13:52: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 6362B25C43; Fri, 16 Apr 2021 13:52:45 +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 13GDqj40021982; Fri, 16 Apr 2021 13:52:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 13GDqjSL021981; Fri, 16 Apr 2021 13:52:45 GMT (envelope-from git) Date: Fri, 16 Apr 2021 13:52:45 GMT Message-Id: <202104161352.13GDqjSL021981@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mitchell Horne Subject: git: 6fa1d613a825 - stable/13 - rmlock(9): add an RM_DUPOK flag MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 6fa1d613a82582e0da87169b994a5c0080258a82 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: Fri, 16 Apr 2021 13:52:45 -0000 The branch stable/13 has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=6fa1d613a82582e0da87169b994a5c0080258a82 commit 6fa1d613a82582e0da87169b994a5c0080258a82 Author: Mitchell Horne AuthorDate: 2021-04-08 17:41:19 +0000 Commit: Mitchell Horne CommitDate: 2021-04-16 13:48:02 +0000 rmlock(9): add an RM_DUPOK flag Allows for duplicate locks to be acquired without witness complaining. Similar flags exists already for rwlock(9) and sx(9). Reviewed by: markj Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. (cherry picked from commit 2816bd8442bc323d50434d0e64cb4b7c10a195e8) --- share/man/man9/rmlock.9 | 5 ++++- sys/kern/kern_rmlock.c | 2 ++ sys/sys/rmlock.h | 1 + 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/share/man/man9/rmlock.9 b/share/man/man9/rmlock.9 index 53de7c73b79a..6d128f986968 100644 --- a/share/man/man9/rmlock.9 +++ b/share/man/man9/rmlock.9 @@ -26,7 +26,7 @@ .\" $FreeBSD$ .\" .\" Based on rwlock.9 man page -.Dd December 27, 2019 +.Dd April 12, 2021 .Dt RMLOCK 9 .Os .Sh NAME @@ -186,6 +186,9 @@ will assert that the has not been initialized multiple times without intervening calls to .Fn rm_destroy unless this option is specified. +.It Dv RM_DUPOK +.Xr witness 4 +should not log messages about duplicate locks being acquired. .El .It Fn rm_rlock "struct rmlock *rm" "struct rm_priotracker* tracker" Lock diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c index f661e209b633..7230a00e357b 100644 --- a/sys/kern/kern_rmlock.c +++ b/sys/kern/kern_rmlock.c @@ -289,6 +289,8 @@ rm_init_flags(struct rmlock *rm, const char *name, int opts) liflags |= LO_RECURSABLE; if (opts & RM_NEW) liflags |= LO_NEW; + if (opts & RM_DUPOK) + liflags |= LO_DUPOK; rm->rm_writecpus = all_cpus; LIST_INIT(&rm->rm_activeReaders); if (opts & RM_SLEEPABLE) { diff --git a/sys/sys/rmlock.h b/sys/sys/rmlock.h index 3e4db5d853c6..5aaf8f039026 100644 --- a/sys/sys/rmlock.h +++ b/sys/sys/rmlock.h @@ -48,6 +48,7 @@ #define RM_RECURSE 0x00000002 #define RM_SLEEPABLE 0x00000004 #define RM_NEW 0x00000008 +#define RM_DUPOK 0x00000010 void rm_init(struct rmlock *rm, const char *name); void rm_init_flags(struct rmlock *rm, const char *name, int opts);