Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp555239pxf; Wed, 17 Mar 2021 10:22:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwu9YO/WK3Y9JfcyHsXoOzNmasdJpwpjbNg0wRtBCK2lEwU/i0Idb0Gi/hdC7BTiaRrBESZ X-Received: by 2002:aa7:c5c4:: with SMTP id h4mr41806098eds.375.1616001765504; Wed, 17 Mar 2021 10:22:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616001765; cv=none; d=google.com; s=arc-20160816; b=Mk1VT2Uxb6e/tL4U0S9ueTtbdbDDl/g8Q7qtM7Q1mJxx17MtJECl8nWhOFk75cl/+P UIcn63XXr22sNf/5tiolmMbSW4QlJDqrBg16vXHQ2gHgpuCcDn9WskJQ4ojii5hNTRWZ hZjvKyamqDayYVgkLXFaOhns/NfVgTPGyJ5mDREbHUoDsYFizc2pTF78xke8q0GTyusK 91w13aNZ96yWp+W2PrP/VCBgqS0vbywQrA3/PWAKPfObUbdKRWIq32+P4J2BzIECaAOa PYourr/pGQvpPk42vavWZVZMJXueui5x9LH9M1WjVM2/c95p3R8zmOqEeevx9HKO/pUe E//A== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=aKYAUWxzHH2YQlBHn5zoUP40iw+Vp4x7ql39u69isK4=; b=0sTGzxEu/OTlGTE/vcMBbDpPm+wFKAD/hp0tfPiYoPSpJbbUw1P6gxRqrNrK/vrNwv cl0tGbGgQNgNbfCMCARkKu11uNdop/dmhqMuZiOWep+4aKXBpbdO2b0JH3eaein/WxLV 67ivoVNliWP60IJn7YJPwLjs8KwUf4QmDc5IbWWLWCAn/B9pymBYGAOyjEPPwQLw83Y7 Ejocbl/RyiQJsilpEQrY/C6y8bbBLfyT1mIZTbVagdL4SarKIDFVuXxK92e5buBdz6aF kHncfB1CgVSn3SHSPCmurslhKrYTc8Fu93edPutm5rrlOFwi/XEDq0TzwvMdnF2KS83p JD2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=B6k1onKL; 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 a8si17182703ejt.44.2021.03.17.10.22.22; Wed, 17 Mar 2021 10:22:45 -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=B6k1onKL; 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 S232509AbhCQQtP (ORCPT + 99 others); Wed, 17 Mar 2021 12:49:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232000AbhCQQsx (ORCPT ); Wed, 17 Mar 2021 12:48:53 -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 550E5C06174A; Wed, 17 Mar 2021 09:48:53 -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-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=aKYAUWxzHH2YQlBHn5zoUP40iw+Vp4x7ql39u69isK4=; b=B6k1onKLJXuCfb5eXGDkizM8ag 08pdPqLLDuiwRP/dAtHLEQtLNlDRX1P/PvIpFJbzCCxEqLdblSjjMREgwR4VjccC6ZgyB6iBUON2F delEtbvN9dN0coN5QU44UIEKTPZPxq5VYp2s1/OcnKlNuA0pX3l5dwf+XwGN9CnR5hiF13jSgsmtm qJpOlC1Gn198Wo5P6RKmP9uByYV3dgn7oG04j8KamWR9n2yp3Loc+wDzRhF7YgnpSj3YavkMes2Df +IPJXhFBh9cC6fCOyguETgF3stcUYe64k5OOnRpN2gJPP7ZnMsurzLTVXI6fJPB0vSqcIDQc6J0Ao eeQQctRg==; 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 1lMZLl-003aJU-AA; Wed, 17 Mar 2021 16:48:49 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id CB68F301324; Wed, 17 Mar 2021 17:48:48 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id B0388203D90C4; Wed, 17 Mar 2021 17:48:48 +0100 (CET) Date: Wed, 17 Mar 2021 17:48:48 +0100 From: Peter Zijlstra To: Waiman Long Cc: linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org, Ingo Molnar , x86@kernel.org Subject: Re: [tip: locking/urgent] locking/ww_mutex: Treat ww_mutex_lock() like a trylock Message-ID: References: <20210316153119.13802-4-longman@redhat.com> <161598470197.398.8903908266426306140.tip-bot2@tip-bot2> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 17, 2021 at 11:35:12AM -0400, Waiman Long wrote: > From reading the source code, nest_lock check is done in check_deadlock() so > that it won't complain. However, nest_lock isn't considered in > check_noncircular() which causes the splat to come out. Maybe we should add > a check for nest_lock there. I will fiddle with the code to see if it can > address the issue. Nah, that's not how it's supposed to work. I think the problem is that DEFINE_WW_MUTEX is buggered, there's not actually any other user of it in-tree. Everybody else (including locking-selftests) seem to be using ww_mutex_init(). So all locks in a ww_class should be having the same lock class, and then nest_lock will fold them all into a single entry with ->references incremented. See __lock_acquire(). But from the report: > [ 103.892671] -> #2 (torture_ww_mutex_0.base){+.+.}-{3:3}: > [ 103.892706] -> #1 (torture_ww_mutex_1.base){+.+.}-{3:3}: > [ 103.892730] -> #0 (torture_ww_mutex_2.base){+.+.}-{3:3}: that went sideways, they're *not* the same class. I think you'll find that if you use ww_mutex_init() it'll all work. Let me go and zap this patch, and then I'll try and figure out why DEFINE_WW_MUTEX() is buggered.