From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751464AbdJVJUi (ORCPT ); Sun, 22 Oct 2017 05:20:38 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:56160 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751287AbdJVJUh (ORCPT ); Sun, 22 Oct 2017 05:20:37 -0400 Date: Sun, 22 Oct 2017 11:20:25 +0200 From: Peter Zijlstra To: Frederic Weisbecker Cc: LKML , Tejun Heo , "David S . Miller" , Lai Jiangshan , Thomas Gleixner , "Paul E . McKenney" , Ingo Molnar Subject: Re: [PATCH 07/14] x86: Use lockdep to assert IRQs are disabled/enabled Message-ID: <20171022092025.GJ6524@worktop.programming.kicks-ass.net> References: <1508460971-8731-1-git-send-email-frederic@kernel.org> <1508460971-8731-8-git-send-email-frederic@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1508460971-8731-8-git-send-email-frederic@kernel.org> User-Agent: Mutt/1.5.22.1 (2013-10-16) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 20, 2017 at 02:56:04AM +0200, Frederic Weisbecker wrote: > diff --git a/arch/x86/entry/common.c b/arch/x86/entry/common.c > index 03505ff..b4f3a55 100644 > --- a/arch/x86/entry/common.c > +++ b/arch/x86/entry/common.c > @@ -186,7 +186,7 @@ __visible inline void prepare_exit_to_usermode(struct pt_regs *regs) > > addr_limit_user_check(); > > - if (IS_ENABLED(CONFIG_PROVE_LOCKING) && WARN_ON(!irqs_disabled())) > + if (!lockdep_assert_irqs_disabled()) > local_irq_disable(); > > lockdep_sys_exit(); So this is the only site that ever uses the return value; and for this you've chosen the wrong value for !CONFIG_PROVE_LOCKING (namely 1), resulting in an unconditional CLI here for !lockdep kernels. How about we replace that whole thing with a simple: lockdep_assert_irqs_disabled(); And leave it at that, allowing us to remove the return value thing entirely. The whole if !disabled, disable logic is uber paranoid programming, but I don't think we've ever seen that WARN trigger, and if it does (and then burns the kernel) we at least know wtf happend.