Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3727479ybt; Tue, 23 Jun 2020 09:16:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxn2YE95pX36lAs8P26LXrFcGpQmg37lOnTrnXTj8iCl0f4w4dGGX0giN/g2VbezizNr91R X-Received: by 2002:a17:906:1357:: with SMTP id x23mr8809274ejb.148.1592928960655; Tue, 23 Jun 2020 09:16:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592928960; cv=none; d=google.com; s=arc-20160816; b=Ah8RExJf70c+yfR9ljdhO/jJoF89w76eiDWU5nz5ro0ipZR2vJQFSpAdd8qwuHLDAH MUixEkoF7uefa4Q/BkNP/xDPz08ebyNzdwj1/u0/m0tmwR+ZiZ8FdFu5B7QJPoaA317Y wydVVfzGypm6boQjMEvSvGNKFhIe4j3qJZ06+f94I04/xQySVsZyg+HH0yadKDTmnmwY JoeCvLOTCPIwi3sKpxS9ZapiHcsQ3lTFNlOSBdZ9zIRUB/tcv64jmp+QixphUQr7YKna ocIl1f3F4T3fDNh1HdA/GGiZlNsaNS4Q7/oWsYBfCT9xTmorcWN1jarZxhcDc91ikaE2 tigQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=rATZoPzIpOt5fb3cykXfKXs9OVR4wIwOAbPrKElmoVc=; b=P2gzsykQDIjO508gF7K35Gwhtd3CJiWt5G7yg0Am+T0eWL0n8wb/g9kSCypbd89SMd jXZu+S6H12FhgeIKLJmkLXPDWjj2fuqTNPQ1PB2yzyyBfNjJ8hmtYBZOa4FgzyVZutcL msqKnTRBYK34WrkxKDCuH0wH0PGBdMPUFX58bmYt6aQE54w531xsX5UBIeTtCDDRWNTg IohwK1S2YPecbqP6stUy9Q45YWUiPeOsRSRef/VwgMmCyG2ie3eH5eITnMQz9tY8Wufl Lz3qYZHF0MWsHq6Ro7vsuYWyZY7TYZu786g79AGgmBRzu3Sroyx9Q+S6jg3f1EntDm5L SP7Q== ARC-Authentication-Results: i=1; mx.google.com; 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 j28si7278810edj.142.2020.06.23.09.15.37; Tue, 23 Jun 2020 09:16:00 -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; 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 S1732482AbgFWQNm (ORCPT + 99 others); Tue, 23 Jun 2020 12:13:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728916AbgFWQNm (ORCPT ); Tue, 23 Jun 2020 12:13:42 -0400 Received: from Galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF8AEC061573; Tue, 23 Jun 2020 09:13:41 -0700 (PDT) Received: from [5.158.153.53] (helo=debian-buster-darwi.lab.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1jnlY2-0005Ko-Kg; Tue, 23 Jun 2020 18:13:22 +0200 Date: Tue, 23 Jun 2020 18:13:21 +0200 From: "Ahmed S. Darwish" To: Peter Zijlstra Cc: mingo@kernel.org, will@kernel.org, tglx@linutronix.de, x86@kernel.org, linux-kernel@vger.kernel.org, rostedt@goodmis.org, bigeasy@linutronix.de, davem@davemloft.net, sparclinux@vger.kernel.org, mpe@ellerman.id.au, linuxppc-dev@lists.ozlabs.org, heiko.carstens@de.ibm.com, linux-s390@vger.kernel.org, linux@armlinux.org.uk Subject: Re: [PATCH v4 7/8] lockdep: Change hardirq{s_enabled,_context} to per-cpu variables Message-ID: <20200623161320.GA2996373@debian-buster-darwi.lab.linutronix.de> References: <20200623083645.277342609@infradead.org> <20200623083721.512673481@infradead.org> <20200623150031.GA2986783@debian-buster-darwi.lab.linutronix.de> <20200623152450.GM4817@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200623152450.GM4817@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.10.1 (2018-07-13) 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 Tue, Jun 23, 2020 at 05:24:50PM +0200, Peter Zijlstra wrote: > On Tue, Jun 23, 2020 at 05:00:31PM +0200, Ahmed S. Darwish wrote: > > On Tue, Jun 23, 2020 at 10:36:52AM +0200, Peter Zijlstra wrote: > > ... > > > -#define lockdep_assert_irqs_disabled() do { \ > > > - WARN_ONCE(debug_locks && !current->lockdep_recursion && \ > > > - current->hardirqs_enabled, \ > > > - "IRQs not disabled as expected\n"); \ > > > - } while (0) > > > +#define lockdep_assert_irqs_enabled() \ > > > +do { \ > > > + WARN_ON_ONCE(debug_locks && !this_cpu_read(hardirqs_enabled)); \ > > > +} while (0) > > > > > > > Can we add a small comment on top of lockdep_off(), stating that lockdep > > IRQ tracking will still be kept after a lockdep_off call? > > That would only legitimize lockdep_off(). The only comment I want to put > on that is: "if you use this, you're doing it wrong'. > Well, freshly merged code is using it. For example, KCSAN: => f1bc96210c6a ("kcsan: Make KCSAN compatible with lockdep") => kernel/kcsan/report.c: void kcsan_report(...) { ... /* * With TRACE_IRQFLAGS, lockdep's IRQ trace state becomes corrupted if * we do not turn off lockdep here; this could happen due to recursion * into lockdep via KCSAN if we detect a race in utilities used by * lockdep. */ lockdep_off(); ... } thanks, -- Ahmed S. Darwish Linutronix GmbH