From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 102A4C35646 for ; Fri, 21 Feb 2020 15:09:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DFD8724650 for ; Fri, 21 Feb 2020 15:09:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729020AbgBUPI7 (ORCPT ); Fri, 21 Feb 2020 10:08:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:40042 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728690AbgBUPI7 (ORCPT ); Fri, 21 Feb 2020 10:08:59 -0500 Received: from gandalf.local.home (cpe-66-24-58-225.stny.res.rr.com [66.24.58.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1CD43208E4; Fri, 21 Feb 2020 15:08:57 +0000 (UTC) Date: Fri, 21 Feb 2020 10:08:55 -0500 From: Steven Rostedt To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, mingo@kernel.org, joel@joelfernandes.org, gregkh@linuxfoundation.org, gustavo@embeddedor.com, tglx@linutronix.de, paulmck@kernel.org, josh@joshtriplett.org, mathieu.desnoyers@efficios.com, jiangshanlai@gmail.com, luto@kernel.org, tony.luck@intel.com, frederic@kernel.org, dan.carpenter@oracle.com, mhiramat@kernel.org Subject: Re: [PATCH v4 01/27] lockdep: Teach lockdep about "USED" <- "IN-NMI" inversions Message-ID: <20200221100855.2f9bec3a@gandalf.local.home> In-Reply-To: <20200221134215.090538203@infradead.org> References: <20200221133416.777099322@infradead.org> <20200221134215.090538203@infradead.org> X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 21 Feb 2020 14:34:17 +0100 Peter Zijlstra wrote: > --- a/kernel/locking/lockdep.c > +++ b/kernel/locking/lockdep.c > @@ -379,13 +379,13 @@ void lockdep_init_task(struct task_struc > > void lockdep_off(void) > { > - current->lockdep_recursion++; > + current->lockdep_recursion += BIT(16); > } > EXPORT_SYMBOL(lockdep_off); > > void lockdep_on(void) > { > - current->lockdep_recursion--; > + current->lockdep_recursion -= BIT(16); > } > EXPORT_SYMBOL(lockdep_on); > > + > +static bool lockdep_nmi(void) > +{ > + if (current->lockdep_recursion & 0xFFFF) Nitpick, but the association with bit 16 and this mask really should be defined as a macro somewhere and not have hard coded numbers. -- Steve > + return false; > + > + if (!in_nmi()) > + return false; > + > + return true; > +} > +