From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Cc: Florian Weimer , Carlos O'Donell , Lukasz Majewski , Thomas Gleixner , Sebastian Andrzej Siewior , Peter Zijlstra , Joseph Myers References: <20210625081104.1134598-1-kurt@linutronix.de> From: Adhemerval Zanella 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-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, KAM_NUMSUBJECT, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Jul 2021 13:30:46 -0000 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.