On Fri, 8 Sept 2023 at 00:03, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote: > > Which on a PREEMPT_COUNT=n build will cause preemption while holding the > spinlock. I think something like the below will cause sufficient > warnings to avoid growing patterns like that. Hmm. I don't think that warning is valid. Disabling preemption is actually fine if it's done in an interrupt, iow if we have allow_resched(); -> irq happens spin_lock(); // Ok and should *not* complain ... spin_unlock(); <- irq return (and preemption) which actually makes me worry about the nested irq case, because this would *not* be ok: allow_resched(); -> irq happens -> *nested* irq happens <- nested irq return (and preemption) ie the allow_resched() needs to still honor the irq count, and a nested irq return obviously must not cause any preemption. I've lost sight of the original patch series, and I assume / hope that the above isn't actually an issue, but exactly because I've lost sight of the original patches and only have this one in my mailbox I wanted to check. Linus