Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp1210561lqp; Fri, 22 Mar 2024 08:25:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVvopA1PO+VG1CtvbJFumcLJGLiHYSNakoEG5c/o4umckG5AaMSDreSqUpHbEVKeLy90/3YLSfQ5eYp0PWxq4kds6tvR5CaCdi00qeuMA== X-Google-Smtp-Source: AGHT+IHFtowVWx2aq005YZ0rFVp46oYZMO1IO040DE6PLFWsvkms33th96op/gw6GIG4gJZ3S+9f X-Received: by 2002:a17:903:244b:b0:1de:e3d5:cdde with SMTP id l11-20020a170903244b00b001dee3d5cddemr68056pls.5.1711121157836; Fri, 22 Mar 2024 08:25:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711121157; cv=pass; d=google.com; s=arc-20160816; b=LrKQzD12lD9l71Xtp9C4up/SFK/wTePj6DtTyLxNoFl1ZOflSxRq0+ThivsmXA8NXn jG0U3VKoCr+aRTmInAgnPamzHPB5UshQGj8Prd8gnEpH3Lo5CAZSDNT2QVj2l9SZrwXV DK8bdWMMVBt9UpBukyFszVZcQ46Jy5AfuF9oxkkavlCrHRUmbij2MLcKpo9MCqSkYoAG cpa9xBF1Ve0jg82aYnwo9EEGx6VoPKB51NLHJbKmn0U/PQW0p3/gEYZwm+8+8MJ/4LI7 RR2S/USLOfezWs325N1GBv7ICixIP0E1EDHxDNj2loAx43VRnQ0418zZV05PMiMnnLMq lJeg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature; bh=mIOmF60Rb86w4+w2jglrFD/Lg9na+Rxq9LbforhHtzA=; fh=vI7CaTzpq8/0OyQeYNjv23oe0qrLJB/xztD1nx2rzkU=; b=vDOHQbNHcs315JfauXwHneJ/jokTsqNV7fALmm9OvJBAiWxIxoPeVmYHnHBGsHt3/D pK0cG3UGyUxaB98biq+l/pVcv1ivipnnV02bckUvR/4fVaWfPtSRZAyDoAFccqUCYhoI JEAa/mH8Bi7uhbDyetZJImWHUTt8Gyu8MOPE2A+H+7aDN4mgELyL082JYHNn3kwb0BUZ CocTqurg5adb3HJgQd/4GG85+Jw0lQIVZyqeoSefYFdHLsRhQOBj+WVawisF73ecq5Ir b2qSKx7gI1KtnzhIvKbxM4+NRXyvcqSEBt6vaEHPHovucDdZYCcje1BIN3Xe0ozOTei2 Ew8g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hrnAdmDh; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-111701-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111701-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id f7-20020a170902684700b001defbc853b6si2087782pln.607.2024.03.22.08.25.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 08:25:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-111701-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=hrnAdmDh; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-111701-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-111701-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 80468284108 for ; Fri, 22 Mar 2024 15:25:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 72E6450A88; Fri, 22 Mar 2024 15:25:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="hrnAdmDh" Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) (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 098E14D137; Fri, 22 Mar 2024 15:25:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711121148; cv=none; b=qQbCAKcKopUCufIPa1CysauU9lNL0x+A2K40W2kYthdmDgWxrZ2cvJHmDcB+EYyzdXL10ZZIFKlB2uABqzARB6YYakpltcKbzQmlhBO5Ih8x5tqCXTlUO/H7gAoJ1HglrtQmjdaltpUmH3qmF9hg9OM+KPhYoWbmnQP4/vZEklw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711121148; c=relaxed/simple; bh=6bSwHxIng+Vkb43xeUl9q3Lz9EPeHyyRDC+bhUpmH/E=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hQQHYgi+gz6P3lyBbxUGdkfqGeK7gimQkwcMShlmSuSPtkf9+pcgkmy7z6JRLnhve7a1I7+bkJVmTUE8h/rV/3z3a5oHS7zTBGM/VlrOKDm5CTOr2WrfWF+kzvbzmrH3m2/l6a/1xxNlVt+ARa8cF5y8CKijQRHGLuU8KJPESfE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=hrnAdmDh; arc=none smtp.client-ip=209.85.219.47 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-qv1-f47.google.com with SMTP id 6a1803df08f44-69625f89aa2so19039086d6.3; Fri, 22 Mar 2024 08:25:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711121145; x=1711725945; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :feedback-id:from:to:cc:subject:date:message-id:reply-to; bh=mIOmF60Rb86w4+w2jglrFD/Lg9na+Rxq9LbforhHtzA=; b=hrnAdmDhbgbKprzwTelemHfNYjrBXVgGj7Ud/kz4F6PBRSlcXhJ3FrBPo2eqVZ12ff 8CnnJc6jnAsKCLr3CSDt+vnHhWCCJd8PMjsikMgqYfDBCAu0NtXv7LhrNfiFbsuDaEWt dzqPItL71AFaK9WbHa/1WvEqaQYojyC68N3Yyt4bBRCh72WmPGT8kxQy2obA8cd3AbXK uZpbWHr/d4XLSC+jOxe+Cj62RL9ULG1z2IQJftfjzrnlYBp7PbD3gQ9OhRzXe2Surxbe cNfi4jcAf+hur61egNefZVcrKFBkYbMWnVrV6tU/G6+jrZ7+m+OK4OHQ9oTAdqfrqORO 5MjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711121145; x=1711725945; h=in-reply-to:content-transfer-encoding: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=mIOmF60Rb86w4+w2jglrFD/Lg9na+Rxq9LbforhHtzA=; b=Xjm+wDMwF1UrywjQM6Wux9mc6vxmuGqXhae4Ez0GP/UCBi9FchwuTabP6pW0EJ9K70 bcMHX7HWfPt2nU6aEd6Ve9+bFLYxunVEz8jDTheP+ff2rnpcRgZ1lmvAaHOlfAxeAB0L BE4ygpGWFr3pFrBBbZBtyO2n2jAw2KcTDCD88NsZ6D6dUby9K0e2wi2XdqiY4N+//DMx 46Dckqk7V9DkU4MiuL0FPzSrbDzysyMRcHNlqD62EXLFhAFXbO2VMNctnC7SOPEvmaQU qYMJst1xT/DV4s0MJi69vHmE3jDTkEAZhpzDQjOHrBNN0s+bVXua8gwJjRteQEPDoRWc /80g== X-Forwarded-Encrypted: i=1; AJvYcCXrviLEEdzHjssPyKcqTtyGTQgWFn29klvp3l0keN9Z3KH/q/Btux9o2Qrcq6QBOY6P63J756js4zhs8njHKiheDIFVXnuq+MXFBezDYJ0pJxMQkXp24095kfoLwRZRAu+oOgtmvrNg93n3Zcs= X-Gm-Message-State: AOJu0Yy1w/NOo3jcaY3yt3trI1z13Ensk0mWFyH4OUlZwdoJZRux/17z 0xhKmJ9TWE91MnYu2LZflF6k5IJ0v1sVatSHAjiLPjYaQQsLGTjA X-Received: by 2002:a05:6214:4008:b0:690:d5bc:c20a with SMTP id kd8-20020a056214400800b00690d5bcc20amr2053886qvb.4.1711121144929; Fri, 22 Mar 2024 08:25:44 -0700 (PDT) Received: from fauth2-smtp.messagingengine.com (fauth2-smtp.messagingengine.com. [103.168.172.201]) by smtp.gmail.com with ESMTPSA id fq9-20020a056214258900b00690d5310c55sm1157262qvb.114.2024.03.22.08.25.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 08:25:44 -0700 (PDT) Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfauth.nyi.internal (Postfix) with ESMTP id B39911200066; Fri, 22 Mar 2024 11:25:43 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 22 Mar 2024 11:25:43 -0400 X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledruddtvddguddvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggugfgjsehtqhertddttdejnecuhfhrohhmpeeuohhq uhhnucfhvghnghcuoegsohhquhhnrdhfvghnghesghhmrghilhdrtghomheqnecuggftrf grthhtvghrnhepfedtvdfgudfftdfffeejvdegtddvvdfhkedugfegkeeftdffledtueet gfevkeetnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegsohhquhhnodhmvghsmhhtphgruhht hhhpvghrshhonhgrlhhithihqdeiledvgeehtdeigedqudejjeekheehhedvqdgsohhquh hnrdhfvghngheppehgmhgrihhlrdgtohhmsehfihigmhgvrdhnrghmvg X-ME-Proxy: Feedback-ID: iad51458e:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 22 Mar 2024 11:25:42 -0400 (EDT) Date: Fri, 22 Mar 2024 08:25:40 -0700 From: Boqun Feng To: Alice Ryhl Cc: Miguel Ojeda , John Stultz , Thomas Gleixner , Stephen Boyd , Alex Gaynor , Wedson Almeida Filho , Gary Guo , =?iso-8859-1?Q?Bj=F6rn?= Roy Baron , Benno Lossin , Andreas Hindborg , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rust: time: add Ktime Message-ID: References: <20240320-rust-ktime_ms_delta-v1-1-ccb8672a0941@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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: On Fri, Mar 22, 2024 at 08:50:18AM +0100, Alice Ryhl wrote: > On Wed, Mar 20, 2024 at 4:30=E2=80=AFPM Boqun Feng = wrote: > > > > Hi, > > > > On Wed, Mar 20, 2024 at 10:08:45AM +0000, Alice Ryhl wrote: > > > Introduce a wrapper around `ktime_t` with a few different useful > > > methods. > > > > > > Rust Binder will use these bindings to compute how many milliseconds a > > > transaction has been active for when dumping the current state of the > > > Binder driver. This replicates the logic in C Binder [1]. > > > > > > > I wonder whether Lina's previous patch also works for your case? > > > > https://lore.kernel.org/rust-for-linux/20230714-rust-time-v2-1-= f5aed84218c4@asahilina.net/ > > > > You don't need to implement all the `Clock`s since you only need > > MONOTONIC time. But maybe `Duration::as_nanos` and `Duration::as_millis` > > return `u128` is problematic? >=20 > It would work for me too, but adds more than what I need. As for > `u128`, I don't really know what the status on that is. I need to be > able to print it as a base-10 integer. >=20 > Adding an API with separate types that distinguish between Instant and > Duration and different clock sources so that you don't mix them up is > reasonable, but a bit overkill for my needs. I am spending enough API > design cycles on my uaccess, file, and linked list patchsets. Someone I totally understand that! But the requirement was brought up a while ago by Thomas: https://lore.kernel.org/rust-for-linux/87h6vfnh0f.ffs@tglx/ > else can submit patches to add a more well-typed time API in the > future. >=20 Would it work, if I create a new patch based on yours? The work for me won't be too much since you, Lina and Heghedus already did the hard work along with some feedback from Thomas. Regards, Boqun > Alice