Re: [PATCH] hrtimer: Fix the incorrect initialization of timer->is_hard
From: Sebastian Andrzej Siewior
Date: Mon Mar 24 2025 - 04:49:54 EST
On 2025-03-22 16:24:03 [+0800], cuiguoqi wrote:
> Hi tglx,
>
> First of all, I'd like to thank you for your reply and for pointing out the email issue.
>
> As you've accurately noted, when PREEMPT_RT is disabled, it introduces a certain
> degree of ambiguity for kernel developers. So far, no malfunctions have been
> observed as a direct consequence of this.
>
> This issue came to light during kernel development when using the is_hard flag,
> where the expected logic was not achieved.Naturally, we opted for the more reliable
> is_soft flag to address the situation.
>
> Consequently, when PREEMPT_RT is disabled, there is a potential risk if developers
> choose to use the is_hard flag. I firmly believe this risk should not be overlooked.
You shouldn't try to set the is_hard flag without knowing its
implications. HRTIMER_MODE_HARD is what you should pay attention to.
Everything else is implementation specific.
> I concur with your analysis that one of these flags is redundant. In fact,
> it might be possible to consolidate them based on the overall requirements.
A timer that is missing HRTIMER_MODE_HARD is not a automatically a
HRTIMER_MODE_SOFT and also a timer missing HRTIMER_MODE_SOFT is not
automatically HRTIMER_MODE_HARD. These depends on RT vs non-RT mode.
Wouldn't your suggestion influence the warning in
hrtimer_start_range_ns()?
> Thanks.
>
>
> Cui Guoqi
Sebastian