Re: [PATCH v11 6/8] MAINTAINERS: rust: Add new sections for DELAY/SLEEP and TIMEKEEPING API

From: FUJITA Tomonori
Date: Thu Apr 03 2025 - 08:58:10 EST


On Thu, 03 Apr 2025 12:54:40 +0200
Andreas Hindborg <a.hindborg@xxxxxxxxxx> wrote:

>>>> You will need to fix something because patch 2-6 removes `Ktime` ;-)
>>>
>>> Yea, but `Instant` is almost a direct substitution, right? Anyway, Tomo
>>> can send a new spin and change all the uses of Ktime, or I can do it. It
>>> should be straight forward. Either way is fine with me.
>>
>> `Delta`? Not `Instant`.
>
> It depends. Current hrtimer takes `Ktime` and supports
> `HrTimerMode::Absolute` and `HrTimerMode::Relative`. With `Delta` and
> `Instant` we should take `Instant` for `HrTimerMode::Absolute` and
> `Delta` for `HrTimerMode::Relative`. The API needs to be modified a bit
> to make that work though. Probably we need to make the start function
> generic over the expiration type or something.
>
> If you want to, you can fix that. If not, you can use `Instant` for the
> relative case as well, and we shall interpret it as duration. Then I
> will fix it up later. Your decision.
>
>> All Ktime in hrtimer are passed to hrtimer_start_range_ns(), right?
>
> Yes, that is where they end up.

Ah, I found that __hrtimer_start_range_ns() handles ktime_t
differently in HRTIMER_MODE_REL mode.

As you said, looks like the API needs to be updated and I think that
it's best to leave that to you. I'll just use `Instant` for all cases.