From nobody Tue Aug 23 19:15:52 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 4MBzTh5h8wz4bJwK; Tue, 23 Aug 2022 19:15:52 +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 4MBzTh59Zgz3SVm; Tue, 23 Aug 2022 19:15:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661282152; 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=hqDS2R84D4U0dmrAsks6/Jd4tMVEbMSwMmCEK+ack2A=; b=xe21RQ6/ik+Tkb4rMhWhvPsv0QBDSskSAm+opd1ReqnFs+6TeRHzW8Uu//E84eyKSRbYBW HluI5BRuOdhXrozoR03ETAGQMvHiVclDZmC3KrJKX071BA3k1zUc40OH1YNl0sglgQUNnr Ufi3J9YxIr7tqgkC+HYnFYb9f2uuOoASrWRAVnaDheby+5XsNWLzo6OB26mUJQj0CbkwYq toiwEOD+yeUKiaLB1E3aytyl8NxHOkb8naaSMJmA+nM9Iz9jx9lX/hp3unuZPEGMMEcx8r F9kprrWza+gSqMb0FZnJDvDjRNfmPUNeH+K8aYaHd6FI4bqfUEra8KJCFD5gBg== 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 4MBzTh4Ckmzh6T; Tue, 23 Aug 2022 19:15:52 +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 27NJFqWa023137; Tue, 23 Aug 2022 19:15:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 27NJFqp3023136; Tue, 23 Aug 2022 19:15:52 GMT (envelope-from git) Date: Tue, 23 Aug 2022 19:15:52 GMT Message-Id: <202208231915.27NJFqp3023136@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mateusz Guzik Subject: git: 9488262679d0 - main - rms: add rms_assert_rlock_ok 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: mjg X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 9488262679d083ff0de97ff608f6a8a95291b13d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1661282152; 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=hqDS2R84D4U0dmrAsks6/Jd4tMVEbMSwMmCEK+ack2A=; b=h4ZPtWFVqfWk+15kiIiK3sZKfQiuqyILAmOztpd3lhL9TAakcnpE998v2ldJfsmKltND+B bDoLlljTYPUNqV5DLEKGEh/K5nR7GUJ1tqShKnY6eRyAPl3j3B3cDQN73uchFBALlvdY8+ PFI5bnuKvRWfY13k2feCT8BwtSbRsO/9kmc+WeKYs4Qeus/m2Br6RPMCz/j959xlx1UEkV z1dAt135VOqO1JiXLrJHkE7xBQoMrDJB6lIrMog0dLCSme1Wb7/PNcuH6+zGjs5K0w1KIs cv9kBocH/njo47xuiZ+b8JuJpvr6g72Sjt1Q1+tvvhk+YmRlsP/3RIknLO88Ng== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1661282152; a=rsa-sha256; cv=none; b=MkmBc2lDWcCK2PTW9//u/oHYxt9UB2i8qZt/W0i9QtADyKqKI710cU1HTi1aMoQfOt1KTr 9VqT15y117ZQ7Jk4g7KqPU/DeDlZsnYYNHZ8/9QcqBQXyzuR8ya5sVXUNIRuBX74kK4y+J LhcH4luCSN+I0PRsjQ/InXJS65sEWVy3yhGtPhaOPqSufJig1SFA4hMXtUU5SRFTaM9H1P Y2D/7WtKYg9cj0xju04aakM9IIcDs4knOq44SZ0Su11dyivXgxgti6dvMTJdZQNlv7fVM6 NDaKGu6wVsVruYrh+Pqi7LCf0StrExtZrYz/i+Vsfy6nQXfAyckiyWLDGr6ycw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mjg: URL: https://cgit.FreeBSD.org/src/commit/?id=9488262679d083ff0de97ff608f6a8a95291b13d commit 9488262679d083ff0de97ff608f6a8a95291b13d Author: Mateusz Guzik AuthorDate: 2022-08-16 12:22:31 +0000 Commit: Mateusz Guzik CommitDate: 2022-08-23 19:15:48 +0000 rms: add rms_assert_rlock_ok So that callers which opportunistically elide the lock can still assert that they can take it. Reviewed by: Differential Revision: --- sys/kern/kern_rmlock.c | 2 +- sys/sys/rmlock.h | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/kern/kern_rmlock.c b/sys/kern/kern_rmlock.c index d7dea8efc40e..8a39c6b0d880 100644 --- a/sys/kern/kern_rmlock.c +++ b/sys/kern/kern_rmlock.c @@ -1025,7 +1025,7 @@ rms_rlock(struct rmslock *rms) { struct rmslock_pcpu *pcpu; - WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); + rms_assert_rlock_ok(rms); MPASS(atomic_load_ptr(&rms->owner) != curthread); critical_enter(); diff --git a/sys/sys/rmlock.h b/sys/sys/rmlock.h index 5aaf8f039026..6ff561c5e4b0 100644 --- a/sys/sys/rmlock.h +++ b/sys/sys/rmlock.h @@ -150,6 +150,13 @@ rms_wowned(struct rmslock *rms) return (rms->owner == curthread); } +#ifdef INVARIANTS +#define rms_assert_rlock_ok(x) \ + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, __func__); +#else +#define rms_assert_rlock_ok(x) +#endif + #ifdef INVARIANTS /* * For assertion purposes.