Message ID | 20210906204740.3988273-1-adhemerval.zanella@linaro.org |
---|---|
Headers |
Return-Path: <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> 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 D8E2A385AC3D for <patchwork@sourceware.org>; Mon, 6 Sep 2021 20:48:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D8E2A385AC3D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1630961286; bh=987K9enP5G2Ojhgn25X9MiPXEbITNcgkIE9HvrRPfkM=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=aXqvdQ8R4rm8ZVges2Y/SP7IuEeygWe23hfOL3tmOxvtly+uhynzFvOUWYn9WRruv cmiMwNwsBZvTxbWI/gw3bgisxWWv87onO14QIEgDpzR7OPdjkWWNzOOOyhJKxdJ0aN c+1yW7sOak6Hu+nBrDIRW9BsIv2Od8g/7TqGY7ag= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by sourceware.org (Postfix) with ESMTPS id A70763857036 for <libc-alpha@sourceware.org>; Mon, 6 Sep 2021 20:47:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A70763857036 Received: by mail-qv1-xf2a.google.com with SMTP id u4so983210qvb.6 for <libc-alpha@sourceware.org>; Mon, 06 Sep 2021 13:47:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=987K9enP5G2Ojhgn25X9MiPXEbITNcgkIE9HvrRPfkM=; b=s3QKPZIhmjYLRcTSNzFTFYo9UXtiuNkpfsEdRGt3ZVtu79Cn+gWRNQd1QzzYMEwEyD o9xv2bSeih26Zy4oRsnnNubwnCfFhDYRgCcSz+7qo3M0+KN8315AKCjsEVGbxGQggVHw jjwO+Y7nrDk0cLkSlwItl0Ms+/t6Xqk+g6RfgFOxGj+zRS4VQTn8wazuCR/g2v2vhXTl qCRCy/n6YK6tXfCKhjxkHJ2mvI/KJ+KFfAzJg5S7BIkUoyWxYSKJQbIjhfnTBi5pNVdC +8wuCJhIACzZQEES3oq+nd65nLif5uP8sYBEKChFFMVZ11kDu+YmjtfHmqOFaVwIm1JB 5g1g== X-Gm-Message-State: AOAM530GojUSToYts/nvwL1FyA7ERyAVzLHIBqKZHirgz6BiCE1IGOAP Xjx+LNYeDdDAIU3kNZqZDqxhRynLTTttyQ== X-Google-Smtp-Source: ABdhPJwFiZfTtV77Rzr9/TIrcTW6rJ6Dikxxw6/GQHC2edmTclJEAokd9Dsm2ZrzbhfWJy6d++UshQ== X-Received: by 2002:a0c:8d0f:: with SMTP id r15mr13874968qvb.1.1630961263997; Mon, 06 Sep 2021 13:47:43 -0700 (PDT) Received: from birita.. ([2804:431:c7cb:733d:210:e147:8627:2d6]) by smtp.gmail.com with ESMTPSA id w129sm7468416qkb.61.2021.09.06.13.47.43 for <libc-alpha@sourceware.org> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Sep 2021 13:47:43 -0700 (PDT) To: libc-alpha@sourceware.org Subject: [PATCH v3 0/4] Add CLOCK_MONOTONIC support for PI mutexes Date: Mon, 6 Sep 2021 17:47:36 -0300 Message-Id: <20210906204740.3988273-1-adhemerval.zanella@linaro.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list <libc-alpha.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/libc-alpha/> List-Post: <mailto:libc-alpha@sourceware.org> List-Help: <mailto:libc-alpha-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/libc-alpha>, <mailto:libc-alpha-request@sourceware.org?subject=subscribe> From: Adhemerval Zanella via Libc-alpha <libc-alpha@sourceware.org> Reply-To: Adhemerval Zanella <adhemerval.zanella@linaro.org> Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" <libc-alpha-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
Add CLOCK_MONOTONIC support for PI mutexes
|
|
Message
Adhemerval Zanella Netto
Sept. 6, 2021, 8:47 p.m. UTC
It adds support for CLOCK_MONOTONIC for PI mutexes by using the new Linux v5.14 FUTEX_LOCK_PI2 operation. Similar to current approach, pthread_mutex_clocklock might return EINVAL if the underlying kernel has no support for the futex operation. Changes since v2: * Renamed xpthread_mutex_pi_support_monotonic to support_mutex_pi_monotonic. Changes since v1: * Refactor futex_lock_pi64 and avoid adding futex_lock_pi2. The FUTEX_LOCK_PI2 logic is done at only one place, so the code change on pthread routines are minimal. Also, FUTEX_LOCK_PI2 is only used if it is really required, i.e, when a timeout against CLOCK_MONOTONIC is used. * Do not remove nptl/tst-mutexpi10.c, but instead adjust it to new FUTEX_LOCK_PI2 support. * Add pthread_mutex_pi_support_monotonic() to check if monotonic clock with PI mutexes are supported and use on test to check for the expected result. Adhemerval Zanella (3): nptl: Use FUTEX_LOCK_PI2 when available support: Add support_mutex_pi_monotonic nptl: Add CLOCK_MONOTONIC support for PI mutexes Kurt Kanzenbach (1): Linux: Add FUTEX_LOCK_PI2 nptl/futex-internal.c | 63 +++++++++++++++++++++++ nptl/pthread_mutex_lock.c | 3 +- nptl/pthread_mutex_timedlock.c | 10 +--- nptl/tst-mutexpi10.c | 42 +++++++++------ support/Makefile | 1 + support/support_mutex_pi_monotonic.c | 33 ++++++++++++ support/xthread.h | 4 ++ sysdeps/nptl/futex-internal.h | 58 ++------------------- sysdeps/nptl/lowlevellock-futex.h | 1 + sysdeps/pthread/tst-mutex5.c | 23 ++++++--- sysdeps/pthread/tst-mutex9.c | 20 ++++--- sysdeps/unix/sysv/linux/kernel-features.h | 8 +++ 12 files changed, 172 insertions(+), 94 deletions(-) create mode 100644 support/support_mutex_pi_monotonic.c
Comments
Ping on the set. On 06/09/2021 17:47, Adhemerval Zanella wrote: > It adds support for CLOCK_MONOTONIC for PI mutexes by using the new > Linux v5.14 FUTEX_LOCK_PI2 operation. Similar to current approach, > pthread_mutex_clocklock might return EINVAL if the underlying kernel > has no support for the futex operation. > > Changes since v2: > > * Renamed xpthread_mutex_pi_support_monotonic to > support_mutex_pi_monotonic. > > Changes since v1: > > * Refactor futex_lock_pi64 and avoid adding futex_lock_pi2. The > FUTEX_LOCK_PI2 logic is done at only one place, so the code change > on pthread routines are minimal. Also, FUTEX_LOCK_PI2 is only > used if it is really required, i.e, when a timeout against > CLOCK_MONOTONIC is used. > * Do not remove nptl/tst-mutexpi10.c, but instead adjust it to new > FUTEX_LOCK_PI2 support. > * Add pthread_mutex_pi_support_monotonic() to check if monotonic > clock with PI mutexes are supported and use on test to check for > the expected result. > > Adhemerval Zanella (3): > nptl: Use FUTEX_LOCK_PI2 when available > support: Add support_mutex_pi_monotonic > nptl: Add CLOCK_MONOTONIC support for PI mutexes > > Kurt Kanzenbach (1): > Linux: Add FUTEX_LOCK_PI2 > > nptl/futex-internal.c | 63 +++++++++++++++++++++++ > nptl/pthread_mutex_lock.c | 3 +- > nptl/pthread_mutex_timedlock.c | 10 +--- > nptl/tst-mutexpi10.c | 42 +++++++++------ > support/Makefile | 1 + > support/support_mutex_pi_monotonic.c | 33 ++++++++++++ > support/xthread.h | 4 ++ > sysdeps/nptl/futex-internal.h | 58 ++------------------- > sysdeps/nptl/lowlevellock-futex.h | 1 + > sysdeps/pthread/tst-mutex5.c | 23 ++++++--- > sysdeps/pthread/tst-mutex9.c | 20 ++++--- > sysdeps/unix/sysv/linux/kernel-features.h | 8 +++ > 12 files changed, 172 insertions(+), 94 deletions(-) > create mode 100644 support/support_mutex_pi_monotonic.c >
I will push this set shortly if no one opposes it. On 27/09/2021 10:48, Adhemerval Zanella wrote: > Ping on the set. > > On 06/09/2021 17:47, Adhemerval Zanella wrote: >> It adds support for CLOCK_MONOTONIC for PI mutexes by using the new >> Linux v5.14 FUTEX_LOCK_PI2 operation. Similar to current approach, >> pthread_mutex_clocklock might return EINVAL if the underlying kernel >> has no support for the futex operation. >> >> Changes since v2: >> >> * Renamed xpthread_mutex_pi_support_monotonic to >> support_mutex_pi_monotonic. >> >> Changes since v1: >> >> * Refactor futex_lock_pi64 and avoid adding futex_lock_pi2. The >> FUTEX_LOCK_PI2 logic is done at only one place, so the code change >> on pthread routines are minimal. Also, FUTEX_LOCK_PI2 is only >> used if it is really required, i.e, when a timeout against >> CLOCK_MONOTONIC is used. >> * Do not remove nptl/tst-mutexpi10.c, but instead adjust it to new >> FUTEX_LOCK_PI2 support. >> * Add pthread_mutex_pi_support_monotonic() to check if monotonic >> clock with PI mutexes are supported and use on test to check for >> the expected result. >> >> Adhemerval Zanella (3): >> nptl: Use FUTEX_LOCK_PI2 when available >> support: Add support_mutex_pi_monotonic >> nptl: Add CLOCK_MONOTONIC support for PI mutexes >> >> Kurt Kanzenbach (1): >> Linux: Add FUTEX_LOCK_PI2 >> >> nptl/futex-internal.c | 63 +++++++++++++++++++++++ >> nptl/pthread_mutex_lock.c | 3 +- >> nptl/pthread_mutex_timedlock.c | 10 +--- >> nptl/tst-mutexpi10.c | 42 +++++++++------ >> support/Makefile | 1 + >> support/support_mutex_pi_monotonic.c | 33 ++++++++++++ >> support/xthread.h | 4 ++ >> sysdeps/nptl/futex-internal.h | 58 ++------------------- >> sysdeps/nptl/lowlevellock-futex.h | 1 + >> sysdeps/pthread/tst-mutex5.c | 23 ++++++--- >> sysdeps/pthread/tst-mutex9.c | 20 ++++--- >> sysdeps/unix/sysv/linux/kernel-features.h | 8 +++ >> 12 files changed, 172 insertions(+), 94 deletions(-) >> create mode 100644 support/support_mutex_pi_monotonic.c >>