From patchwork Mon Nov 23 19:52:54 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: 1405019 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=sourceware.org (client-ip=8.43.85.97; helo=sourceware.org; envelope-from=libc-alpha-bounces@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=sourceware.org Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=ZpKNb3Kg; dkim-atps=neutral Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CfyX51Cjqz9sRR for ; Tue, 24 Nov 2020 06:53:57 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D906D383E804; Mon, 23 Nov 2020 19:53:23 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D906D383E804 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1606161203; bh=i3WqhNI8F6Sb1F46OAhb+6YGFX0ySByejmmN+BbrTKw=; 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=ZpKNb3KgHkDC+j97szH4Q9XIiiDyCakYb54sCm1bU/rg/ETIcEyL0lm3WgZHlcs9u AqValWXx4W9fPIVBVhf/4UE1dC7sqsZejJZVF0GtcStdBvU1Dp305es+XkqhW3p+f4 CC1pp/HfsnGVfVd5Szoa3CYZjx6B6qI8diHV+mVo= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) by sourceware.org (Postfix) with ESMTPS id F3DFA383F86C for ; Mon, 23 Nov 2020 19:53:20 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org F3DFA383F86C Received: by mail-qk1-x741.google.com with SMTP id y18so1855679qki.11 for ; Mon, 23 Nov 2020 11:53:20 -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=i3WqhNI8F6Sb1F46OAhb+6YGFX0ySByejmmN+BbrTKw=; b=nxUSwda5+pQorynlfwqIf0Wj8AHvZoSu+V3r3L6YP/AdKZGgCFSwYKGPmR0lUq2wdR 6EN+wcp65knp8gSOZSGkA/Vj/ZvrYe5lPhTElTb0d2V7PrcKA+xEg9oJUq08vYY6f493 M9EmMkiQqhctWc5HzcwHfYdjXBMkOtwxxqkJnLUh2yzaI3qS0a9UZckGlY9sDqbsx8z9 HMz7W6M7O2lKj4A9/lEdCcf9Jcx2wX3gw+HZowHJshISqvBO9J5O/B74qkrmbCU4nIVv RqH/4nlv2GaAii52BcxJLutN5MccH/2luWEozbEc8+QyjQyAc8hFydqwiMScDdDIzhF/ b2ew== X-Gm-Message-State: AOAM533bOE6VE3zHp6DUI6q1cQhCb9jSQB7dTLpp0LDlYg8/ByCQwkpK dBHKRJthRAmT4zLLiUOk+oVOHpxHhRCNdw== X-Google-Smtp-Source: ABdhPJxm6KVO9LK+vMGtjLGpKPsh54+VXAj4+W96ZgNo5S4wewuJ8zgFKtXkWukrs7Xa4gG9iYkL5A== X-Received: by 2002:a37:4816:: with SMTP id v22mr1235054qka.42.1606161200407; Mon, 23 Nov 2020 11:53:20 -0800 (PST) Received: from localhost.localdomain ([177.194.48.209]) by smtp.googlemail.com with ESMTPSA id v9sm10440432qkv.34.2020.11.23.11.53.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Nov 2020 11:53:19 -0800 (PST) To: libc-alpha@sourceware.org Subject: [PATCH 11/13] nptl: Replace lll_futex_wake with futex-internal.h Date: Mon, 23 Nov 2020 16:52:54 -0300 Message-Id: <20201123195256.3336217-11-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.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 idea is to make NPTL implementation to use on the functions provided by futex-internal.h. Checked on x86_64-linux-gnu and i686-linux-gnu. Reviewed-by: Lukasz Majewski --- nptl/pthread_mutex_setprioceiling.c | 4 ++-- nptl/pthread_mutex_unlock.c | 6 +++--- nptl/sem_post.c | 9 ++------- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/nptl/pthread_mutex_setprioceiling.c b/nptl/pthread_mutex_setprioceiling.c index cbef202579..8f1d6e1326 100644 --- a/nptl/pthread_mutex_setprioceiling.c +++ b/nptl/pthread_mutex_setprioceiling.c @@ -116,8 +116,8 @@ pthread_mutex_setprioceiling (pthread_mutex_t *mutex, int prioceiling, | (prioceiling << PTHREAD_MUTEX_PRIO_CEILING_SHIFT); atomic_full_barrier (); - lll_futex_wake (&mutex->__data.__lock, INT_MAX, - PTHREAD_MUTEX_PSHARED (mutex)); + futex_wake ((unsigned int *)&mutex->__data.__lock, INT_MAX, + PTHREAD_MUTEX_PSHARED (mutex)); return 0; } diff --git a/nptl/pthread_mutex_unlock.c b/nptl/pthread_mutex_unlock.c index 2b4abb8ebe..56f1732e6d 100644 --- a/nptl/pthread_mutex_unlock.c +++ b/nptl/pthread_mutex_unlock.c @@ -162,7 +162,7 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr) private = PTHREAD_ROBUST_MUTEX_PSHARED (mutex); if (__glibc_unlikely ((atomic_exchange_rel (&mutex->__data.__lock, 0) & FUTEX_WAITERS) != 0)) - lll_futex_wake (&mutex->__data.__lock, 1, private); + futex_wake ((unsigned int *) &mutex->__data.__lock, 1, private); /* We must clear op_pending after we release the mutex. FIXME However, this violates the mutex destruction requirements @@ -332,8 +332,8 @@ __pthread_mutex_unlock_full (pthread_mutex_t *mutex, int decr) &oldval, newval)); if ((oldval & ~PTHREAD_MUTEX_PRIO_CEILING_MASK) > 1) - lll_futex_wake (&mutex->__data.__lock, 1, - PTHREAD_MUTEX_PSHARED (mutex)); + futex_wake ((unsigned int *)&mutex->__data.__lock, 1, + PTHREAD_MUTEX_PSHARED (mutex)); int oldprio = newval >> PTHREAD_MUTEX_PRIO_CEILING_SHIFT; diff --git a/nptl/sem_post.c b/nptl/sem_post.c index 88cfc24b30..5dbfb3a214 100644 --- a/nptl/sem_post.c +++ b/nptl/sem_post.c @@ -84,19 +84,14 @@ int attribute_compat_text_section __old_sem_post (sem_t *sem) { - int *futex = (int *) sem; + unsigned int *futex = (unsigned int *) sem; /* We must need to synchronize with consumers of this token, so the atomic increment must have release MO semantics. */ atomic_write_barrier (); (void) atomic_increment_val (futex); /* We always have to assume it is a shared semaphore. */ - int err = lll_futex_wake (futex, 1, LLL_SHARED); - if (__builtin_expect (err, 0) < 0) - { - __set_errno (-err); - return -1; - } + futex_wake (futex, 1, LLL_SHARED); return 0; } compat_symbol (libpthread, __old_sem_post, sem_post, GLIBC_2_0);