From nobody Fri Jun 17 19:37:06 2022 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 2BA2C85A55A; Fri, 17 Jun 2022 19:37:07 +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 4LPq763Pt8z3P7v; Fri, 17 Jun 2022 19:37:06 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494627; 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=efwkqw5PhIxu6dSbDbFw7UUxxfQiTRNu3qq4xETRV4w=; b=T8KjrrIVE0uMDQTXPQLBge8II4p+RmThAA+vfIPMXOYeMQ8eb1Dcxmk/bOx5C4JYgnRiLa fTaoiHTN7LzSrv+wzqYi0LRASdPpMOYnqMBO1ZJSEUXCa4EyQKsAfM5v8AVerSDIBFeJHA Uz2VFKw7x/EZtADKZO9rdSoaNAc8aGW0T7uU2/BOlBbXhVERY6h0PPGSJMub+g/AZgIOaj Ow8X5Umx94cuR65TfN2u/B1yZWBUYNN485Qp49K0XM3QMJhWAn8EiQz69l0ONGySYCOx6U ZFGyaG/nnt8yQFRaS0fg7c9MWZBwYq/RGRlnI9vgB07IWmIdecsJ2QoiymEKFA== 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 441E92557C; Fri, 17 Jun 2022 19:37:06 +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 25HJb6PN012907; Fri, 17 Jun 2022 19:37:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 25HJb6ER012906; Fri, 17 Jun 2022 19:37:06 GMT (envelope-from git) Date: Fri, 17 Jun 2022 19:37:06 GMT Message-Id: <202206171937.25HJb6ER012906@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dmitry Chagin Subject: git: 3780c6b81909 - stable/13 - linux(4): Factor out the FUTEX_WAKE op into linux_futex_wake(). 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dchagin X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 3780c6b81909f1e6a98b9652df0c9c2c20d82fd6 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1655494627; 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=efwkqw5PhIxu6dSbDbFw7UUxxfQiTRNu3qq4xETRV4w=; b=R0+kC8zGu0qHaIA4aTTnBlGUG8WQ5olUbrOFGzmQVlu4c8zCtJNIRQsInb6uFoP1qAb9Km pOC9omsHNcVbm42LuegZbZPkNQj3Sm1DE9n8Z1y11RA6u/ItIR/OOokup0AVnEMtKxNAsy kX5N7LJEghOs5kBiV3PrP7jonCxxlPXUds/lHPoi9z2Vr562BXeKz6+LEVcEXAHAVHb+jv 9ecMghjhk2QtxqxLXmHPLXRaxtcmCv1U/rt7IN1oiHz67JwRNSbqL6mRu8CV/MeURrTJB2 FlOZUcprf5EwsjL3XY1Co1mtBQEaiJxVqRcdQ3enxQAyNy5E5C411kVz28NGVg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1655494627; a=rsa-sha256; cv=none; b=l6IXStq6CUhVQ39S4LN4nHYMh870ZpyzaFdGtAQ2lyiUXVQQlBaKZedIxJFnxLg+n64yCg JMvLysvpXA+bCPdnkYBidyK+cd2x+NMbAt0ctKcUGB7cq1fqUUvWnax9ceKgJqIftDKQXT lvmVAeBkXWLQXNkP9T3hjauhALEC1WI5tMb/0F7BuhvHkhWW8t7hHydw6SF4XArJXi8oen z0sNDjhKB4ZPa3OYBMqMQzCnk/hPGTRxAcKFzvYSXimxpd2jRChHSCXChAd1ytC/W5snIx YTgdKW0w3s+Sal9qW74J64KDrMrT4ESJtz+PDcS6QqWNAkVVxkQlEzHslB91ZA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dchagin: URL: https://cgit.FreeBSD.org/src/commit/?id=3780c6b81909f1e6a98b9652df0c9c2c20d82fd6 commit 3780c6b81909f1e6a98b9652df0c9c2c20d82fd6 Author: Dmitry Chagin AuthorDate: 2021-07-20 11:38:05 +0000 Commit: Dmitry Chagin CommitDate: 2022-06-17 19:33:11 +0000 linux(4): Factor out the FUTEX_WAKE op into linux_futex_wake(). MFC after: 2 weeks (cherry picked from commit 19f7e2c2fb443c1964dcfbd19ca01e2ba37a8c50) --- sys/compat/linux/linux_futex.c | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/sys/compat/linux/linux_futex.c b/sys/compat/linux/linux_futex.c index 15357e75c8af..04f767b8aed0 100644 --- a/sys/compat/linux/linux_futex.c +++ b/sys/compat/linux/linux_futex.c @@ -239,6 +239,7 @@ struct linux_futex_args { static int linux_futex(struct thread *, struct linux_futex_args *); static int linux_futex_wait(struct thread *, struct linux_futex_args *); +static int linux_futex_wake(struct thread *, struct linux_futex_args *); static void futex_put(struct futex *f, struct waiting_proc *wp) @@ -697,18 +698,7 @@ linux_futex(struct thread *td, struct linux_futex_args *args) LINUX_CTR3(sys_futex, "WAKE uaddr %p nrwake 0x%x bitset 0x%x", args->uaddr, args->val, args->val3); - error = futex_get(args->uaddr, NULL, &f, - args->flags | FUTEX_DONTCREATE); - if (error) - return (error); - - if (f == NULL) { - td->td_retval[0] = 0; - return (error); - } - td->td_retval[0] = futex_wake(f, args->val, args->val3); - futex_put(f, NULL); - break; + return (linux_futex_wake(td, args)); case LINUX_FUTEX_CMP_REQUEUE: LIN_SDT_PROBE5(futex, linux_futex, debug_cmp_requeue, @@ -933,6 +923,26 @@ retry2: return (error); } +static int +linux_futex_wake(struct thread *td, struct linux_futex_args *args) +{ + struct futex *f; + int error; + + f = NULL; + error = futex_get(args->uaddr, NULL, &f, args->flags | FUTEX_DONTCREATE); + if (error != 0) + return (error); + + if (f == NULL) { + td->td_retval[0] = 0; + return (error); + } + td->td_retval[0] = futex_wake(f, args->val, args->val3); + futex_put(f, NULL); + return (0); +} + static int linux_futex_wait(struct thread *td, struct linux_futex_args *args) {