Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp961834lqp; Fri, 22 Mar 2024 00:51:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWDLCfcV4hYPIaq2JFmUEaLblvHHQRMLzv2QneYrb8DkiWebbJR8ZHN/L3j2E6eSOdD0WNPv5xlA7xizFmX7JNdGI1bLpo19TTgNZFcag== X-Google-Smtp-Source: AGHT+IHXRMb0z6Z8Us/0phWnVEar8PBPzMRwZMhOB9fDK6gypCxWjEVuT8a2FSqYv1KcwjtgxqFp X-Received: by 2002:a05:6122:a06:b0:4d4:be1:8196 with SMTP id 6-20020a0561220a0600b004d40be18196mr1722275vkn.11.1711093915616; Fri, 22 Mar 2024 00:51:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711093915; cv=pass; d=google.com; s=arc-20160816; b=pW5x8/HP+f9BubkSs5vD30rMJdKoyCqwB+OPnd3sgslxXRrvNOswGnLi+f8z3Y8mo3 SjDK//RQPfBPlTGE8eX3i2OrJGm0rxsEWqJXkWoYcKV6InhN9tAWp+oVKpTuSnrs9aAE CFweUWrw+eA3rxUHQ6UAFAg7a19ntOSa28vhZ2c1dfEWSX1FGlExT6bd/HVnjU2c+Sad 85KJY3/ITj1UHYsZQ+ppLGCR0Gve9Dr6WIImFS7lnWDuR1p0MkU7IWQ66jvsp0Nq/wi2 8FLZG051wDseFGOT4uN//I77uRtjBhWExjzdmMMU2waKvtdmkGs2OAX04ICqCU1YyXhq pwpg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=8UjpmRmSm7wnRaPwBJcqO6UsAFfeuNj9KOWlt7M4Keg=; fh=l7jbmyF1eCIj6y/Ge3qTnJagx1Z/snUundtAskC95Ls=; b=qtGLdUtoww9aK90G9pecOemcHlLSaJwnK8sRuly6KTP0/mYyBtZENXdz56sNQqZYTE RYu2AoN4fbLxjO6ycRVzLxM0bA0VlwgoaaYOcQcFXQjEmYWlI/RUuc9Rkq9IARvqGsJ8 zEZE6Is3a1llPh2FAQ/paSpsHCXIsfFwDi/FU8XgutTv8B4iy/sK+OnQwp/uZSeB9Qtj hGFkmrEioXK40A1hvzRbwqrakqXLQFlDpjVDiWpl8ZcpZT0uPvdTTQ8lISsaacl8S44N 5ZY2FhFBrqyyQ5Q0b57rKlwwiruirPeeNpR8CAjPDHajT1Rp2AAWhGAV8C8P+iS6QWv4 1oHA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=HcWmNbaV; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-111079-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111079-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id fv7-20020a056214240700b00696721718f5si52452qvb.209.2024.03.22.00.51.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 00:51:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111079-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=HcWmNbaV; arc=pass (i=1 spf=pass spfdomain=google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-111079-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111079-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 81EDB1C22360 for ; Fri, 22 Mar 2024 07:51:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ACE6114014; Fri, 22 Mar 2024 07:51:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="HcWmNbaV" Received: from mail-ua1-f52.google.com (mail-ua1-f52.google.com [209.85.222.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 80F8412E4E for ; Fri, 22 Mar 2024 07:51:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711093890; cv=none; b=kjq0mIPN/fqBbGG+2iuAd4NrRAzpJoRqM8bacVriK4N6n6eWSUTIlxFafA20xOZ8CxoxEvESq/DkVPwPstH/JQXmsnKmRfFh372p+PdzLJD4hP1DToSTBNrrpmGhGOhfjt49FkHpLmiCxdW1dkbQBXkBRZCngbS6EK+TbvolS94= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711093890; c=relaxed/simple; bh=3hw5Rawy4Kch8rLIOp9e/R80qsdn1Iud8TwBWgH4EuY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ODXwszxIjtO5ebkB4O/zXBynzrqBy6SZGcilC/sXM6FrjpremCnXP0w78sZ/xBt+JQepQsjIvUIulc8utRvd+RhJGAyUWXFM4I3TRz/iujPlUuz9cqdzk9ROuF0WPTOcOwt3oFvlcLYk86x5hTbWf0e2JG+AKVWZUanTzEC/R9o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=HcWmNbaV; arc=none smtp.client-ip=209.85.222.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Received: by mail-ua1-f52.google.com with SMTP id a1e0cc1a2514c-7e03e591693so680731241.1 for ; Fri, 22 Mar 2024 00:51:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1711093888; x=1711698688; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=8UjpmRmSm7wnRaPwBJcqO6UsAFfeuNj9KOWlt7M4Keg=; b=HcWmNbaVm7dUJjFYJoE4XsIC372jdwSwbIAC7eWvMYq2zFLHPsZ8oCW+QovWud5wQN 7wGo2EIATkEXMNmgq3mOWJA+RfTNq5sz55Cjpwa2u9SmhSrZ8n9KQmXawaugQYz6BweF Q6XZfgysyAtWTRwgmUn9B5Q+Dgy3P7XrQ1eul4gZnVJTpvBaYr4QhatKQWMllPGR7EFN fv7amZwR1sCQgC1NLsZpKZlCcfExJAwXSxLrryOMYBApm54VLGolBLJIgkSWE8IDQ+2G RulGi16XhekfVSUNoHQAzKCAMja40jgxF0I+4dH+3k7i+9bAfAZ28s9qTJ8e4DGtKNWi eOWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711093888; x=1711698688; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8UjpmRmSm7wnRaPwBJcqO6UsAFfeuNj9KOWlt7M4Keg=; b=K0LBB8HbV27a+ryInhrcycjmFhFXaHifNpbhcJxUqmXk34YjvdAVu7wPQiEw2YfuNu EsqjFdTooZpjxdY36Efb3wAlyXtFYw8Z9puc5kLXnbhaictOC7c1n5sLcyFTRWn16e/a erhjR8hustQQ9Gz83WetIv6EEvDvmtnk50zk9tKlkoIQVNcdNAeaxQOi6aHP6/mhXgUP TTmVxY8V59nJW6f6PwKp1Cf03Vfjo3zEKBYlcYre6XrExccB/JUg9op01QYyAltJ+Q+/ g2r3tUOjWEQfSFO4dIPJpDlygg83tB9XaEvSDe6Ev1T20wyxyX3uRiEb+CD/6fc0mKPA XX/g== X-Forwarded-Encrypted: i=1; AJvYcCUjZC/E0zYx4rixzV/d9Z9j8TGKJE+qNma2ve20Of4b+/Ko3JK3cUIsHwQghIe/T856fZp7Cuz9D0aH9kNsHG9DJ3juPMTeK800tWYO X-Gm-Message-State: AOJu0YzshOM0SwrMk6oQe5jQJoJTWINnYk7UCadtOfxE4eMoe0vO28Sw Ly4sc4dmFLvKyQK7/6PXAL3xff/Lf55LuIzPIKxqTUBn9fEZNvtyCT7+6eq/yvhEiQvdtscrhmw c4M/gOIyGYVFeO2Wh6ekv1wFZqJpQl5MgyCLf X-Received: by 2002:a67:f80f:0:b0:475:fe91:a9c4 with SMTP id l15-20020a67f80f000000b00475fe91a9c4mr1888206vso.6.1711093888402; Fri, 22 Mar 2024 00:51:28 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240320-rust-ktime_ms_delta-v1-1-ccb8672a0941@google.com> <87wmpxghxg.ffs@tglx> In-Reply-To: <87wmpxghxg.ffs@tglx> From: Alice Ryhl Date: Fri, 22 Mar 2024 08:51:17 +0100 Message-ID: Subject: Re: [PATCH] rust: time: add Ktime To: Thomas Gleixner Cc: Miguel Ojeda , John Stultz , Stephen Boyd , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Mar 20, 2024 at 2:18=E2=80=AFPM Thomas Gleixner wrote: > > On Wed, Mar 20 2024 at 10:08, Alice Ryhl wrote: > > +impl Ktime { > > + /// Create a `Ktime` from a raw `ktime_t`. > > + #[inline] > > + pub fn from_raw(inner: bindings::ktime_t) -> Self { > > + Self { inner } > > + } > > + > > + /// Get the current time using `CLOCK_MONOTONIC`. > > + #[inline] > > + pub fn ktime_get() -> Self { > > + // SAFETY: It is always safe to call `ktime_get`. > > That's not entirely correct. ktime_get() cannot be safely invoked from > NMI context. That won't matter for driver writers obviously. > > Looks sensible otherwise. Thanks for pointing that out. I will send a v2 with a reworded comment soon= . Alice