Re: [RFC][PATCH] hrtimer: Use printk_deferred_once for hrtimer_interrupt message

John Ogness
2024-02-22T20:33:36Z

On 2024-02-22, John Stultz <jstultz@google.com> wrote:
> On Thu, Feb 22, 2024 at 7:17 AM Thomas Gleixner <tglx@linutronix.de> wrote:
>> On Wed, Feb 21 2024 at 21:12, John Stultz wrote:
>> > With qemu, I constantly see lockdep warnings after the
>> > hrimter_interrupt message is printed:
>> >
>> > [ 43.434557] hrtimer: interrupt took 6517564 ns
>> > [ 43.435000]
>> > [ 43.435000] =============================
>> > [ 43.435000] [ BUG: Invalid wait context ]
>>
>> Do you have PROVE_RAW_LOCK_NESTING enabled?
>
> Yes, I do. Let me know if there's anything else you'd like me to try.

This option is to "ensure that the lock nesting rules for PREEMPT_RT
enabled kernels are not violated."

Since you are not running a PREEMPT_RT enabled kernel, these warnings
are irrelevant for _your_ kernel.

>> > I thought the new printk work was going to resolve this, but
>> > apparently not

Yes, it will, but it is not all mainline yet. The full printk rework is
only available as part of the PREEMPT_RT patch series [0]. With that
series applied, it makes more sense to enable PROVE_RAW_LOCK_NESTING
because the series should resolve all known lock nesting problems with
PREEMPT_RT. (And indeed, the warning you are reporting does not occur
there.)

If you really want to test lock nesting for PREEMPT_RT, I recommend
applying the PREEMPT_RT series and keeping PROVE_RAW_LOCK_NESTING
enabled. Otherwise, if you do not want to apply the PREEMPT_RT series, I
recommend disabling PROVE_RAW_LOCK_NESTING.

Note that you can apply the PREEMPT_RT series and still choose the
!PREEMPT_RT preemption model for your kernel.

John Ogness

[0] https://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git/log/?h=linux-6.8.y-rt-rebase