From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 3EF712F85FE; Wed, 23 Jul 2025 15:03:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753283001; cv=none; b=RMHNVwQ72OB97AZt+etlG7uUPbvnO/kOiIwKjzjjscqDkBhcwl5brQA/AV+aZr9EUq8DnRiQoQU9N/QimnXk9vup/JnbMZk7/OCo1rGXj3JNP6xV1G/+L18X5O0S+5kU61v+xCe64STaSw4Uu9nJ8mFn+8VuAJgaQk+6NxNzIM0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753283001; c=relaxed/simple; bh=WWTb+6ti3vUKjHVhd54re/0m6tya3/HZoN8eV4EAb/o=; h=Mime-Version:Content-Type:Date:Message-Id:Subject:Cc:To:From: References:In-Reply-To; b=fwsdjZ+WAlGAXyvpzn6dgUInlgcSo44gDIqR2A5hxwNXP5SrSnducR07JwSH8Ol+LcJDL/mDkd+amfcsm42yXlVKTvXt/dTuZwVx+Nm6BiHEpl3x1geTpvM0XI7CdMIJSaHdJaKuImHU818aSSJP6cbbm/F7arS77ZgeiVHoEmw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=hVLbBCAc; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="hVLbBCAc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5ADEBC4CEE7; Wed, 23 Jul 2025 15:03:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1753282997; bh=WWTb+6ti3vUKjHVhd54re/0m6tya3/HZoN8eV4EAb/o=; h=Date:Subject:Cc:To:From:References:In-Reply-To:From; b=hVLbBCAcYVOFDM3Nyy2EgZ5pZ/3YXoCq0ii5ijFaDiFBQqaXqkhnxkeTUugCyFx4z RPypRjiyLJwhKj3HfE+SMxuYbHm4mdO6Rq2R+0sRPj0WwMmNpoL7qFrQDtLLBeTsoF AMwDa0smanMdbwJLs5SRYWsUSPYUMCEpADLetJpZFGzeQF4QQJkhHpURZztRQT6btD /ky5+nrz6fow1kPuA2kgmOeNHInktm3LbTFmm+0T07MlYhfOntAjRrvzaEHw1+LWO8 4sESgJX/PjiAyJ2xDGzQjvpJ+fU7ggTbcOBxbqdJS9ZsJ40RRd/05soWrIFPptKu8C NpJ8HZMJ1CmvA== Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Wed, 23 Jul 2025 17:03:12 +0200 Message-Id: Subject: Re: [PATCH v7 3/6] rust: irq: add support for non-threaded IRQs and handlers Cc: "Boqun Feng" , "Miguel Ojeda" , "Alex Gaynor" , "Gary Guo" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Andreas Hindborg" , "Alice Ryhl" , "Trevor Gross" , "Greg Kroah-Hartman" , "Rafael J. Wysocki" , "Thomas Gleixner" , "Bjorn Helgaas" , =?utf-8?q?Krzysztof_Wilczy=C2=B4nski?= , "Benno Lossin" , , , To: "Daniel Almeida" From: "Danilo Krummrich" References: <20250715-topics-tyr-request_irq2-v7-0-d469c0f37c07@collabora.com> <20250715-topics-tyr-request_irq2-v7-3-d469c0f37c07@collabora.com> <7fa90026-d2ac-4d39-bbd8-4e6c9c935b34@kernel.org> <8742EFD5-1949-4900-ACC6-00B69C23233C@collabora.com> In-Reply-To: <8742EFD5-1949-4900-ACC6-00B69C23233C@collabora.com> On Wed Jul 23, 2025 at 4:56 PM CEST, Daniel Almeida wrote: >> On 23 Jul 2025, at 11:35, Danilo Krummrich wrote: >> On 7/23/25 4:26 PM, Boqun Feng wrote: >>> On Wed, Jul 23, 2025 at 10:55:20AM -0300, Daniel Almeida wrote: >>> But sure, this and the handler pinned initializer thing is not a blocke= r >>> issue. However, I would like to see them resolved as soon as possible >>> once merged. >>=20 >> I think it would be trivial to make the T an impl PinInit and use = a >> completion as example instead of an atomic. So, we should do it right aw= ay. >>=20 >> - Danilo > > > I agree that this is a trivial change to make. My point here is not to po= stpone > the work; I am actually somewhat against switching to completions, as per= the > reasoning I provided in my latest reply to Boqun. My plan is to switch di= rectly > to whatever will substitute AtomicU32. I mean, Boqun has a point. AFAIK, the Rust atomics are UB in the kernel. So, this is a bit as if we would use spin_lock() instead of spin_lock_irq()= , it's just not correct. Hence, we may not want to showcase it until it's act= ually resolved. The plain truth is, currently there's no synchronization primitive for gett= ing interior mutability in interrupts. You can use a normal spinlock or mutex in the threaded handler though. And in the hard IRQ you can use a completion to indicate something has completed. Once we have proper atomics and spin_lock_irq() we can still change it. > The switch to impl PinInit is fine.