From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f73.google.com (mail-wr1-f73.google.com [209.85.221.73]) (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 79FBD31197B for ; Mon, 4 May 2026 07:54:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.73 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777881300; cv=none; b=ui+4I5QqvKEOWJcQ+WgtmyBGelTxRRdmmE44qmcnoLPDzhL16Xt4MLrVOD+bSbRu7U0gYTahUcPA5kq8Hh3BBmqx9UpHG7ea9yJxddftPlkr5G/vxhsNfDxJdh5i5vuPz60IYHGbZBq7qSu9hPKr4AwoRXWiCty0XB3iqrvrpNw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777881300; c=relaxed/simple; bh=9JE9zg6TGoXwE2Ye9BJbQ5ggqkvTbS31qTg7kLPdaxM=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=nX9vf3vqyTxD6hvzr/mviIzkFe3ZtfmkA7oe6jZDmETwR2fzZm7f6HYZqpV5d8hdwZzzd10E836HiHcabvL/xsn+ebGepeUKI6IYJgLmOs20Q4UVqKTSxhRpgREyF06n8qtubl66DucExKoieOAyvIikdsfNRd7l9d8HBv+3j2I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--aliceryhl.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=OY6mQ1oh; arc=none smtp.client-ip=209.85.221.73 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=flex--aliceryhl.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="OY6mQ1oh" Received: by mail-wr1-f73.google.com with SMTP id ffacd0b85a97d-441243ba35fso3478095f8f.0 for ; Mon, 04 May 2026 00:54:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1777881297; x=1778486097; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=TPwW2VczbGiDj4gVa/ND/7hdW1Q5aDi/GW+YjzixtBw=; b=OY6mQ1ohLEfJNysQrxBbied1MXWk1dNbcgxkpXRDc0SFyN9/eHIi70DCN0E9VcZ7e0 URlBcY6SmodoW32aVc8Pd6MMDXbp4Dlv7KQRIHCiSyodVbc276N2V0ChbSpoU5ne4Axz Mdo3BbOCIeSPBWzMqQ/FrTyaD3XGu1uimVN18Mbf/lsPDjdNlT1XtYwDWR/1RAcWYTLY c6hTrmfTuc6TKfL6C6Flh9hru0LKCLB3ynrHf75M47LhgZiacsPWxldg13/hxwDAUmLU sHeZWK4r2ofyeto+GI1F1Xj1xgBqK1w6TLVHruL+9KlyOS46z2k8egKleqJhcfr1zcyY KAig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777881297; x=1778486097; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=TPwW2VczbGiDj4gVa/ND/7hdW1Q5aDi/GW+YjzixtBw=; b=ZMX8zVCyBdC0AKih/90xxfLxnTlYcNmCKammRXHCMHup+mHPR8n33GP82NqiX1y2WK sfl9K3bYJCdKCC/WcMO6isoUMw0Ihhr5S5UxP+vUX/CLsfOo+E4vIaho7Sdwd7k8wHA3 jNODrk9e8cjBxPB4fjLHdpMISJyiMdb3sfUOxFq1y1ZY7zaoAS6lQi+1cC17VAGhT2Xn pdc3uwqGCJmCHDPB7wsN7W3ukDBGYyU4iYdh3qLF3HkGgghA/Tm2QYLageGQZK/983nx Npe/6jF8d5SuN4x2Vb885qR1zNhyu/OTvJHCjvboWYaBeZ/TDaa1krmo2rqyRfVQXxkN A1Dw== X-Forwarded-Encrypted: i=1; AFNElJ8y5fzHvyHt7kyLnE0lCwiPIsJ9x3pP1LRujZZcy4pkCNYV8DyW1WDUQocAwJNImjqXwZZ+4r+0jEGj53Q=@vger.kernel.org X-Gm-Message-State: AOJu0YwEujEN3lOmSZyiRS/3+1Q3HIPdGc7wGJgly2X8mJRQugifs2u7 4ZSZWPEdGm/y5LGBe+koDz2uDADfUrcRrUiZkHa0M6kPpRjIryLh/HIjtvUJnoPeLXCHQSSNOL6 A/7AfRf5p4SAtFAuUpw== X-Received: from wrbdz9.prod.google.com ([2002:a05:6000:e89:b0:44a:4650:c0c9]) (user=aliceryhl job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6000:1ac6:b0:439:bcc2:bf0a with SMTP id ffacd0b85a97d-44bb611032fmr13415501f8f.23.1777881296466; Mon, 04 May 2026 00:54:56 -0700 (PDT) Date: Mon, 4 May 2026 07:54:54 +0000 In-Reply-To: <20260501191122.64311-2-work@onurozkan.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260501191122.64311-1-work@onurozkan.dev> <20260501191122.64311-2-work@onurozkan.dev> Message-ID: Subject: Re: [PATCH v2 1/1] rust: add Work::disable_sync From: Alice Ryhl To: "Onur =?utf-8?B?w5Z6a2Fu?=" Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org, ojeda@kernel.org, boqun@kernel.org, gary@garyguo.net, bjorn3_gh@protonmail.com, lossin@kernel.org, a.hindborg@kernel.org, tmgross@umich.edu, dakr@kernel.org, tamird@kernel.org, daniel.almeida@collabora.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Fri, May 01, 2026 at 10:11:22PM +0300, Onur =C3=96zkan wrote: > Adds Work::disable_sync() as a safe wrapper for disable_work_sync(). >=20 > Drivers can use this during teardown to stop new queueing and wait for > queued or running work to finish before dropping related resources. >=20 > Signed-off-by: Onur =C3=96zkan > --- > rust/kernel/workqueue.rs | 121 ++++++++++++++++++++++++++------------- > 1 file changed, 81 insertions(+), 40 deletions(-) >=20 > diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs > index 7e253b6f299c..d0f9b4ba7f27 100644 > --- a/rust/kernel/workqueue.rs > +++ b/rust/kernel/workqueue.rs > @@ -267,7 +267,7 @@ pub unsafe fn from_raw<'a>(ptr: *const bindings::work= queue_struct) -> &'a Queue > =20 > /// Enqueues a work item. > /// > - /// This may fail if the work item is already enqueued in a workqueu= e. > + /// This may fail if the work item is already enqueued in a workqueu= e or disabled. > /// > /// The work item will be submitted using `WORK_CPU_UNBOUND`. > pub fn enqueue(&self, w: W) -> W::EnqueueOutput Can you elaborate on the case where disable leads to failure here? Can you not enqueue a work item again after disabling it? Is there a doc test illustrating this case that I can run for myself to see the behavior in action? Alice