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=-8.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham 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 65738C4361B for ; Thu, 10 Dec 2020 11:05:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0746D23B85 for ; Thu, 10 Dec 2020 11:05:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727520AbgLJLEz (ORCPT ); Thu, 10 Dec 2020 06:04:55 -0500 Received: from foss.arm.com ([217.140.110.172]:35348 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727318AbgLJLEO (ORCPT ); Thu, 10 Dec 2020 06:04:14 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id C3F6830E; Thu, 10 Dec 2020 03:03:28 -0800 (PST) Received: from C02TD0UTHF1T.local (unknown [10.57.27.13]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 2AF8F3F718; Thu, 10 Dec 2020 03:03:26 -0800 (PST) Date: Thu, 10 Dec 2020 11:03:19 +0000 From: Mark Rutland To: Andy Lutomirski Cc: LKML , Ingo Molnar , Juergen Gross , Peter Zijlstra , Thomas Gleixner Subject: Re: [PATCH] lockdep: report broken irq restoration Message-ID: <20201210110319.GA88655@C02TD0UTHF1T.local> References: <20201209183337.1912-1-mark.rutland@arm.com> 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, Dec 09, 2020 at 11:05:21AM -0800, Andy Lutomirski wrote: > On Wed, Dec 9, 2020 at 10:33 AM Mark Rutland wrote: > > diff --git a/include/linux/irqflags.h b/include/linux/irqflags.h > > index 3ed4e8771b64..bca3c6fa8270 100644 > > --- a/include/linux/irqflags.h > > +++ b/include/linux/irqflags.h > > @@ -220,10 +220,26 @@ do { \ > > > > #else /* !CONFIG_TRACE_IRQFLAGS */ > > > > +#ifdef CONFIG_DEBUG_IRQFLAGS > > +extern void warn_bogus_irq_restore(bool *warned); > > +#define check_bogus_irq_restore() \ > > + do { \ > > + static bool __section(".data.once") __warned; \ > > + if (unlikely(!raw_irqs_disabled())) \ > > + warn_bogus_irq_restore(&__warned); \ > > + } while (0) > > What's the benefit of having a per-caller __warned instead of just > having a single global one in warn_bogus_irq_restore()? I'd copied that from the previous proposal, and had assumed that if we had several distinct violations we'd want to report all of them in one boot session. I'm perfectly happy to get rid of that and make warn_bogus_irq_restore() use WARN_ONCE() directly. I'm using this with a local Syzkaller instance, and as that will kill the kernel on the first WARN() anyway, it makes no difference to me. I guess in the field having a single warning is likely to be good enough too. Thanks, Mark.