Re: [POC 1/6] irq & spin_lock: Add counted interrupt disabling/enabling
From: Thomas Gleixner
Date: Fri Oct 25 2024 - 11:09:32 EST
On Thu, Oct 24 2024 at 14:57, Boqun Feng wrote:
> On Thu, Oct 24, 2024 at 07:22:19PM +0200, Thomas Gleixner wrote:
>> On Thu, Oct 24 2024 at 12:05, Peter Zijlstra wrote:
>> > That is my only concern -- making insane code crash hard is good, making
>> > it silently mostly work but cause random weirdness is not.
>>
>> I wish we could come up with a lightweight check for that.
>>
> Since the preempt part takes exactly one byte in the preempt counter,
> maybe we could use a "incb + jo"?
>
> For example as below, note that since I used OF here, so it will try the
> byte as s8 therefore overflow at 128, so 127 is the max level of
> nesting.
>
> Would this be a relatively lightweight check?
That's definitely an interesting thought, though it adds a conditional
into preempt_disable(). We should try and see whether it's significant.
Thanks,
tglx