Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp873663rdd; Wed, 10 Jan 2024 02:01:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IE4u4eEZ711RA35MbOxDN1uRKH5d4rBk3kRKKPdqFgcZ7RXMkmvq3hzIIv0bnUGW27KkuqY X-Received: by 2002:a50:871a:0:b0:558:1846:ce99 with SMTP id i26-20020a50871a000000b005581846ce99mr284800edb.45.1704880909049; Wed, 10 Jan 2024 02:01:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704880909; cv=none; d=google.com; s=arc-20160816; b=Tppq82OUTqvcadecEPLuF5LsybDPBTuAYXhuOqc+ZAlrq8QBmqgVDiZJ7aG8Eom9x2 pysecKN6YxWUiLpSlMgkP/yFn2Pv20dDjhUvvVeusmxBvZuWpnNq2Zl0QkX0FBVctkzj 0YswAVatDA2KWMQBLKfu3AKczOLMfQ7zQVc87SqmOIGGoR5lfeldzyfbZMsFTsdHoGnu czeUvZLc1+EJZqwFYsqXtBKizwpJv/AFGFfNv5XLgIwC1j2WXr5BgivzdSRW4drPOCmm xEFYJzDAHbC+KA/3l7v/pyv3NvZIjkgtLvzad+oYY13K54tVQAnCTRvqWQK4kgNyivBN 72kg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:feedback-id:references :in-reply-to:message-id:subject:cc:from:to:date:dkim-signature; bh=ciT5Z7UQzFkWQl2p+TUA4UNBF3JN/rFYRvA4zsaEyS4=; fh=PumtQ7rovpICyflawDRzB3ZT1aJ42hOIsuxHTcVFnhs=; b=p6eUQp/i7lZLD9rimQeNXVCiQrPJtW2dnlGX+1iunQ0hmvF8PWfP5F3wAfL3/ZOgNa BGf84LpNzzLOYG0T6zK+Li1ojG05SBBhyqlpGREinYy0Fh06Y8sGa3CHJB7F5Wwe6MR5 zUGJx+azxcfZPnhEIpIrHL5QtZwY5sN4IPytQbD9lT8/IATNwmh6jXyWviFfgZIclP/4 lgggfJqqccFVxh0Un7qXQbkPmB5sulfx6favrFPxFowoAmne/X+sKraesvYBUuqZMegi tNH06PIDf8PdnRYThNnFVjX1mUlhw0/xPonfNF/WBQjNG4Vl+VeKl5YD0NEhn2rM26P7 TvTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@proton.me header.s=protonmail header.b=DzFr2lcK; spf=pass (google.com: domain of linux-kernel+bounces-21936-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21936-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id eg13-20020a056402288d00b0055470a60d3dsi1563941edb.60.2024.01.10.02.01.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 02:01:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-21936-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@proton.me header.s=protonmail header.b=DzFr2lcK; spf=pass (google.com: domain of linux-kernel+bounces-21936-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21936-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=proton.me 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 am.mirrors.kernel.org (Postfix) with ESMTPS id C89EA1F24F60 for ; Wed, 10 Jan 2024 10:01:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 15ED33FB1F; Wed, 10 Jan 2024 10:01:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=proton.me header.i=@proton.me header.b="DzFr2lcK" Received: from mail-4316.protonmail.ch (mail-4316.protonmail.ch [185.70.43.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7B5563D967; Wed, 10 Jan 2024 10:01:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=proton.me Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=proton.me DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proton.me; s=protonmail; t=1704880882; x=1705140082; bh=ciT5Z7UQzFkWQl2p+TUA4UNBF3JN/rFYRvA4zsaEyS4=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=DzFr2lcKc5ouNjnYYyApVW/hXgnVdtfGdsAfW6k5pZXQKoC20SDg9jVHkOfj67ha6 /m2+3e+BtxvsfiO3YimIlxTiGCkaeQAZav924moFIdmIyVu/2glEb+dn+CjbdZdHUM tnFlVAJ6YYHri1pARt6dO4asRkk2D5E1q1Fi0qz1MAcHZFH5CjbllySwg2ePaq/dak Pl2Bf//d0dJGkOozrqiEemrPJlY241ouUtC8u5+iXV0qga73I0J5srmTqDvKd1rCAy PC6V58R+WfCDuisPR2pmZWRJpnV9m0N/lM5gxl8BA94/Qykw0ZUPD3hbJBSsJil+gD +VKz5md/JhTCg== Date: Wed, 10 Jan 2024 10:01:13 +0000 To: Alice Ryhl , Miguel Ojeda , Alex Gaynor , Wedson Almeida Filho , Boqun Feng , Gary Guo , =?utf-8?Q?Bj=C3=B6rn_Roy_Baron?= , Andreas Hindborg , Peter Zijlstra , Ingo Molnar , Will Deacon , Waiman Long , Tiago Lam , Thomas Gleixner From: Benno Lossin Cc: Martin Rodriguez Reboredo , rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4 3/4] rust: sync: add `CondVar::wait_timeout` Message-ID: <8c1b98e8-a1e4-4466-a9ca-72b9923bb2e2@proton.me> In-Reply-To: <20240108-rb-new-condvar-methods-v4-3-88e0c871cc05@google.com> References: <20240108-rb-new-condvar-methods-v4-0-88e0c871cc05@google.com> <20240108-rb-new-condvar-methods-v4-3-88e0c871cc05@google.com> Feedback-ID: 71780778:user:proton 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-Transfer-Encoding: quoted-printable On 08.01.24 15:49, Alice Ryhl wrote: > Sleep on a condition variable with a timeout. >=20 > This is used by Rust Binder for process freezing. There, we want to > sleep until the freeze operation completes, but we want to be able to > abort the process freezing if it doesn't complete within some timeout. >=20 > Note that it is not enough to avoid jiffies by introducing a variant of > `CondVar::wait_timeout` that takes the timeout in msecs because we need > to be able to restart the sleep with the remaining sleep duration if it > is interrupted, and if the API takes msecs rather than jiffies, then > that would require a conversion roundtrip jiffies->msecs->jiffies that > is best avoided. >=20 > Reviewed-by: Martin Rodriguez Reboredo > Reviewed-by: Tiago Lam > Reviewed-by: Boqun Feng > Signed-off-by: Alice Ryhl > --- > rust/kernel/sync/condvar.rs | 60 ++++++++++++++++++++++++++++++++++++++= ++----- > rust/kernel/sync/lock.rs | 4 +-- > rust/kernel/task.rs | 5 +++- > 3 files changed, 60 insertions(+), 9 deletions(-) Reviewed-by: Benno Lossin -- Cheers, Benno