Re: [PATCH v4 05/17] irq & spin_lock: Add counted interrupt disabling/enabling
Shrikanth Hegde <[email protected]> Wed, 5 Aug 2026 12:39:36 +0530
| Newsgroups | org.kernel.vger.rust-for-linux,org.kernel.vger.linux-kernel |
|---|---|
| Message-ID | <[email protected]> |
On 8/5/26 12:37 PM, Boqun Feng wrote: > On Wed, Aug 05, 2026 at 08:36:45AM +0200, Peter Zijlstra wrote: >> On Tue, Aug 04, 2026 at 02:08:11PM -0700, Boqun Feng wrote: >> >>>>> + /* Interrupts can happen here, but it's OK, see __irq_exit_rcu(). */ >>>>> + >>>>> + if ((new_count & HARDIRQ_DISABLE_MASK) == HARDIRQ_DISABLE_OFFSET) >>>>> + _local_interrupt_disable(); >>>>> +} >>>> >>>> Maximum nesting possible is 256 right? Whats is stopping here to do more than that? >>> >>> Yes. Currently similar as softirq, we don't detect the overflow. >>> >>>> Should there be a warn_on? >>> >>> A simple warn_on could be problematic because warn_on() itself may take >>> an irq-disabling lock, and that may trigger another overflow on top of >>> the existing overflow. It's a bit tricky to do a proper detection. But >>> I'm open to ideas. >> >> DEBUG_PREEMPT's preempt_count_add() does: >> >> DEBUG_LOCKS_WARN_ON((preempt_count() & PREEMPT_MASK) >= PREEMPT_MASK - 10); >> > > Yeah, but this is behind a kconfig (DEBUG_PREEMPT), so not sure whether > it's what Shrikanth asked here. > I was suggesting to have a mechanism which allows to debug it/ find the callers. > Regards, > Boqun > >>