Re:A Kernel Bug Froze My Machine: Debugging an Async-Profile...
by jerrinot on Monday December 15, 2025 @04:24PM
(#46280890)
Author here. I've always been kernel-curious despite never having worked on one myself. Consider this either a collection of impractical party tricks or a hands-on way to get a feel for kernel internals.
[ Parent
| on HN ]
Re:A Kernel Bug Froze My Machine: Debugging an Async-Profile...
by ChuckMcM on Monday December 15, 2025 @04:50PM
(#46281224)
Question, isn't this a bug?
static enum hrtimer_restart perf_swevent_hrtimer(struct hrtimer *hrtimer)
{
- if (event->state != PERF_EVENT_STATE_ACTIVE)
+ if (event->state != PERF_EVENT_STATE_ACTIVE ||
+ event->hw.state & PERF_HES_STOPPED)
return HRTIMER_NORESTART;
The bug being that the precedence of || is higher than the precedence of != ? Consider writing it if ((event->state != PERF_EVENT_STATE_ACTIVE) || (event->hw_state & PERF_HES_STOPPED))
This coming from a person who has too many scars from not parenthesizing my expressions in conditionals to ensure they work the way I meant them to work.
Re:A Kernel Bug Froze My Machine: Debugging an Async-Profile...
by jerrinot on Monday December 15, 2025 @05:00PM
(#46281346)
Wow, someone is actually reading the article in detail, that's a good feeling!
In C, the != operator has higher precedence than the || operator. That said, extra parentheses never hurt readability.
Re:A Kernel Bug Froze My Machine: Debugging an Async-Profile...
by unsnap_biceps on Monday December 15, 2025 @05:32PM
(#46281751)
Which language(s?) have || before !=/==?