Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47DD2C61DA4 for ; Mon, 13 Mar 2023 23:11:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229802AbjCMXLz (ORCPT ); Mon, 13 Mar 2023 19:11:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229619AbjCMXLy (ORCPT ); Mon, 13 Mar 2023 19:11:54 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7679128E51 for ; Mon, 13 Mar 2023 16:11:53 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0E9B461547 for ; Mon, 13 Mar 2023 23:11:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1F951C433EF; Mon, 13 Mar 2023 23:11:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678749112; bh=9NHRvmhtPUz+5vpXWJk461ltzBS6zXAulxvWTFWZMes=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uzV8zQ1UiE7II665/IZ0NrvonIRqktGBH3aQdT2wkG4ShppnKQS7wUui3zYuw5RMy VimMA+rFcdWSLCtX2g8hgsdC6v+GfeX3roDADxjhzBdr1LiTep1KP1Xo1EE6m7uDEA 1paTlQmGKYRW90MgdR1ZkoZRyiw2tKZPH7GAFOTCMlKll5ainF60ts7+euXnYrLeoY TuurtHTGU2vZK3ot26yREO3xR10NIpHfQxyOIu1Jfkb0ZIXDxtPpydOYhxe831aWEq FBpHpmVjvCIjJDt5bDcPR43DcU+oBUBJWEA6QZVoaqQj9Y/j7O5eNRinO8utzkF+Q/ dqHLS1t7J3QrQ== Date: Tue, 14 Mar 2023 00:11:49 +0100 From: Frederic Weisbecker To: Linus Torvalds Cc: Guenter Roeck , "Paul E. McKenney" , Peter Zijlstra , Linux Kernel Mailing List Subject: Re: Linux 6.3-rc2 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 13, 2023 at 11:21:44AM -0700, Linus Torvalds wrote: > On Mon, Mar 13, 2023 at 8:53 AM Guenter Roeck wrote: > > > > Warning backtraces in calls from ct_nmi_enter(), > > seen randomly. > > Hmm. > > I suspect this one is a bug in the warning, not in the kernel, > although I have no idea why it would have started happening now. > > This happens from an irq event, but that check is not *supposed* to > happen at all from interrupts: > > * We dont accurately track softirq state in e.g. > * hardirq contexts (such as on 4KSTACKS), so only > * check if not in hardirq contexts: > > but I think that the ct_nmi_enter() function was called before the > hardirq count had even been incremented. Indeed, ct_nmi_enter() is called very early on irq_enter(), before HARDIRQ_OFFSET is added and the warning triggers at: if (!hardirq_count()) { if (softirq_count()) { /* like the above, but with softirqs */ DEBUG_LOCKS_WARN_ON(current->softirqs_enabled); <---- HERE } So the hardirq interrupted some code that has softirqs disabled (or servicing) from the preempt mask POV but not from lockdep POV. It says softirqs were last enabled/disabled at some random point, but the function looks ok: [ 28.765386] softirqs last enabled at (6328): [] vfp_sync_hwstate+0x48/0x8c [ 28.765575] softirqs last disabled at (6326): [] vfp_sync_hwstate+0x0/0x8c It would be interesting to see what the IRQ is interrupting. For example does it happen while softirqs are serviced or just disabled? Or are we even outside any of that? Any chance we can have a deeper stack trace? If not at least a print of preempt_count() would be helpful. Both would be awesome. diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c index 50d4863974e7..a7d1a65e5425 100644 --- a/kernel/locking/lockdep.c +++ b/kernel/locking/lockdep.c @@ -5523,6 +5523,7 @@ static noinstr void check_flags(unsigned long flags) */ if (!hardirq_count()) { if (softirq_count()) { + printk("preempt_count(): %x", preempt_count()); /* like the above, but with softirqs */ DEBUG_LOCKS_WARN_ON(current->softirqs_enabled); } else { Thanks.