Received: by 2002:a05:6a10:a852:0:0:0:0 with SMTP id d18csp495011pxy; Wed, 5 May 2021 07:13:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyGKot2urMj1jHicJIxZ1OWXiwabxC+8DJmy55vydNIAH9xZD8s9QuVt/ege1RWDAPQXNID X-Received: by 2002:a50:eb45:: with SMTP id z5mr32865236edp.243.1620223993619; Wed, 05 May 2021 07:13:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620223993; cv=none; d=google.com; s=arc-20160816; b=E/sWQd9b3JglJZaQZ1CKNLs1IbsuLRYUjujz6Zsy7zuCQysURaHk962WxZNwh9jkqK MDo9fqYMiEJmLTgS3Ujtf90YH7iuGBSn2+iMR89FfgPySs6SdOlSTTn76tfOclVNNjeB 8L75FapvaAcumJLse6gf2CrwS+VYMJku0LXgjwf8aGd2af9Ynhvtw1qmu2XKGngsWnS3 6u3fElDHhIDhofBSWsbxvTl/SOOWSD2qfPKQClniakkQPQE0Ro4b9c3YfAkGXVbcNPHt wf3NtVoT8zNi6HxYmMxNj2qJt+teCKRvSes0u/AErbSZcchwXMulNJApIV5XentgkNg1 c2Ww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=MyjiuFoKvP+y8MeTP52CcLCZRkso8M1o4FdkOQlWxdQ=; b=SSyJII25B+T8766rTDTbZ+7JuzBpn+wPENtMTJ4F3Rc6KyxUA4WOJ+DTxF8bQ/gk3V wuFhAdhrl210Yx3YJlDobNsaVwWWYgQd2hsTaFLSCpvKWRsCyjhcl8OciqoHo8M1rAia IrDiWrEFlTmW3M8D/0KsLsYcoQmhp0hkTJInCQAdlxJ1ZlvMQ++9oqHWojd4dGrXe0km bwN+bwG4IqV/T3vCNwRMgzaWvQEmA6adyjhOT+WgyFWjDm5x/VMy5hQ0XFOZsXzPOTwX xOsvN+CJrJrCY6KdUa4/fHD4M0m0YDw73aFWPhpm+lzzwCUC3TuKBHbKBf0umRtQi4qJ dFIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=lrpNhBCx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u11si5854779edq.89.2021.05.05.07.12.43; Wed, 05 May 2021 07:13:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=lrpNhBCx; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232280AbhEENAo (ORCPT + 99 others); Wed, 5 May 2021 09:00:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46158 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231899AbhEENAo (ORCPT ); Wed, 5 May 2021 09:00:44 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0D75C06174A for ; Wed, 5 May 2021 05:59:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=MyjiuFoKvP+y8MeTP52CcLCZRkso8M1o4FdkOQlWxdQ=; b=lrpNhBCxq8BjDB+s4HNKY5vvoZ 1iGbRZJCGbg1lEJn/bn+Isxk9Ow6uE641bGLaxa1nKNUd/y6cUdlbyz48rCgByZGQyDrcGuJ5j+nQ rJN6BBRW0F1hHGCgcgKbkwEu1f+PetAbtu6yc+H9d3hyCMgm9j0USMtwgjNBRo0gJlUngUiSN7YJz GKs9eQ2wVJl2ovP9hkYXUBrMU5uM4B2KQc4QfAstRRSembUX7hSnJ0Q6pA0ge5MpUdUDjKjRAO7oJ fGDq7ynqfxC510FjQ04Faykz0oJVhhpKgbG8JToh/nn3zrIoefPXFnKOUU3B6xy0E8jxwTtg1gThv wpQIl55w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1leH7o-001Fy1-JO; Wed, 05 May 2021 12:59:36 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id ECB8A3001CD; Wed, 5 May 2021 14:59:35 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id AA23E203E67C4; Wed, 5 May 2021 14:59:35 +0200 (CEST) Date: Wed, 5 May 2021 14:59:35 +0200 From: Peter Zijlstra To: Thomas Gleixner Cc: LKML , Adhemerval Zanella , Lukasz Majewski , Florian Weimer , Carlos O'Donell , "Michael Kerrisk (man-pages)" , Davidlohr Bueso , Ingo Molnar , Darren Hart , Andrei Vagin , Kurt Kanzenbach Subject: Re: [patch 0/6] futex: Bugfixes and FUTEX_LOCK_PI2 Message-ID: References: <20210422194417.866740847@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20210422194417.866740847@linutronix.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Apr 22, 2021 at 09:44:17PM +0200, Thomas Gleixner wrote: > The following series started off looking into supporting selectable clocks > for FUTEX_LOCK_PI which is hardcoded to CLOCK_REALTIME and cannot be > changed. > > On the way I found two bugs related to the timeout handling: > > - The allowance for FUTEX_WAIT to use FUTEX_CLOCK_REALTIME is broken and > never worked. > > - The recent time namespace support wreckaged FUTEX_LOCK_PI timeouts when > the task belongs to a namespace which has an CLOCK_MONOTONIC offset. > > Both should have been caught by that Gleixner dude when merging them, > but it seems he's getting old. > > Not having a selectable clock for PI futexes is inconsistent because all > other interfaces have it. Unfortunately this was figured out by glibc folks > quite some time ago, but nobody told us :( > > The nasty hack to support it would be to treat FUTEX_CLOCK_REALTIME inverse > for FUTEX_LOCK_PI, but that's a horrible idea. Adding a new flag to the > futex op, i.e. FUTEX_CLOCK_MONOTONIC would be possible, but that's yet > another variant which makes is harder for libraries to have a consistent > clock selection handling. > > So I went the way to let FUTEX_LOCK_PI alone and to add FUTEX_LOCK_PI2 > which handles the clocks the same way as the other operands. > > Thoughts? With the missing FUTEX_LOCK_PI2 in #6, as spotted by Andr? Almeida, fixed: Acked-by: Peter Zijlstra (Intel) It's all somewhat sad, but I don't see any other way out of this. Using LOCK_PI2 will be a fairly horrible pile of hacks on the userspace side of things given they need to first detect it's presence etc., but that seems unavoidable whatever we do :/