From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50]) (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 66CEF1EA7F6; Sun, 2 Mar 2025 16:56:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740934587; cv=none; b=u6QQPKUdl3WGOcXObZuC0rcMInNWv37fYVpVLaeztlIoJN1KgQMKddKbUnJvtVUX133OyhTwm7gNCsoKNOSazVDirw+Jtm+9L+TkM6Ns4XErVmph92v28wzsw/Xth5BfrbxHqgNzdY+n5CskjXNd5vnnlHMDX2zdDlRWlvv+oRc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740934587; c=relaxed/simple; bh=oqDPOn9PfAlEv4qL7Ae8YvlpjPZgISzpO+x/mO5VGd8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=rnHnUgXYaOPY0C7rgIEM0Pvry12U2cc9cJkeqgw8KM6feWHLU4nkE2a/LdANJzoSFrmcp0M+GRmYYl5Lxgt6cWoRiDY0Kp5LivWQWKCTzDkaRDUi7lrx9mXw7430mY43ee0XGt+vEzoDQkM9r7Q1Kg3Gq5HpBclJluS/KXliqYg= 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=AjsVxN9U; arc=none smtp.client-ip=209.85.208.50 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="AjsVxN9U" Received: by mail-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-5e52c1c3599so1427806a12.2; Sun, 02 Mar 2025 08:56:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740934584; x=1741539384; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=7bUaWA3+rf3ETOGqkAJlZ0iVybSS+eyVOOdkG14icWU=; b=AjsVxN9Ut64BLxPu7NK9qeeISBscFyxG84DSjoBs3DyJ5L0cjl0nPTt+W5l/gt09r8 fJf35IFYPS4aGQjFNM0N5P9bPAu4vtffeHCeCzv/M9f6EbTYZZqGau/nHbvNX0NejlOB jkMFJMXuUgNbF/QSUtvCSGU1wHhv6xHN50TXvSYnZxFUTiSHa4zBQ1l26zo0+DZGu/hY zt1e9V5CSgh0ML40EkAQ2DyWVaENZuEn5ucx+5OPPoxPXpZELZCDLDy4t2v52Efr8q1q +Ua6bR6b7HItSHwRPnSCULLwReOaAkw3sb1BjHC/3OPQE4Q6O8hSg0qsbLuGLoxWHN7K 3POQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740934584; x=1741539384; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7bUaWA3+rf3ETOGqkAJlZ0iVybSS+eyVOOdkG14icWU=; b=cieb/+rMX6ad6ka46QCF3J4pi/vp/2mEQh+Ny2yboXYL1UfVF1L8ENQ+3/cRbv5ji2 zUHO+6E4qOxsC7i0imqlPdpDJ5kfqiUMAKVgGxKmdWjzSBanAgqfYy9XDnKIIHN6c52K 0nTQSfCyTKdFWsrzWf82keCRJK1fO1fS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zNwUQ== X-Received: by 2002:a17:906:fd86:b0:ab7:8d23:1fef with SMTP id a640c23a62f3a-abf261fae62mr1420672866b.9.1740934583397; Sun, 02 Mar 2025 08:56:23 -0800 (PST) Received: from ?IPV6:2003:df:bf03:a200:eeb1:4cf6:acf1:a130? (p200300dfbf03a200eeb14cf6acf1a130.dip0.t-ipconnect.de. [2003:df:bf03:a200:eeb1:4cf6:acf1:a130]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-abf0c7bf82fsm671238266b.173.2025.03.02.08.56.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 02 Mar 2025 08:56:22 -0800 (PST) Message-ID: <04f71cbe-7521-460e-a104-9c2a6b80614e@gmail.com> Date: Sun, 2 Mar 2025 17:56:21 +0100 Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v9 4/9] rust: Introduce interrupt module To: Lyude Paul , rust-for-linux@vger.kernel.org, Thomas Gleixner Cc: Boqun Feng , Miguel Ojeda , Alex Gaynor , Gary Guo , =?UTF-8?Q?Bj=C3=B6rn_Roy_Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Danilo Krummrich , Wedson Almeida Filho , Christian Brauner , Greg Kroah-Hartman , Xiangfei Ding , open list References: <20250227221924.265259-1-lyude@redhat.com> <20250227221924.265259-5-lyude@redhat.com> Content-Language: de-AT-frami From: Dirk Behme In-Reply-To: <20250227221924.265259-5-lyude@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 27.02.25 23:10, Lyude Paul wrote: > This introduces a module for dealing with interrupt-disabled contexts, > including the ability to enable and disable interrupts along with the > ability to annotate functions as expecting that IRQs are already > disabled on the local CPU. > > [Boqun: This is based on Lyude's work on interrupt disable abstraction, > I port to the new local_interrupt_disable() mechanism to make it work > as a guard type. I cannot even take the credit of this design, since > Lyude also brought up the same idea in zulip. Anyway, this is only for > POC purpose, and of course all bugs are mine] > > Signed-off-by: Lyude Paul > Co-Developed-by: Boqun Feng > Signed-off-by: Boqun Feng > --- > rust/helpers/helpers.c | 1 + > rust/helpers/interrupt.c | 18 +++++++++ > rust/kernel/interrupt.rs | 83 ++++++++++++++++++++++++++++++++++++++++ > rust/kernel/lib.rs | 1 + > 4 files changed, 103 insertions(+) > create mode 100644 rust/helpers/interrupt.c > create mode 100644 rust/kernel/interrupt.rs > .... > diff --git a/rust/kernel/interrupt.rs b/rust/kernel/interrupt.rs > new file mode 100644 > index 0000000000000..c0a4b182fd9e7 > --- /dev/null > +++ b/rust/kernel/interrupt.rs > @@ -0,0 +1,83 @@ > +// SPDX-License-Identifier: GPL-2.0 > + > +//! Interrupt controls > +//! > +//! This module allows Rust code to annotate areas of code where local processor interrupts should > +//! be disabled, along with actually disabling local processor interrupts. > +//! > +//! # ⚠️ Warning! ⚠️ > +//! > +//! The usage of this module can be more complicated then meets the eye, especially surrounding Typo? then -> than? Dirk