public inbox for linux-next@vger.kernel.org
 help / color / mirror / Atom feed
From: "Alexandre Courbot" <acourbot@nvidia.com>
To: "Andreas Hindborg" <a.hindborg@kernel.org>,
	"Stephen Rothwell" <sfr@canb.auug.org.au>
Cc: "Danilo Krummrich" <dakr@kernel.org>,
	"FUJITA Tomonori" <fujita.tomonori@gmail.com>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Linux Next Mailing List" <linux-next@vger.kernel.org>
Subject: Re: linux-next: manual merge of the rust-timekeeping tree with the drm-nova tree
Date: Tue, 24 Jun 2025 21:03:48 +0900	[thread overview]
Message-ID: <DAUQZ1TY9VT3.UJEFQ96157DJ@nvidia.com> (raw)
In-Reply-To: <87ecv94ay9.fsf@kernel.org>

On Tue Jun 24, 2025 at 8:48 PM JST, Andreas Hindborg wrote:
> "Stephen Rothwell" <sfr@canb.auug.org.au> writes:
>
>> Hi all,
>>
>> After merging the rust-timekeeping tree, today's linux-next build
>> (x86_64 allmodconfig) failed like this:
>>
>> error[E0599]: no method named `as_nanos` found for struct `Delta` in the current scope
>>   --> drivers/gpu/nova-core/util.rs:45:33
>>    |
>> 45 |         if start_time.elapsed().as_nanos() > timeout.as_nanos() as i64 {
>>    |                                 ^^^^^^^^ method not found in `Delta`
>>
>> error: aborting due to 1 previous error
>>
>> For more information about this error, try `rustc --explain E0599`.
>>
>> Caused by commits
>>
>>   2ed94606a0fe ("rust: time: Rename Delta's methods from as_* to into_*")
>>   768dfbfc98e2 ("rust: time: Make Instant generic over ClockSource")
>>
>> interacting with commit
>>
>>   a03c9bd953c2 ("gpu: nova-core: add helper function to wait on condition")
>>
>> from the drm-nova tree.
>>
>> I tried to fix it up, but this lead down a rabbit hole and my rust
>> skills are poor, so I just dropped the rust-timekeeping tree for today.
>> A merge resolution would be appreciated.
>
> I would suggest the following:
>
> diff --git a/drivers/gpu/nova-core/util.rs b/drivers/gpu/nova-core/util.rs
> index 5cafe0797cd6..24cbf3f4cc39 100644
> --- a/drivers/gpu/nova-core/util.rs
> +++ b/drivers/gpu/nova-core/util.rs
> @@ -3,7 +3,7 @@
>  use core::time::Duration;
>  
>  use kernel::prelude::*;
> -use kernel::time::Instant;
> +use kernel::time::{Instant, Monotonic};
>  
>  pub(crate) const fn to_lowercase_bytes<const N: usize>(s: &str) -> [u8; N] {
>      let src = s.as_bytes();
> @@ -35,14 +35,14 @@ pub(crate) const fn const_bytes_to_str(bytes: &[u8]) -> &str {
>  /// TODO[DLAY]: replace with `read_poll_timeout` once it is available.
>  /// (https://lore.kernel.org/lkml/20250220070611.214262-8-fujita.tomonori@gmail.com/)
>  pub(crate) fn wait_on<R, F: Fn() -> Option<R>>(timeout: Duration, cond: F) -> Result<R> {
> -    let start_time = Instant::now();
> +    let start_time = Instant::<Monotonic>::now();
>  
>      loop {
>          if let Some(ret) = cond() {
>              return Ok(ret);
>          }
>  
> -        if start_time.elapsed().as_nanos() > timeout.as_nanos() as i64 {
> +        if start_time.elapsed().into_nanos() > timeout.as_nanos() as i64 {
>              return Err(ETIMEDOUT);
>          }
>      }
>
> For the Nova people: You might consider if it makes sense to take a
> `kernel::time::Delta<C>` for the timeout.

It probably does now that it is available. I'm willing to do it this
cycle if we can find a way to not break the build. Should we have a tag
to merge into nova-next or something?

  reply	other threads:[~2025-06-24 12:03 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <iuo4BpdTglZkpW9Xyy1ehjFspmj3ay0q7iejyeOShBG0HLZmIrhzIpi0eG_wBv71ZPPCgh2lcn2BOsrFHOegfg==@protonmail.internalid>
2025-06-24  9:51 ` linux-next: manual merge of the rust-timekeeping tree with the drm-nova tree Stephen Rothwell
2025-06-24 11:48   ` Andreas Hindborg
2025-06-24 12:03     ` Alexandre Courbot [this message]
2025-06-24 12:16       ` Danilo Krummrich
2025-06-24 19:02         ` Andreas Hindborg
2025-06-25  6:13           ` Stephen Rothwell
2025-06-26  7:05             ` Stephen Rothwell
2025-08-01  7:18   ` Stephen Rothwell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DAUQZ1TY9VT3.UJEFQ96157DJ@nvidia.com \
    --to=acourbot@nvidia.com \
    --cc=a.hindborg@kernel.org \
    --cc=dakr@kernel.org \
    --cc=fujita.tomonori@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-next@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox