From patchwork Mon Nov 23 19:52:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella X-Patchwork-Id: 41164 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8EBE6383F84D; Mon, 23 Nov 2020 19:53:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8EBE6383F84D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1606161194; bh=0Mhd3jAkHziuzxTiw9LfVeO4qPUnCZibG2B5JMp7/es=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=VHF5E+2Bh4X3uPWdPbi9IjFBlsMxmc3Kvc4df5sXHydn/M0zusFVxe8ozdZ0kTOck dodT6FoSCTx9wj70r9QsOvuraodI2LseSbvQWrdfBIHWekCmlF/J0inMm8MHdU4I2l 5PTRG28apytVHWgZvlIWcSofW1vgyBpY4TRMc3IE= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x744.google.com (mail-qk1-x744.google.com [IPv6:2607:f8b0:4864:20::744]) by sourceware.org (Postfix) with ESMTPS id BC9933840C22 for ; Mon, 23 Nov 2020 19:53:11 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org BC9933840C22 Received: by mail-qk1-x744.google.com with SMTP id q5so18156397qkc.12 for ; Mon, 23 Nov 2020 11:53:11 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0Mhd3jAkHziuzxTiw9LfVeO4qPUnCZibG2B5JMp7/es=; b=b1rsTsCT6V7NKI3CQbzUM1ECEJFTsCTOtb+csARtnbwnydOhmuEBxa1ru6uKTAwwJA aVK/FNlr7arO7p+bRPNCJne1Dj5gLYTLom7TW7MORaqhlz+Peq+sDu258Zp1ZEp8840J bBqcdnL1c6tXdg7BykM0u3QZEcLPMResZNOKMML2p+Sd2+mDG9BorIWtPfOesw1sGj+p EZNoTE1VWfOb/MjU2P6R1rGlzF+P+gS8xHXkiaoPh7bjRif1qcxL2Qaj+F6xbIPHEHKd 38m1iX+YjLhBvql9ySY4FOqTDI+BJ6UYM8njKjznhjtG7kk/OMs79gt+zKvjC3UFXpF0 P5Ow== X-Gm-Message-State: AOAM53345DcHu++CUc5CMUl3OOHDI3nRNMPyfKn7qowaePGbMC1/SR8i Cu1DzXDF58U74laDezTiqcqAfVB5h1LYAQ== X-Google-Smtp-Source: ABdhPJxXbAo8p16yTEftBzy7B+OPQzzoLylt/ydirW4/kjNW2z7t2jKSvUoe5mIT5H+qhsmXO/P0yg== X-Received: by 2002:a37:8d6:: with SMTP id 205mr1131645qki.279.1606161191113; Mon, 23 Nov 2020 11:53:11 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id v9sm10440432qkv.34.2020.11.23.11.53.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Nov 2020 11:53:10 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 06/13] linux: nptl: Remove _futex_clock_wait_bitset64 Date: Mon, 23 Nov 2020 16:52:49 -0300 Message-Id: <20201123195256.3336217-6-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201123195256.3336217-1-adhemerval.zanella@linaro.org> References: <20201123195256.3336217-1-adhemerval.zanella@linaro.org> MIME-Version: 1.0 X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Adhemerval Zanella via Libc-alpha From: Adhemerval Zanella Reply-To: Adhemerval Zanella Cc: Michael Kerrisk Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" It can be replaced with a __futex_abstimed_wait64 call. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski --- nptl/pthread_mutex_timedlock.c | 7 +++--- sysdeps/nptl/futex-internal.c | 46 ---------------------------------- sysdeps/nptl/futex-internal.h | 5 ---- 3 files changed, 4 insertions(+), 54 deletions(-) diff --git a/nptl/pthread_mutex_timedlock.c b/nptl/pthread_mutex_timedlock.c index de88e9fc25..0ec47359be 100644 --- a/nptl/pthread_mutex_timedlock.c +++ b/nptl/pthread_mutex_timedlock.c @@ -265,12 +265,13 @@ __pthread_mutex_clocklock_common (pthread_mutex_t *mutex, assume_other_futex_waiters |= FUTEX_WAITERS; /* Block using the futex. */ - int err = __futex_clock_wait_bitset64 (&mutex->__data.__lock, + int err = __futex_abstimed_wait64 ( + (unsigned int *) &mutex->__data.__lock, oldval, clockid, abstime, PTHREAD_ROBUST_MUTEX_PSHARED (mutex)); /* The futex call timed out. */ - if (err == -ETIMEDOUT) - return -err; + if (err == ETIMEDOUT) + return err; /* Reload current lock value. */ oldval = mutex->__data.__lock; } diff --git a/sysdeps/nptl/futex-internal.c b/sysdeps/nptl/futex-internal.c index f9a2e28ee6..30c662547f 100644 --- a/sysdeps/nptl/futex-internal.c +++ b/sysdeps/nptl/futex-internal.c @@ -48,27 +48,6 @@ __futex_abstimed_wait_common32 (unsigned int* futex_word, pts32, NULL /* Unused. */, FUTEX_BITSET_MATCH_ANY); } - -static int -__futex_clock_wait_bitset32 (int *futexp, int val, clockid_t clockid, - const struct __timespec64 *abstime, int private) -{ - struct timespec ts32; - - if (abstime != NULL && ! in_time_t_range (abstime->tv_sec)) - return -EOVERFLOW; - - const unsigned int clockbit = - (clockid == CLOCK_REALTIME) ? FUTEX_CLOCK_REALTIME : 0; - const int op = __lll_private_flag (FUTEX_WAIT_BITSET | clockbit, private); - - if (abstime != NULL) - ts32 = valid_timespec64_to_timespec (*abstime); - - return INTERNAL_SYSCALL_CALL (futex, futexp, op, val, - abstime != NULL ? &ts32 : NULL, - NULL /* Unused. */, FUTEX_BITSET_MATCH_ANY); -} #endif /* ! __ASSUME_TIME64_SYSCALLS */ static int @@ -198,28 +177,3 @@ __futex_clocklock_wait64 (int *futex, int val, clockid_t clockid, return -err; } - -int -__futex_clock_wait_bitset64 (int *futexp, int val, clockid_t clockid, - const struct __timespec64 *abstime, - int private) -{ - int ret; - if (! lll_futex_supported_clockid (clockid)) - { - return -EINVAL; - } - - const unsigned int clockbit = - (clockid == CLOCK_REALTIME) ? FUTEX_CLOCK_REALTIME : 0; - const int op = __lll_private_flag (FUTEX_WAIT_BITSET | clockbit, private); - - ret = INTERNAL_SYSCALL_CALL (futex_time64, futexp, op, val, - abstime, NULL /* Unused. */, - FUTEX_BITSET_MATCH_ANY); -#ifndef __ASSUME_TIME64_SYSCALLS - if (ret == -ENOSYS) - ret = __futex_clock_wait_bitset32 (futexp, val, clockid, abstime, private); -#endif - return ret; -} diff --git a/sysdeps/nptl/futex-internal.h b/sysdeps/nptl/futex-internal.h index cefab74301..dcc7958d59 100644 --- a/sysdeps/nptl/futex-internal.h +++ b/sysdeps/nptl/futex-internal.h @@ -440,9 +440,4 @@ __futex_clocklock64 (int *futex, clockid_t clockid, return err; } -int -__futex_clock_wait_bitset64 (int *futexp, int val, clockid_t clockid, - const struct __timespec64 *abstime, - int private) attribute_hidden; - #endif /* futex-internal.h */