From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS3215 2.6.0.0/16 X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (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 dcvr.yhbt.net (Postfix) with ESMTPS id C7C2C1F8C6 for ; Fri, 9 Jul 2021 13:31:05 +0000 (UTC) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id BB9923988030 for ; Fri, 9 Jul 2021 13:31:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BB9923988030 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1625837464; bh=1MAd6soACmAi7ujBRS0VOxoXqeJL5exLOfL7fTKsFQk=; h=Subject:To:References:Date:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=xuq3P2qvuE04Uj+KfLCbCqVERTTHfBkWz4Dj+jZ9oqskyzuAsc+BDju/yvgcjCDqt B2FEXwcntYgqcBKY7CtR/j9euQql+QrJOXPZ2Zq0w2QUBEbfwVWNUN74t3/WWy4UKJ 0pwC9WlwD3O3DztfGt0gG14dHV+p+0O0PruNU9Ek= Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by sourceware.org (Postfix) with ESMTPS id 2C8C3385043E for ; Fri, 9 Jul 2021 13:30:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2C8C3385043E Received: by mail-pg1-x52e.google.com with SMTP id w15so9938879pgk.13 for ; Fri, 09 Jul 2021 06:30: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:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=1MAd6soACmAi7ujBRS0VOxoXqeJL5exLOfL7fTKsFQk=; b=rfs5OaRSGIngUiR08NfONTxU0j/KJIQDnC2DpYijGBfswLbdesUMOwucm0vx5KbmfB 2k/g6IBqzCxVcwz/lCqm0vqJCunSaN1sYdKRdGUjJTUzCVNbTxzOwjGIRa/FKH6sciv1 GwZ8cNo350gvZoABZxuJ3c0UgAcqnga52Z+dDcH6QBMkRg8LUpFtldIt5csw/8sLxcZh ndwu9mjY4s6rS+xDOE9OSSwfBfjsvKrwvM2gIPG6hLzPJnyjg+ZpDE4gMgYE5WTNQPGl ZqGSZoCleK0sXRJ0Kb5hDhqQGiaX7RiG/daaFNMw7QvImgdxdXzPL5lyaRjgQ1X1mCOi wANQ== X-Gm-Message-State: AOAM533iq7QNZqcuYpS1Dg56YiNfrZRN288cNXlq8Xl+6SLdy8pV+Xdb HZgnvQ1aenMQaMvuydP++1Qe2A== X-Google-Smtp-Source: ABdhPJzy1pNI97Sr9+lADVY7GY6SaMnN+kY/R6X0XqNZtP3JPl4hn7KAz2RetTxfVG4dvQOtK7bQuw== X-Received: by 2002:a65:6a4c:: with SMTP id o12mr1705196pgu.108.1625837444197; Fri, 09 Jul 2021 06:30:44 -0700 (PDT) Received: from [192.168.1.108] ([177.194.59.218]) by smtp.gmail.com with ESMTPSA id u37sm6427147pfg.140.2021.07.09.06.30.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Jul 2021 06:30:43 -0700 (PDT) Subject: Re: [PATCH v1 0/6] nptl: Introduce and use FUTEX_LOCK_PI2 To: Kurt Kanzenbach , libc-alpha@sourceware.org References: <20210625081104.1134598-1-kurt@linutronix.de> Message-ID: <8b3c3bc1-1738-9b05-4557-776f31430cb5@linaro.org> Date: Fri, 9 Jul 2021 10:30:39 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210625081104.1134598-1-kurt@linutronix.de> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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: , From: Adhemerval Zanella via Libc-alpha Reply-To: Adhemerval Zanella Cc: Florian Weimer , Sebastian Andrzej Siewior , Peter Zijlstra , Thomas Gleixner , Joseph Myers Errors-To: libc-alpha-bounces+e=80x24.org@sourceware.org Sender: "Libc-alpha" On 25/06/2021 05:10, Kurt Kanzenbach wrote: > Linux real time applications often make use of mutexes with priority inheritance > enabled due to problems such as unbounded priority inversion. In addition, some > applications make use of timeouts e.g., by utilizing pthread_mutex_clocklock(). > > However, the combination of priority inheritance enabled mutexes with timeouts > based on CLOCK_MONOTONIC doesn't work. That is because the underlying Linux > kernel futex interface didn't support it, yet. Using CLOCK_REALTIME is possible, > but it is subject to adjustments (NTP, PTP, ...). Therefore, Thomas proposed and > introduced a new futex operation called FUTEX_LOCK_PI2 with support for > selectable clocks [1]. > > Here is a proof of concept patch set adding FUTEX_LOCK_PI2 in order to support > pthread_mutex_clocklock(MONOTONIC)/PI. The idea is to use futex_lock_pi2() by > default, and fallback to futex_lock_pi() in case the kernel is too old. > > There's also a bugreport for glibc with a test case: > > https://sourceware.org/bugzilla/show_bug.cgi?id=26801 > > Changes since RFC: > > * FUTEX_LOCK_PI2 merged in upstream Linux kernel (Thomas Gleixner, Peter Zijlstra) > * Make of __ASSUME_FUTEX_LOCK_PI2 in the implementation (Adhemerval Zanella) > * Get rid of probing for FUTEX_LOCK_PI2 in timedlock (Adhemerval Zanella) > * Adjust the test cases (Adhemerval Zanella) > * Use correct Linux kernel version (Joseph Myers) > > Previous versions: > > * https://sourceware.org/pipermail/libc-alpha/2021-June/127798.html > > Thanks, > Kurt > > [1] - https://lkml.kernel.org/lkml/20210422194417.866740847@linutronix.de/ Patch looks ok in general, I think I have only minor comments. I see that FUTEX_LOCK_PI2 is already on Linus tree, should it should be safe to assume it will on v5.14 (although is not yet released). We are in the slush freeze for the 2.34 release, so you would like to check with Carlos O'Donell if this set is suitable to inclusion. It does not change any ABI, but I will need to some time to boot a kernel to actually test it.