From patchwork Mon Nov 23 19:52:44 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adhemerval Zanella Netto X-Patchwork-Id: 41159 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 3E0ED386F430; Mon, 23 Nov 2020 19:53:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3E0ED386F430 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1606161185; bh=jBH22MJ9pWNq61iSknC2htil+Xg1ePgJI2gWrDXQaBA=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=nBgJj/R31AVThEVAdOc2Bz7cWLTwdCw44YrD9RwvubjLHdu5gGOO1DiIpgIBghIQ+ xaZ3keOxQKeptmcVTrUXq3vBmhteXgcIvhyRoMlDlFltaeu3rghsm80p0dpgFKMThi W80cy2I+dedGAtoEYOTWfBKrhEKambmk9CVxwUEU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x742.google.com (mail-qk1-x742.google.com [IPv6:2607:f8b0:4864:20::742]) by sourceware.org (Postfix) with ESMTPS id 19D2B385802D for ; Mon, 23 Nov 2020 19:53:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 19D2B385802D Received: by mail-qk1-x742.google.com with SMTP id y18so1854617qki.11 for ; Mon, 23 Nov 2020 11:53:03 -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:mime-version :content-transfer-encoding; bh=jBH22MJ9pWNq61iSknC2htil+Xg1ePgJI2gWrDXQaBA=; b=c7G/VlqK9OkFU88SV34PlFF8JaFy02aZc48X9docezjezlDb9ef1KxN25Mk3Inxo/D 2K/CBaf49/PZYPsl7IERCgI8g1x1FrQfo9iUM0hAxd91uAVhdCSFsc3Mpn1FzWDc5PAc GjVyOaf7I6GjaP5dOwaCRg1xtqWOEWN8C4nvPNPsCXmd2sx6XqLs0SbXrUKmMx9EHhyr Lb+Q3044upz+YASIDOos/si7LRGoUZETDARNu54biztCvvCgKJaORR7uEYkxaJSImfjX dj5TRVI0EGB4wADygT+iTQleEpdk1FsfZLDnEwCXiW7kNSO6eHN3U39vys9o5WQr+Qq6 eFWQ== X-Gm-Message-State: AOAM532aj/9NR6CAp05AXJ16UcSLwbx01EBYmXGzec+ibEM8U5yb6xSQ TiE0RdTAl4/F4AZVvCzXigyP2ZRnANrfeQ== X-Google-Smtp-Source: ABdhPJxeHsPoNtynKYX6LfT7heKwm4rKR8y9YopWKInMvxFA33fqJg51s/MsvK2nYJqacGEvVM5BNQ== X-Received: by 2002:a37:6814:: with SMTP id d20mr1101965qkc.445.1606161182318; Mon, 23 Nov 2020 11:53:02 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id v9sm10440432qkv.34.2020.11.23.11.53.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Nov 2020 11:53:01 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 01/13] linux: Remove unused internal futex functions Date: Mon, 23 Nov 2020 16:52:44 -0300 Message-Id: <20201123195256.3336217-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, 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 Netto Reply-To: Adhemerval Zanella Cc: Michael Kerrisk Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" The __futex_abstimed_wait usage was remove with 3102e28bd11 and the __futex_abstimed_wait_cancelable by 323592fdc92 and b8d3e8fbaac. The futex_lock_pi can be replaced by a futex_lock_pi64. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski --- nptl/pthread_mutex_lock.c | 3 +- sysdeps/nptl/futex-internal.h | 98 ----------------------------------- 2 files changed, 1 insertion(+), 100 deletions(-) diff --git a/nptl/pthread_mutex_lock.c b/nptl/pthread_mutex_lock.c index fac774e608..0439002454 100644 --- a/nptl/pthread_mutex_lock.c +++ b/nptl/pthread_mutex_lock.c @@ -413,8 +413,7 @@ __pthread_mutex_lock_full (pthread_mutex_t *mutex) int private = (robust ? PTHREAD_ROBUST_MUTEX_PSHARED (mutex) : PTHREAD_MUTEX_PSHARED (mutex)); - int e = futex_lock_pi ((unsigned int *) &mutex->__data.__lock, - NULL, private); + int e = futex_lock_pi64 (&mutex->__data.__lock, NULL, private); if (e == ESRCH || e == EDEADLK) { assert (e != EDEADLK diff --git a/sysdeps/nptl/futex-internal.h b/sysdeps/nptl/futex-internal.h index c27d0cdac8..21e3b74be6 100644 --- a/sysdeps/nptl/futex-internal.h +++ b/sysdeps/nptl/futex-internal.h @@ -275,76 +275,6 @@ futex_abstimed_supported_clockid (clockid_t clockid) return lll_futex_supported_clockid (clockid); } -/* Like futex_reltimed_wait, but the provided timeout (ABSTIME) is an - absolute point in time; a call will time out after this point in time. */ -static __always_inline int -futex_abstimed_wait (unsigned int* futex_word, unsigned int expected, - clockid_t clockid, - const struct timespec* abstime, int private) -{ - /* Work around the fact that the kernel rejects negative timeout values - despite them being valid. */ - if (__glibc_unlikely ((abstime != NULL) && (abstime->tv_sec < 0))) - return ETIMEDOUT; - int err = lll_futex_clock_wait_bitset (futex_word, expected, - clockid, abstime, - private); - switch (err) - { - case 0: - case -EAGAIN: - case -EINTR: - case -ETIMEDOUT: - return -err; - - case -EFAULT: /* Must have been caused by a glibc or application bug. */ - case -EINVAL: /* Either due to wrong alignment, unsupported - clockid or due to the timeout not being - normalized. Must have been caused by a glibc or - application bug. */ - case -ENOSYS: /* Must have been caused by a glibc bug. */ - /* No other errors are documented at this time. */ - default: - futex_fatal_error (); - } -} - -/* Like futex_reltimed_wait but is a POSIX cancellation point. */ -static __always_inline int -futex_abstimed_wait_cancelable (unsigned int* futex_word, - unsigned int expected, - clockid_t clockid, - const struct timespec* abstime, int private) -{ - /* Work around the fact that the kernel rejects negative timeout values - despite them being valid. */ - if (__glibc_unlikely ((abstime != NULL) && (abstime->tv_sec < 0))) - return ETIMEDOUT; - int oldtype; - oldtype = __pthread_enable_asynccancel (); - int err = lll_futex_clock_wait_bitset (futex_word, expected, - clockid, abstime, - private); - __pthread_disable_asynccancel (oldtype); - switch (err) - { - case 0: - case -EAGAIN: - case -EINTR: - case -ETIMEDOUT: - return -err; - - case -EFAULT: /* Must have been caused by a glibc or application bug. */ - case -EINVAL: /* Either due to wrong alignment or due to the timeout not - being normalized. Must have been caused by a glibc or - application bug. */ - case -ENOSYS: /* Must have been caused by a glibc bug. */ - /* No other errors are documented at this time. */ - default: - futex_fatal_error (); - } -} - /* Atomically wrt other futex operations on the same futex, this unblocks the specified number of processes, or all processes blocked on this futex if there are fewer than the specified number. Semantically, this is @@ -410,34 +340,6 @@ futex_wake (unsigned int* futex_word, int processes_to_wake, int private) futex. - ETIMEDOUT if the ABSTIME expires. */ -static __always_inline int -futex_lock_pi (unsigned int *futex_word, const struct timespec *abstime, - int private) -{ - int err = lll_futex_timed_lock_pi (futex_word, abstime, private); - switch (err) - { - case 0: - case -EAGAIN: - case -EINTR: - case -ETIMEDOUT: - case -ESRCH: - case -EDEADLK: - case -EINVAL: /* This indicates either state corruption or that the kernel - found a waiter on futex address which is waiting via - FUTEX_WAIT or FUTEX_WAIT_BITSET. This is reported on - some futex_lock_pi usage (pthread_mutex_timedlock for - instance). */ - return -err; - - case -EFAULT: /* Must have been caused by a glibc or application bug. */ - case -ENOSYS: /* Must have been caused by a glibc bug. */ - /* No other errors are documented at this time. */ - default: - futex_fatal_error (); - } -} - static __always_inline int futex_lock_pi64 (int *futex_word, const struct __timespec64 *abstime, int private)