From nobody Wed Sep 04 16:00:55 2024 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 4WzRzq6LNXz5V8T0; Wed, 04 Sep 2024 16:00:55 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WzRzq5D3Yz4Xy6; Wed, 4 Sep 2024 16:00:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725465655; 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=DFd+l51sUtpcBxafgKxjRd7ggo2B1i8lqOZ2+d5fJr4=; b=lSURc4O/AF6GZenLh9FABxeYjnGP5MU+3an3Wx1mINxSjlOo8CtXOnySgN/9rr/dlcYhAh j+tIYCS3K0mX5lQuhU/4GjqgFxHg99hV099L7mX5CMi7VdISByy7VpvKV7CMi2RdAkFCui CJAsGlzuvZ9fOO6qIOqlKRLxo/9OlhdEwJo3+6TkbzlEk81nL58vBzKsFYIckTyx+DsR9w 2jh4Wd2U9hoi3FP11zl8RA2yA26r4LPpptW7MHL/p15Nt6ODvTL4G0A8aALGkh3x3JASMT EiQhaQcZT1e/xVGr+HDbgzoHgC4MMARaVct5TpZBk0CD3FFlvU/YCjA0vPSrbA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725465655; a=rsa-sha256; cv=none; b=l1d6sdYGHbbWvitePuTeGWfm2lxtT0t6qLRx0FRSDNE5bzWC4gU8sjkCukgqPh3d9KCsdu EENxXzwmwKdlaZodOPNz0+tJ90k79fbso2F0n/MKVPLjOD5h1sR6wfan5qPrOF24afol6U 4xPVEX3t1HrtKFk5S2WM4xoFjEOY1JTaRhR4Nn7/6AfLb3RS1nUEdzeY12OKjdwUfR2JcR j1GIM70JTZ5YF+oZEQgCp8o7vfDAc6oDPVALhInGdcUGJ+LdFenvf06KN584hJj63I1/0J T6slJe/bGLKHbV8m4+U2CJ0Bsyp0k0SQqLi+qIYfDHxurEDPMIFmV/pgx9PdJQ== 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=1725465655; 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=DFd+l51sUtpcBxafgKxjRd7ggo2B1i8lqOZ2+d5fJr4=; b=FH44qjHc/SCozRmUjTv0+wurulgorWLQ8T0wjiFPnC+jIkzTNiKwkSjB+gWsNWYQjIVcy+ zL0Y8BYCgTR8Oy3g7hxG5OoFK3QgJCOcPyMRa0Ef9lb8uAEafwlT6vzbAF4Gy5jurOXyHU +Hq+OGrbBoWlTuqP9ftOKvEWIdgwjKg2c+kQt2Ff8QcxB2CXzP84V5PwFnt2QICwWc34fg QVesjNeZVmM0q/VZbb5cOXKrBH35xyY5WGSldMlJv+q8Op0NkbnSWxZTcXtO597NhDso2c VQwT88ffS+kqjc9bjI7CpkVVPHLn5gFAiQZw8qEfIXGwMAnaaA+R7dgbaHI2PA== 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 4WzRzq4khqzXH9; Wed, 4 Sep 2024 16:00:55 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 484G0tVG031765; Wed, 4 Sep 2024 16:00:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 484G0tfm031762; Wed, 4 Sep 2024 16:00:55 GMT (envelope-from git) Date: Wed, 4 Sep 2024 16:00:55 GMT Message-Id: <202409041600.484G0tfm031762@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Ed Maste Subject: git: 2d4511bb81ed - stable/14 - umtx: shm: Collapse USHMF_REG_LINKED and USHMF_OBJ_LINKED flags 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: emaste X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 2d4511bb81ed70d84ba6ed2ffb54e6a138653a63 Auto-Submitted: auto-generated The branch stable/14 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=2d4511bb81ed70d84ba6ed2ffb54e6a138653a63 commit 2d4511bb81ed70d84ba6ed2ffb54e6a138653a63 Author: Olivier Certner AuthorDate: 2024-09-04 14:38:12 +0000 Commit: Ed Maste CommitDate: 2024-09-04 15:00:46 +0000 umtx: shm: Collapse USHMF_REG_LINKED and USHMF_OBJ_LINKED flags ...into the only USHMF_LINKED, as they are always set or unset together. This is both to stop giving the impression that they can be set/unset independently, which they can't with the current code, and to make it clearer that an upcoming reference counting fix is correct. Reviewed by: kib Approved by: emaste (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D46126 (cherry picked from commit dd83da532c36830a0c0aac624903849262ec6f68) --- sys/kern/kern_umtx.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/sys/kern/kern_umtx.c b/sys/kern/kern_umtx.c index 092fcade9d19..cecb4a021cfb 100644 --- a/sys/kern/kern_umtx.c +++ b/sys/kern/kern_umtx.c @@ -4292,8 +4292,7 @@ __umtx_op_sem2_wake(struct thread *td, struct _umtx_op_args *uap, #define USHM_OBJ_UMTX(o) \ ((struct umtx_shm_obj_list *)(&(o)->umtx_data)) -#define USHMF_REG_LINKED 0x0001 -#define USHMF_OBJ_LINKED 0x0002 +#define USHMF_LINKED 0x0001 struct umtx_shm_reg { TAILQ_ENTRY(umtx_shm_reg) ushm_reg_link; LIST_ENTRY(umtx_shm_reg) ushm_obj_link; @@ -4353,7 +4352,7 @@ umtx_shm_find_reg_locked(const struct umtx_key *key) KASSERT(reg->ushm_key.type == TYPE_SHM, ("TYPE_USHM")); KASSERT(reg->ushm_refcnt > 0, ("reg %p refcnt 0 onlist", reg)); - KASSERT((reg->ushm_flags & USHMF_REG_LINKED) != 0, + KASSERT((reg->ushm_flags & USHMF_LINKED) != 0, ("reg %p not linked", reg)); reg->ushm_refcnt++; return (reg); @@ -4393,14 +4392,11 @@ umtx_shm_unref_reg_locked(struct umtx_shm_reg *reg, bool force) reg->ushm_refcnt--; res = reg->ushm_refcnt == 0; if (res || force) { - if ((reg->ushm_flags & USHMF_REG_LINKED) != 0) { + if ((reg->ushm_flags & USHMF_LINKED) != 0) { TAILQ_REMOVE(&umtx_shm_registry[reg->ushm_key.hash], reg, ushm_reg_link); - reg->ushm_flags &= ~USHMF_REG_LINKED; - } - if ((reg->ushm_flags & USHMF_OBJ_LINKED) != 0) { LIST_REMOVE(reg, ushm_obj_link); - reg->ushm_flags &= ~USHMF_OBJ_LINKED; + reg->ushm_flags &= ~USHMF_LINKED; } } return (res); @@ -4493,7 +4489,7 @@ umtx_shm_create_reg(struct thread *td, const struct umtx_key *key, TAILQ_INSERT_TAIL(&umtx_shm_registry[key->hash], reg, ushm_reg_link); LIST_INSERT_HEAD(USHM_OBJ_UMTX(key->info.shared.object), reg, ushm_obj_link); - reg->ushm_flags = USHMF_REG_LINKED | USHMF_OBJ_LINKED; + reg->ushm_flags = USHMF_LINKED; mtx_unlock(&umtx_shm_lock); *res = reg; return (0);