[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <D8O3BBP1RR5Q.2S2NBBCAEX1KI@nvidia.com>
Date: Mon, 24 Mar 2025 10:03:27 +0900
From: "Alexandre Courbot" <acourbot@...dia.com>
To: "Daniel Brooks" <db48x@...8x.net>
Cc: "Boqun Feng" <boqun.feng@...il.com>, "Danilo Krummrich"
<dakr@...nel.org>, "David Airlie" <airlied@...il.com>, "John Hubbard"
<jhubbard@...dia.com>, "Ben Skeggs" <bskeggs@...dia.com>, "Miguel Ojeda"
<ojeda@...nel.org>, "Alex Gaynor" <alex.gaynor@...il.com>, "Gary Guo"
<gary@...yguo.net>, Björn Roy Baron
<bjorn3_gh@...tonmail.com>, "Benno Lossin" <benno.lossin@...ton.me>,
"Andreas Hindborg" <a.hindborg@...nel.org>, "Alice Ryhl"
<aliceryhl@...gle.com>, "Trevor Gross" <tmgross@...ch.edu>, "Simona Vetter"
<simona@...ll.ch>, <linux-kernel@...r.kernel.org>,
<rust-for-linux@...r.kernel.org>, <nouveau@...ts.freedesktop.org>,
<dri-devel@...ts.freedesktop.org>
Subject: Re: [PATCH RFC v3 6/7] gpu: nova-core: add basic timer device
On Sat Mar 22, 2025 at 1:20 AM JST, Daniel Brooks wrote:
> "Alexandre Courbot" <acourbot@...dia.com> writes:
>
>> Hi Boqun,
>>
>> On Fri Mar 21, 2025 at 3:17 AM JST, Boqun Feng wrote:
>>> Also an Instant type has been proposed and reviewed for a while:
>>>
>>> https://lore.kernel.org/rust-for-linux/20250220070611.214262-5-fujita.tomonori@gmail.com/
>>>
>>> we should use that type instead of re-inventing the wheel here. Of
>>> course, it's currently not quite working because Instant is only for
>>> CLOCK_MONOTONIC. But there was a proposal to make `Instant` generic over
>>> clock:
>>>
>>> https://lore.kernel.org/rust-for-linux/20230714-rust-time-v2-1-f5aed84218c4@asahilina.net/
>>>
>>> if you follow that design, you can implement a `Instant<NovaGpu>`, where
>>>
>>> ipml Now for NovaGpu {
>>> fn now() -> Instant<Self> {
>>> // your Timer::read() implementation.
>>> }
>>> }
>>
>> Ah, thanks for pointing this out. I'll keep track of these patches,
>> hopefully they get merged soon!
>
> Would that actually work though? Instant is a ktime_t, which is a signed
> i64 rather than a u64. When I read your patch I assumed that you had to
> add your own Timestamp because the value had to be whatever was read
> from the GPU, independent of the clock value kept by the system or other
> hardware.
That's correct, and honestly there would be little benefit in using an
already existing type outside of not re-writing very similar code as GPU
time stamps are only used locally anyway. I'll keep an eye on these
patches though in case we can harmonize things a bit.
Powered by blists - more mailing lists