From nobody Tue May 21 18:16:45 2024 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 4VkN1T688Xz5LxZW; Tue, 21 May 2024 18:16: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 4VkN1T5K99z3wk9; Tue, 21 May 2024 18:16:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716315405; 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=PM0w+7Gc5WaxqYOY+zIV/kPKkiwOCMVJRq8EDo4pCc0=; b=ovEBQ9rOQUov7TD3X8vPwPW0Jc8Ve89bEqmYbAtsEQLryFCczohaPN9prLZnRDkwY20fkM EQpbt0CwTMPoh34VRSFynFQeGd+JlPmd/97ZB75Xu6ZrpFb7x8ie5FhpqorSpYkowUesiK XNF4owEGDmnYHKXHaon0AupOb7NxqM769s/OjFj5EA3yCVd6oBLzbAWNnwwfdhEl+Y69z0 HRanuv/QNyvRWGMqAt4mYxrnRh97bmKkZTe5BM74rj+/Hb9gIFFI5B5BgmrxvS0R8CrRVu lw9fYHo9IW183jYW3y3dkuvhwMcZwEhrDU6nQSFTW3l6Y//zdo/tXd1TFESeUA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1716315405; a=rsa-sha256; cv=none; b=VXc4quIv4mwTbzmDe2eNWlEp17i65g473sBhPv3UQTUswGa4ZCcAUaVsIclnyB4Rj77Oz1 xYgluxiX/vxppGBNKVwL2K9Smk33O4/TUwlMBUzn5F6CNn08zvzxQiiMn3Ds5KpEtEYoge S76it5oS3rdRVxhe3SS9pthQT/2cYG/oAZ1EHjz4POtoYZ20RyC7T6hxquwv4/79+te7pn 22gLatmQg0xLxsRc3WGPa4uht2W1slpX4UdDlW9LYqZhQEbSFR+6Edgo1nhw+ru4Th4dN6 IZ8xhooItZyoR7AWsxndMQb3N1geUA8KD35/K3qwKccmInYAtYcmk2rUy96/iA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1716315405; 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=PM0w+7Gc5WaxqYOY+zIV/kPKkiwOCMVJRq8EDo4pCc0=; b=oYjNT0CdFaboBqzKCYVe6SWaWDNnK29o9asIZD8vovl2LJv+HJo8FIkKczJ2qQEHNYS7sf fJCszAVOb5H0nMYaOlZbvKltEnh+qB62LHQSSOoImaKet1JARC+5sb9c3hCAirT2wzUc5x fdI+Za10DfrncV+1mqXwbv/XOxw/bUotHebpWuKCBQrjlvJOBJ2X3YrPxEhlsFVgxyHagT c2b6h/TZSZ7hkCK79KJ5SZ8569vVv459NwBL2wDoRT0YQD7c9UaJKUYzapGnm5aPg5hEGV kyD1lv5rE0dfcl46AOVIagPsXyzofR7pd2CvlU82DYYrnQSKe5+RlyS16mc0Ow== 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 4VkN1T4pBxzXtt; Tue, 21 May 2024 18:16:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44LIGjtk056158; Tue, 21 May 2024 18:16:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44LIGjHA056155; Tue, 21 May 2024 18:16:45 GMT (envelope-from git) Date: Tue, 21 May 2024 18:16:45 GMT Message-Id: <202405211816.44LIGjHA056155@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ryan Libby Subject: git: b92cd6b2944a - main - lockmgr: make lockmgr_disowned public and use it 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rlibby X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: b92cd6b2944af2112787c55949e0c8194305c8c4 Auto-Submitted: auto-generated The branch main has been updated by rlibby: URL: https://cgit.FreeBSD.org/src/commit/?id=b92cd6b2944af2112787c55949e0c8194305c8c4 commit b92cd6b2944af2112787c55949e0c8194305c8c4 Author: Ryan Libby AuthorDate: 2024-05-21 17:21:50 +0000 Commit: Ryan Libby CommitDate: 2024-05-21 17:21:50 +0000 lockmgr: make lockmgr_disowned public and use it Reviewed by: mckusick, kib, markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D45248 --- sys/kern/kern_lock.c | 7 ++----- sys/sys/lockmgr.h | 4 ++++ 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/sys/kern/kern_lock.c b/sys/kern/kern_lock.c index f152185f5fbf..1b4d21f064a7 100644 --- a/sys/kern/kern_lock.c +++ b/sys/kern/kern_lock.c @@ -138,9 +138,6 @@ LK_CAN_SHARE(uintptr_t x, int flags, bool fp) #define LK_TRYWIT(x) \ (LK_TRYOP(x) ? LOP_TRYLOCK : 0) -#define lockmgr_disowned(lk) \ - (((lk)->lk_lock & ~(LK_FLAGMASK & ~LK_SHARE)) == LK_KERNPROC) - #define lockmgr_xlocked_v(v) \ (((v) & ~(LK_FLAGMASK & ~LK_SHARE)) == (uintptr_t)curthread) @@ -243,7 +240,7 @@ static void lockmgr_note_exclusive_release(struct lock *lk, const char *file, int line) { - if (LK_HOLDER(lockmgr_read_value(lk)) != LK_KERNPROC) { + if (!lockmgr_disowned(lk)) { WITNESS_UNLOCK(&lk->lock_object, LOP_EXCLUSIVE, file, line); TD_LOCKS_DEC(curthread); } @@ -1135,7 +1132,7 @@ lockmgr_xunlock_hard(struct lock *lk, uintptr_t x, u_int flags, struct lock_obje * any waiter. * Fix-up the tid var if the lock has been disowned. */ - if (LK_HOLDER(x) == LK_KERNPROC) + if (lockmgr_disowned_v(x)) tid = LK_KERNPROC; /* diff --git a/sys/sys/lockmgr.h b/sys/sys/lockmgr.h index ebe238cd0e25..48eea47c60da 100644 --- a/sys/sys/lockmgr.h +++ b/sys/sys/lockmgr.h @@ -130,6 +130,10 @@ _lockmgr_args_rw(struct lock *lk, u_int flags, struct rwlock *ilk, LOCK_FILE, LOCK_LINE) #define lockmgr_disown(lk) \ _lockmgr_disown((lk), LOCK_FILE, LOCK_LINE) +#define lockmgr_disowned_v(v) \ + (LK_HOLDER((v)) == LK_KERNPROC) +#define lockmgr_disowned(lk) \ + lockmgr_disowned_v(lockmgr_read_value((lk))) #define lockmgr_recursed_v(v) \ (v & LK_WRITER_RECURSED) #define lockmgr_recursed(lk) \