Received: by 2002:a05:7412:8598:b0:f9:33c2:5753 with SMTP id n24csp107992rdh; Mon, 18 Dec 2023 13:08:29 -0800 (PST) X-Google-Smtp-Source: AGHT+IHM3qJqQ+pyRAX5DSt/Qihc2yzuTpCJlLROtJkNQLEjNWhsPd+KPLfKLlleks65fpgdpRMT X-Received: by 2002:a05:620a:ecf:b0:77f:993:baa7 with SMTP id x15-20020a05620a0ecf00b0077f0993baa7mr11843279qkm.93.1702933709335; Mon, 18 Dec 2023 13:08:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702933709; cv=none; d=google.com; s=arc-20160816; b=eOXVuEG6XPrvuMTIGMTjcpcEWGi7pH+f5RM9Wc99xN6pMj2Wk2Uarh2xfYzbK+wmXr wfaWDJL3gfdEmJhQYXYcC6Up3a2n8qpJgL3o87w9NKJZpd/P2F+1W+boWXnwHnreVpo/ S7J5PQ1hS0NhEeYSa/QRP0dpexR6IgagSF8xSaJA6gzw404ZSt7dV149HOY8fK9US9wh q9mePLjNPoxsTl3ItZc3YQrlur9Iui5IELp919LYnvGrkdFXLNnzESH3j8Py9iIskvqh an7Gmd4aM0PPuPsfJX7yZxVJ+yB8ulJhutC+MAsyZeKzHwvSNf1rU/9nOunlphJyPH8H puVA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:feedback-id:dkim-signature; bh=k5h6hrI62ojLOpzwPeAY3F1dA9KLCwXHTZO6prPyeJE=; fh=d1mr+x7lUW+LsFabym15sf5XRq8f2wpmTm6zHJ0iGkQ=; b=Mg5NvN2jhveRWnxUds4kEGZcjYewDjESjqxZajw5niEOz3LtSVZ2hwo4rhnz49GAjN G2G6iZt92WZpM9xa19iBEbpTfwAJ29iFsIqly7CIElsn1pRmBRGLZZ8cflsumkuc0dwq FhyhNBNWR/H62x3BsC265DCOPXC6DtSEPyNCYtmluki8rHShPqzUud6FUbZPONvjgbBL KzK8Jdb2aaT+FjOE4BcGzWQY0J5y6LCZJrGGV1gazAI4/fNe0da4BXfaVR+QDJ7WPX+p kNajCfxGjfJ+KML9QDR4rs6BS1kvOjhlapLBMczdh907aK9ofzVC8i9MlxiXJT2JY6Jl KSqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Aa4YFjyc; spf=pass (google.com: domain of linux-kernel+bounces-4394-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4394-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id x15-20020ae9e90f000000b0077f0315a454si23786849qkf.386.2023.12.18.13.08.29 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 13:08:29 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4394-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Aa4YFjyc; spf=pass (google.com: domain of linux-kernel+bounces-4394-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4394-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 0A1B41C2277E for ; Mon, 18 Dec 2023 21:08:29 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C518E76083; Mon, 18 Dec 2023 21:07:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Aa4YFjyc" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) (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 A53EC7409E; Mon, 18 Dec 2023 21:07:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-4275b7eaa11so9873021cf.2; Mon, 18 Dec 2023 13:07:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702933662; x=1703538462; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:from:to:cc:subject:date :message-id:reply-to; bh=k5h6hrI62ojLOpzwPeAY3F1dA9KLCwXHTZO6prPyeJE=; b=Aa4YFjycLVMMdu5VrJuJnqEX5AlruVyYSEFVnvXLS8ET91j5wmDce+YrkqKujOuX9M sOLjVgRZps5urqCjdP3Jrevb0D/kXNL1PkJKxkWLlNu7aNmOZuv7g0NIGDY/plytH6DP qtek0NFgeBwOmUuN1YFrktHSyNYvp14OlFqnirFcdYJ8a7ctwkiXvv1Z+anyp+3UTIw+ V6aS0rVJcmftZ5F4jLyMoWJRiwQJOOr8vOkYlHM/Jf0rfwok9/hmbC5m7aFfXlG+90cZ gmvhsa9h9MQ6oNMEGqhdZxPbtr28+uWCDYJLAC8T9cjPev1bOm7tlsCCJaQamJ9uB4sv 00oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702933662; x=1703538462; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:feedback-id:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k5h6hrI62ojLOpzwPeAY3F1dA9KLCwXHTZO6prPyeJE=; b=dD2roI9E4bBwkQXzu/frrZlGCjt/RgykdrfsBWt9A1LWpMy86tADIvLYYgsyBDcvx3 np5Ur1jrb5KaYAhMDke9+IGYO+dZph/4bjJpasoUI1yJqZk/84b26Fl7PHNO7fHqvkRi /qh2wxxE33RX6O7vE9RaztKtR0cE9draJYHqsDZSsoSXyW6YS01IN5kJCxoBZ6egsUq/ zFao6mybFfyyOKpnI2iCJM+YH/R4KhiWNq/Ocz0Jkij9Xfi6LTn50ila+djCrp9WbGV9 n5C0bYl08iexWaHwYzgplLT0QLvIAJRjuPglgUbdDRgtWKdbz3vvGzuSm5Ob7BIgNWnF B0SQ== X-Gm-Message-State: AOJu0Yzu5/fsYmeOQP3fR8sBFxGPfOvUuQzUVmEIOOTIi1MQPnaj3nUI 8JFPSE+klQhF7GzGLJpeDLw= X-Received: by 2002:ad4:5f87:0:b0:67f:21f4:122 with SMTP id jp7-20020ad45f87000000b0067f21f40122mr6202149qvb.17.1702933662603; Mon, 18 Dec 2023 13:07:42 -0800 (PST) Received: from auth2-smtp.messagingengine.com (auth2-smtp.messagingengine.com. [66.111.4.228]) by smtp.gmail.com with ESMTPSA id dm11-20020ad44e2b000000b0067f486611fbsm1055766qvb.136.2023.12.18.13.07.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 13:07:42 -0800 (PST) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailauth.nyi.internal (Postfix) with ESMTP id CFCF927C005A; Mon, 18 Dec 2023 16:07:41 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 18 Dec 2023 16:07:41 -0500 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvddtkedgudegfecutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeeuohhq uhhnucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrf grthhtvghrnhephedugfduffffteeutddvheeuveelvdfhleelieevtdeguefhgeeuveei udffiedvnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epsghoqhhunhdomhgvshhmthhprghuthhhphgvrhhsohhnrghlihhthidqieelvdeghedt ieegqddujeejkeehheehvddqsghoqhhunhdrfhgvnhhgpeepghhmrghilhdrtghomhesfh higihmvgdrnhgrmhgv X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 18 Dec 2023 16:07:40 -0500 (EST) Date: Mon, 18 Dec 2023 13:07:23 -0800 From: Boqun Feng To: Alice Ryhl Cc: Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Tiago Lam , Thomas Gleixner , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/4] rust: time: add msecs to jiffies conversion Message-ID: References: <20231216-rb-new-condvar-methods-v2-0-b05ab61e6d5b@google.com> <20231216-rb-new-condvar-methods-v2-2-b05ab61e6d5b@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231216-rb-new-condvar-methods-v2-2-b05ab61e6d5b@google.com> On Sat, Dec 16, 2023 at 03:31:40PM +0000, Alice Ryhl wrote: [...] > diff --git a/rust/kernel/time.rs b/rust/kernel/time.rs > new file mode 100644 > index 000000000000..23c4d1a74f68 > --- /dev/null > +++ b/rust/kernel/time.rs > @@ -0,0 +1,17 @@ > +// SPDX-License-Identifier: GPL-2.0 > + > +//! Timers. > + Please consider the following mod level description: //! Time related primitives. //! //! This module contains the kernel APIs related to time and timers that //! have been ported or wrapped for usage by Rust code in the kernel. Otherwise it looks fine to me. Reviewed-by: Boqun Feng Regards, Boqun > +/// The time unit of Linux kernel. One jiffy equals (1/HZ) second. > +pub type Jiffies = core::ffi::c_ulong; > + > +/// The millisecond time unit. > +pub type Msecs = core::ffi::c_uint; > + > +/// Converts milliseconds to jiffies. > +#[inline] > +pub fn msecs_to_jiffies(msecs: Msecs) -> Jiffies { > + // SAFETY: The `__msecs_to_jiffies` function is always safe to call no > + // matter what the argument is. > + unsafe { bindings::__msecs_to_jiffies(msecs) } > +} > > -- > 2.43.0.472.g3155946c3a-goog > >