Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp2898186ima; Sun, 3 Feb 2019 09:02:03 -0800 (PST) X-Google-Smtp-Source: AHgI3IZe4FQ+uZh+pF0nlP6KJUX5tkgIzck81xY/WMKZXJjClQyardaauBWZnfblB/1adcCQ0iwD X-Received: by 2002:a63:5b19:: with SMTP id p25mr1720828pgb.424.1549213323861; Sun, 03 Feb 2019 09:02:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549213323; cv=none; d=google.com; s=arc-20160816; b=JEwlrkIaykNAzvHh0AWUjgPvuHOkoHDlqb3rP6gDrBDxzHNineJG0M3mfm1AjOGcvR Xy8jJlCzXXg1JRoP0rl0cOyEIGmfAhXnfuV5Uu6o6AeQFTaLUCXnWonsXRBrChCjXQRA 9dACSBPBoMNLLN94NjWEa3XqPXx/NYqDMqDSICuq5yg7Sm+hFZGG2IHxVjHaFulQ775n 6y/bQThB64h8o2us7j0rSpqVPq0ObGs77Fpe++8mpKdawA6BbGtNpXlrPXsgxUgQY7KE 6t9T9zinIEF3DnoJVEq5mc/j0sOAlK/7vaxjdzQxF85eomwcc9RylMR0OWvqJavqGYU+ HVkQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=6XOh6VJs/Q0qBnReLvttux7nOl67CQifhlTnbyxZQDU=; b=KAv9PNkWDLR2MzGFO3OQQdJKHs/IGryhQMNBoRJWa0YFBSYkrWRjgUSN45GMQOVY/J cSxi+i3ue2KlCQGezWtag7j/s3MysXy7i22UVksRvaVU6FvzW+DCLznAW5b8+QlNk9r+ gx9Ul/LIwyyj41U3QWrjknRElA+RRvp4hV4rKxZSZibN/uxuQCMFxxNqGMiionUtb3za Ns54XxbIcQRbR3KKYjmGpYRq61Ah/1pgUv2RASaEyIH5brlyAz4JdtocrhOpYQ4ocN4M +YQ6q7qg2Al+6NvAmvh8rk1BqdD+8E6oxcWKCDWup6CdvVVVBC0sroAsiQx1d1zTBv+m GF6Q== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t6si13021472pgn.258.2019.02.03.09.01.47; Sun, 03 Feb 2019 09:02:03 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726717AbfBCQas (ORCPT + 99 others); Sun, 3 Feb 2019 11:30:48 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:54012 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726399AbfBCQar (ORCPT ); Sun, 3 Feb 2019 11:30:47 -0500 Received: from p5492e0d8.dip0.t-ipconnect.de ([84.146.224.216] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gqKfH-0004UY-N9; Sun, 03 Feb 2019 17:30:39 +0100 Date: Sun, 3 Feb 2019 17:30:39 +0100 (CET) From: Thomas Gleixner To: Heiko Carstens cc: Sebastian Sewior , "Paul E. McKenney" , Peter Zijlstra , Ingo Molnar , Martin Schwidefsky , LKML , linux-s390@vger.kernel.org, Stefan Liebler Subject: Re: WARN_ON_ONCE(!new_owner) within wake_futex_pi() triggerede In-Reply-To: <20190202112006.GB3381@osiris> Message-ID: References: <20190130233557.GA4240@linux.ibm.com> <20190131165228.GA32680@osiris> <20190131170653.spnrxsiblkssleyd@linutronix.de> <20190201161227.GG3770@osiris> <20190202091043.GA3381@osiris> <20190202112006.GB3381@osiris> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2 Feb 2019, Heiko Carstens wrote: > On Sat, Feb 02, 2019 at 11:14:27AM +0100, Thomas Gleixner wrote: > > On Sat, 2 Feb 2019, Heiko Carstens wrote: > > So after the unlock @timestamp 337.215675 the kernel does not deal with > > that futex at all until the failed lock attempt where it rightfully rejects > > the attempt due to the alleged owner being gone. > > > > So this looks more like user space doing something stupid... > > > > As we talked about the missing barriers before, I just looked at > > pthread_mutex_trylock() and that does still: > > > > if (robust) > > { > > ENQUEUE_MUTEX_PI (mutex); > > THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL); > > } > > > > So it's missing the barriers which pthread_mutex_lock() has. Grasping for > > straws obviously.... Looks more like a solid tree than a straw now. :) > Excellent! Taking a look into the disassembly of nptl/pthread_mutex_trylock.o > reveals this part: > > 140: a5 1b 00 01 oill %r1,1 > 144: e5 48 a0 f0 00 00 mvghi 240(%r10),0 <--- THREAD_SETMEM (THREAD_SELF, robust_head.list_op_pending, NULL); > 14a: e3 10 a0 e0 00 24 stg %r1,224(%r10) <--- last THREAD_SETMEM of ENQUEUE_MUTEX_PI Awesome. > I added a barrier between those two and now the code looks like this: > > 140: a5 1b 00 01 oill %r1,1 > 144: e3 10 a0 e0 00 24 stg %r1,224(%r10) > 14a: e5 48 a0 f0 00 00 mvghi 240(%r10),0 > > Looks like this was a one instruction race... Fun. JFYI, I said that I reversed the stores in glibc and on my x86 test VM it took more than _3_ days to trigger. But the good news is, that the trace looks exactly like the ones you provided. So it looks we are on the right track. > I'll try to reproduce with the patch below (sprinkling compiler > barriers just like the other files have). Looks about right. Thanks, tglx