Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp6169705imu; Wed, 30 Jan 2019 09:58:00 -0800 (PST) X-Google-Smtp-Source: ALg8bN5Fuo899X2lvlsfkfL2UAGzaQ/BLPhAQ+ExsQG9sIRPVp5J3/KfN4tPoiJnhv6EjBEerox3 X-Received: by 2002:a17:902:4523:: with SMTP id m32mr31165326pld.53.1548871080079; Wed, 30 Jan 2019 09:58:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548871080; cv=none; d=google.com; s=arc-20160816; b=AciEvxq0vJACz1gDPsc3xx7oqI4hXXqVnvipATUTdTh++id/bTitRIg8To5vb2sTjC sH0MvJxQd6fx0B7M272EOmdY31Kzwanwrdwf+krlXpFs/56ZWFbGLsdM7qi18KIvqa4q w8WRjVvSeuAYUwteAtns5X30xc1AiRxbQerlQI9qtetxyVGcYhstiXZhmWqfmgUsXY9g mvhacMQhvtbbHq4yxmJqrsGB3lH20Zkl04bLOjHdck6wENKYRgIEjHsqBcDzeJZ/KG5S N53UIvtNmSPq39W2UprZfaeznWHg1p7TCOMXq5llRGhcsUmIh1y/b0WrSK08BKTEg4Al mjpw== 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=6Y+VvHuiFm24RDUZpHKmCAV+fFZPpRr/k5qlUQmL5Zw=; b=fZCHb6hefXPrtlhyao9kSkWEzZ2HsghyjSTfaorEyBUFuqXWehLC/dSQRidHjJIvH+ uL0bCRpGu5hTwGqfvoZvVLcZrFctzey+oGYHFH6vtCFhuWkqhQFhCIZy5ev49p9ihHUH IYrVlCM99wqud+pABl0bEL/I0DWYhgv2JSFZC39R9IoLjTGxa6s8I/pa3sfCXQCoCHUo VCrYGr0Lo46SKOwtPZ7znKD1H2zvuRvuNlIFkj3Caj+buqQ9thW6Au5n8tKv5ccBqShX dgqbEBtWHzuclx1q3Mr+p+ATeRpmgHXbgbVVw9Zgms0B2G7+hwryIYAzELr8GX+YJ58k BqWA== 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 l94si2044663plb.416.2019.01.30.09.57.44; Wed, 30 Jan 2019 09:58:00 -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 S1731481AbfA3R5V (ORCPT + 99 others); Wed, 30 Jan 2019 12:57:21 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:48007 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726462AbfA3R5V (ORCPT ); Wed, 30 Jan 2019 12:57:21 -0500 Received: from [2a01:598:b890:92b7:20d0:59ff:fe6e:bab9] (helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gou6q-00074b-JD; Wed, 30 Jan 2019 18:57:12 +0100 Date: Wed, 30 Jan 2019 18:56:54 +0100 (CET) From: Thomas Gleixner To: Sebastian Sewior cc: Heiko Carstens , 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() triggered In-Reply-To: Message-ID: References: <20190129102409.GB26906@osiris> <20190129103557.GF28485@hirez.programming.kicks-ass.net> <20190129132303.GE26906@osiris> <20190129151058.GG26906@osiris> <20190129171653.ycl64psq2liy5o5c@linutronix.de> <20190130094913.GC5299@osiris> <20190130125955.GD5299@osiris> <20190130132420.spwrq2d4oxeydk5s@linutronix.de> 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 Wed, 30 Jan 2019, Thomas Gleixner wrote: > On Wed, 30 Jan 2019, Thomas Gleixner wrote: > The last entries with that uaddr are: > > <...>-56956 [005] .... 658.923608: sys_futex(uaddr: 3ff9e880140, op: 7, val: 3ff00000007, utime: 3ff9b078910, uaddr2: 3ff9b078910, val3: 3ffea67e3f7) > > UNLOCK > > <...>-56945 [006] .... 658.923612: sys_futex(uaddr: 3ff9e880140, op: 6, val: 1, utime: 1003ff0, uaddr2: 3ff9e87f910, val3: 3ff0000de71) > > LOCK > > <...>-56956 [005] .... 658.923612: sys_futex(uaddr: 3ff9e880140, op: 7, val: 3ff00000007, utime: 3ff9b078910, uaddr2: 3ff9b078910, val3: 3ffea67e3f7) > > UNLOCK > > <...>-56945 [006] .... 658.923830: sys_futex(uaddr: 3ff9e880140, op: 7, val: 3ff00000007, utime: 3ff9e87f910, uaddr2: 3ff9e87f910, val3: 3ffea67e3f7) > > UNLOCK > > <...>-56496 [001] .... 658.932404: sys_futex(uaddr: 3ff9e880140, op: 6, val: 1, utime: 0, uaddr2: 5, val3: 0) > > LOCK which fails. > > This does not make any sense. The last kernel visible operation of 56956 on > that uaddr is the UNLOCK above. > > I need to think some more about what might happen. TBH, no clue. Below are some more traceprintks which hopefully shed some light on that mystery. See kernel/futex.c line 30 ... Thanks, tglx 8<-------------- --- a/kernel/futex.c +++ b/kernel/futex.c @@ -1502,6 +1502,8 @@ static int wake_futex_pi(u32 __user *uad * died bit, because we are the owner. */ newval = FUTEX_WAITERS | task_pid_vnr(new_owner); + trace_printk("uaddr: %lx cur: %x new: %x\n", + (unsigned long) uaddr, uval, newval); if (unlikely(should_fail_futex(true))) ret = -EFAULT; @@ -2431,6 +2433,8 @@ static int fixup_pi_state_owner(u32 __us for (;;) { newval = (uval & FUTEX_OWNER_DIED) | newtid; + trace_printk("uaddr: %lx cur: %x new: %x\n", + (unsigned long) uaddr, uval, newval); if (cmpxchg_futex_value_locked(&curval, uaddr, uval, newval)) goto handle_fault; if (curval == uval) @@ -2438,6 +2442,8 @@ static int fixup_pi_state_owner(u32 __us uval = curval; } + trace_printk("uaddr: %lx cur: %x new: %x\n", + (unsigned long) uaddr, uval, newval); /* * We fixed up user space. Now we need to fix the pi_state * itself. @@ -3028,6 +3034,9 @@ static int futex_unlock_pi(u32 __user *u /* drops pi_state->pi_mutex.wait_lock */ ret = wake_futex_pi(uaddr, uval, pi_state); + trace_printk("uaddr: %lx wake: %d\n", + (unsigned long) uaddr, ret); + put_pi_state(pi_state); /* @@ -3056,6 +3065,8 @@ static int futex_unlock_pi(u32 __user *u goto out_putkey; } + trace_printk("uaddr: %lx cur: %x new: %x\n", + (unsigned long) uaddr, uval, 0); /* * We have no kernel internal state, i.e. no waiters in the * kernel. Waiters which are about to queue themselves are stuck