Re: [PATCH 00/44] hrtimers: Switch to new hrtimer interface functions (4/5)

From: Alexander Shishkin
Date: Mon Oct 28 2024 - 04:58:51 EST


Nam Cao <namcao@xxxxxxxxxxxxx> writes:

> This is the forth part of a 5-part series (split for convenience). All 5
> parts are:
>
> Part 1: https://lore.kernel.org/lkml/cover.1729864615.git.namcao@xxxxxxxxxxxxx
> Part 2: https://lore.kernel.org/lkml/cover.1729864823.git.namcao@xxxxxxxxxxxxx
> Part 3: https://lore.kernel.org/lkml/cover.1729865232.git.namcao@xxxxxxxxxxxxx
> Part 4: https://lore.kernel.org/lkml/cover.1729865485.git.namcao@xxxxxxxxxxxxx
> Part 5: https://lore.kernel.org/lkml/cover.1729865740.git.namcao@xxxxxxxxxxxxx

Which one do I need to click on to see the actual hrtimer_setup*()
implementations? Why is it even a separate series? Please, don't make
people click on things.

> To use hrtimer, hrtimer_init() (or one of its variant) must be called, and
> also the timer's callfack function must be setup separately.

"callback", right?

> That can cause misuse of hrtimer. For example, because:
> - The callback function is not setup
> - The callback function is setup while it is not safe to do so

These are not examples, these are hypotheticals. Do either of these
things actually happen in the codebase?

> To prevent misuse of hrtimer, this series:
> - Introduce new functions hrtimer_setup*(). These new functions are
> similar to hrtimer_init*(), except that they also sanity-check and
> initialize the callback function.

No, it doesn't. This series only converts some drivers. I'd like to see
the sanity-checking in question, since it's the big selling point.
But IMO, "switching to a cleaner hrtimer API" or some words to that
effect is a better justification than sanity checking.

I'm not objecting to the idea, it's just carried out weirdly.

> - Introduce hrtimer_update_function() which checks that it is safe to
> change the callback function. The 'function' field of hrtimer is then
> made private.

Also not in this series.

> - Convert all users to use the new functions.
> - Some minor cleanups on the way.

Thanks,
--
Alex