Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp961006ybx; Thu, 7 Nov 2019 05:18:09 -0800 (PST) X-Google-Smtp-Source: APXvYqz/GYQ1j9IwQ2sdFu6Jmtr6xnf7EWz1u8S3csKGscemeYxa2Eu5sBg0vtSfk2JxhsH1M2gb X-Received: by 2002:a17:906:7c4e:: with SMTP id g14mr2921135ejp.150.1573132689191; Thu, 07 Nov 2019 05:18:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1573132689; cv=none; d=google.com; s=arc-20160816; b=y5/g0yr+R7SCMRbRxmF+kM0vFW0Tvs+zU9LfTsEgYGRekDmOnVI6Wt0MS6cVksnEVA +yJWzemKkmB10DIWxN5LGDrP/gli1bXLs0hwHnkHJ11szMEjKYTf4lgYzZsO9dnbDXpe 26C62y1TaInynLrft7i+x1E0SxO6XLk544H4NhwRe/TH+puFZuUFspEC9YBolRXbatgw w/9zhDjMI+B0CNsTazDO4U9kcK8xMPRzsJ/IWs2Ii7qWwqmNgIPXv7ofxbTsOjOW8yiE UTYmwGOY6Lo5mnU7ZVaw4SHCmVQXwgfCfxH/rF5S1cN9XBW3yniKZrqPF1VlBpnE037d cwlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:thread-index :thread-topic:mime-version:subject:references:in-reply-to:message-id :cc:to:from:date:dkim-signature; bh=j1MMxDuBA2PT6Y9+w8jTfu629ILAe/OTnOMkshmEPcE=; b=NYnKyEcUVwIQk5oF7AZyMX74BAfmqFKgtV2V7dvKBda/AHFHJRjMFwbylN0phBmyV3 bw15h/soBhs6QXHlGFFAkkKkkVD13y69N/f9MXOdV8GyTudL25WD5/xP8BBwAVi8bRD6 MxqhC5BTnNx5iL9YYlYzT+8kKIVj5UeX8bv8i13C7cJRmxfmtzA9s6Md2CXLicvpxbT9 EwKuVue7TSuXWuKfrwafeCENb+W7cX4tpNunUmll4RSgwJFkepFeiBKFrHFaUX54+7B2 7suKPXpFWT22f6dpDDdHmTDWGIR/7XkWvQ5GkgFL3aDYIBnilVC4QhVUAy9ffaj3+uRG 28rg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ST3hgdQ5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h6si817918ejt.227.2019.11.07.05.17.46; Thu, 07 Nov 2019 05:18:09 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=ST3hgdQ5; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388574AbfKGNRG (ORCPT + 99 others); Thu, 7 Nov 2019 08:17:06 -0500 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:34307 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727278AbfKGNRF (ORCPT ); Thu, 7 Nov 2019 08:17:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573132624; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=j1MMxDuBA2PT6Y9+w8jTfu629ILAe/OTnOMkshmEPcE=; b=ST3hgdQ5RXD6Jy+78NyAamjd2LpilK58QQiT4DFjFRK7WM0wm3+tUXEn60mUjzqd2yz2Kt EgussIM6nKXCMKBpZrNI989bYtzyylidsFFRZD+MP1T1HI1WueTvvfR0Ch+v8Ot8j3xhmU OYvA/qvNRDS/4NaGz2gZ1pBidi0opSg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-371-Vx7LdW-aOr6GwqnIXiwZcQ-1; Thu, 07 Nov 2019 08:17:01 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D926E477; Thu, 7 Nov 2019 13:16:59 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id CC8E95D6A0; Thu, 7 Nov 2019 13:16:59 +0000 (UTC) Received: from zmail17.collab.prod.int.phx2.redhat.com (zmail17.collab.prod.int.phx2.redhat.com [10.5.83.19]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B390518095FF; Thu, 7 Nov 2019 13:16:59 +0000 (UTC) Date: Thu, 7 Nov 2019 08:16:59 -0500 (EST) From: Jan Stancek To: Thomas Gleixner Cc: Ingo Molnar , Peter Zijlstra , Darren Hart , longman@redhat.com, LKML Message-ID: <524359139.10936023.1573132619485.JavaMail.zimbra@redhat.com> In-Reply-To: References: <9179dbc3505e1de99ee36b09b0a12995239d73c3.1573079868.git.jstancek@redhat.com> Subject: Re: [RFC PATCH] futex: don't retry futex_wait() with stale uaddr/val after spurious wakeup MIME-Version: 1.0 X-Originating-IP: [10.43.17.163, 10.4.195.15] Thread-Topic: futex: don't retry futex_wait() with stale uaddr/val after spurious wakeup Thread-Index: L7GrCzziNDlfxhA/K3ZluS5Mqhrymw== X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-MC-Unique: Vx7LdW-aOr6GwqnIXiwZcQ-1 X-Mimecast-Spam-Score: 0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org My apologies for the 'word salad'. > So you go great length to "fix" the spurious wakeup case, but what happen= s if > there is an actual signal? >=20 > It will return to handle the signal and then run into the exactly same > situation because it restarts the syscall with the original uaddr1/uval, > right? Right, I missed that. >=20 > That means that the shortcut which was added in commit d58e6576b0de > ("futex: Handle spurious wake up") is equivalent to the actual signal cas= e. >=20 > So the above churn is pretty pointless because it "fixes" not even half o= f > the problem and you can't fix the -ERESTARTSYS case at all. >=20 > IIRC the uaddr1 value is supposed to change on a requeue operation so tha= t > a late incoming waiter goes back with -EWOULDBLOCK. And excatly the same > would happen on the retry. >=20 > Aside of that you are completely failing to explain in which context you > observe this problem. Is that failing on libc, some test case or some oth= er > maybe experimental code? It's test case (LTP futex_cmp_requeue01), which keeps uaddr1 value same across requeue, and then sporadically fails to wake up some child processes= . >=20 > If there is an actual use case for keeping the uaddr1 value the same acro= ss > a requeue.. It seems both I and test author missed some hint at man page for FUTEX_CMP_REQUEUE and assumed this was valid use case. > But let's talk about that once you came up with a proper explanation for > what you are trying to solve and why you think it's correct. Thank you for the detailed response.