From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by sourceware.org (Postfix) with ESMTPS id D27E0385BF9C for ; Tue, 8 Jun 2021 18:08:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D27E0385BF9C Received: by mail-qv1-xf34.google.com with SMTP id e18so11289608qvm.10 for ; Tue, 08 Jun 2021 11:08:52 -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=SzY5mAzb8iAAncNXCHh5zNAEVzbO39nRlIsEjy7/kj4=; b=P4p8FAMLUbsRBnVxzjmh1uuRjiDwMfmBI/PNyH7GMaFfenODGsjUUv5iHXCB51AZrZ V2wOqw4ThrhjkeUUitr2Dunk9IQMYaFu+9VBUDLMzppq8BwA1Id44k+LUQ4shBIrr0np ehT5UWS2uPhxigPtQNlGlh812XQnDcVWLus1MyRh0vUvoPypnNKxn4gnzoyms0euwBJy ZOAuCdlVdoMHsOrz5jb2ypFDCEwXA0tWV23h+A6tDCBnxo4+PZg3FbHnvLKm+8ZyC+DV QQhxNcEjkluBaCeXLrPKrVk2nVDnDeb0agd6NAAlB/kciwWmB9QuZkYBHGCqjukVKNpg f5Vg== X-Gm-Message-State: AOAM531YB8o0UJA+1lkv7JM04UEOkJKnIaJGKxHJPse78q4mzM6aEPhE VA26m4dc3v3k7Ux5/XCAZtg2uw== X-Google-Smtp-Source: ABdhPJzq29VJTnN5Q6aeV8Pg0HAuE5CchMgl31X1oKLF8UNjqTft6fNXk8EmKW6Qk8X9KRpEuN1lFQ== X-Received: by 2002:a05:6214:d41:: with SMTP id 1mr1468950qvr.6.1623175732347; Tue, 08 Jun 2021 11:08:52 -0700 (PDT) Received: from [192.168.1.4] ([177.194.59.218]) by smtp.gmail.com with ESMTPSA id h12sm11987725qkj.52.2021.06.08.11.08.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 08 Jun 2021 11:08:52 -0700 (PDT) Subject: Re: [PATCH v4 00/15] Add futex2 syscalls To: Peter Zijlstra , Sebastian Andrzej Siewior Cc: linux-kselftest@vger.kernel.org, joel@joelfernandes.org, Andrey Semashev , kernel@collabora.com, shuah@kernel.org, Davidlohr Bueso , Peter Oskolkov , corbet@lwn.net, krisman@collabora.com, malteskarupke@fastmail.fm, Ingo Molnar , Darren Hart , acme@kernel.org, Steven Rostedt , =?UTF-8?Q?Andr=c3=a9_Almeida?= , Thomas Gleixner , fweimer@redhat.com, libc-alpha@sourceware.org, linux-api@vger.kernel.org, z.figura12@gmail.com, Nicholas Piggin , linux-kernel@vger.kernel.org, pgriffais@valvesoftware.com References: <20210603195924.361327-1-andrealmeid@collabora.com> <1622799088.hsuspipe84.astroid@bobo.none> <1622853816.mokf23xgnt.astroid@bobo.none> <22137ccd-c5e6-9fcc-a176-789558e9ab1e@collabora.com> <20210608122622.oxf662ruaawrtyrd@linutronix.de> From: Adhemerval Zanella Message-ID: <74c7f1c1-ca15-1e86-a988-a4d349ad16ef@linaro.org> Date: Tue, 8 Jun 2021 15:08:44 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, NICE_REPLY_A, 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-List-Received-Date: Tue, 08 Jun 2021 18:09:03 -0000 > All the attempts with API extensions didn't go well because glibc did > not want to change a bit. This starts with a mutex that has a static > initializer which has to work (I don't remember why the first > pthread_mutex_lock() could not fail with -ENOMEM but there was > something) and ends with glibc's struct mutex which is full and has no > room for additional data storage. Yes, we have binary compatibility constraints that prevents us to simply broken old binaries. This is quite true for static initialization, which imposes even harder constraints, different than the pthread_mutex_t size where we can workaround with symbols versioning. But even then we hear from users that out pthread_mutex_t is still way larger, specially for fine grained locking so I am not sure if we do want to extend it. > That said; if we're going to do the whole futex-vector thing, we really > do need a new interface, because the futex multiplex monster is about to > crumble (see the fun wrt timeouts for example). > > And if we're going to do a new interface, we ought to make one that can > solve all these problems. Now, ideally glibc will bring forth some > opinions, but if they don't want to play, we'll go back to the good old > days of non-standard locking libraries.. we're halfway there already due > to glibc not wanting to break with POSIX were we know POSIX was just > dead wrong broken. > > See: https://github.com/dvhart/librtpi You are right, we don't really want to break POSIX requirements in this regard because users constantly come with scenarios where they do expect our implementation to be conformant [1]. And even now, there are case we don't get it fully right [2] and it is really hard to fix such issues. If I recall correctly from a recent plumber couple of years ago about the librtpi, the presents stated their implement do not follow POSIX standard by design. It suits then for their required work, but it is not what we really aim for glibc. We *might* try to provide as an extension, but even then I am not if it would be fully possible due API constraints. So, regarding the futex2 we might try to support it eventually; but if this newer interface is not a really a superset of futex1 we won't put much effort. Supporting newer syscall requires an extra effort from glibc, we need to keep fallback for older ones in case the kernel is too old and it also imposes runtime costs. Also currently we don't have a specific usage. The proposed patch to add the 'pthread_mutex_lock_any' and 'pthreada_timedlock_any' [3] also did not gave much detail in realword usages or how it can be leveraged. [1] https://sourceware.org/bugzilla/show_bug.cgi?id=13165 [2] https://sourceware.org/bugzilla/show_bug.cgi?id=25847 [3] https://sourceware.org/pipermail/libc-alpha/2019-July/105422.html