From nobody Tue Dec 16 13:28:05 2025 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4FD447CF16; Mon, 24 Feb 2025 14:23:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740407037; cv=none; b=EW4olFgj2zokSor4Nw4f6qBUtlQVMJH0aX6Ob5EE7F+6/bbOrSk1X2/XEqEHgakbl1+IYYuoHSB9Mnk449Rrfp197VMMIbFCOIAz1gHhG+HNCsYXtmRWhF2soEglFcFdmIZlmaOjIFy7C0sKXyZFeWTFyhYl8kCbqtbu4v3QbpU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740407037; c=relaxed/simple; bh=E2lAPAZ2LYqRrh+gSq4+glJVFwMQxQGVoWqwBtpJP1U=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=R46SYFWpQ1n5T+ww+Ky0Wqe/tkS8fyVNUAO4q/hfx1SoGzy8SgOmiHLp2SDtjYBj1dtsuluQ4veGrCxjSsRVoDA6Z5qfuOnmJX+GP6Tzr6wwVYe+uvKWa8yg792IKR/nt6E6d9lNWveYGvyXtSLusb66QATsmvSO2gNxXC2Nixc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=YrVCLYDY; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="YrVCLYDY" Received: from hm-sls2.lan (unknown [142.114.216.132]) by linux.microsoft.com (Postfix) with ESMTPSA id 34285203CDDE; Mon, 24 Feb 2025 06:23:48 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 34285203CDDE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1740407029; bh=s6W1mOT343rnBx7peL+teMTPd68LRu36Duj+5rUo2os=; h=From:To:Cc:Subject:Date:From; b=YrVCLYDYjeN2WKG5EXpSQvQGwBsDFvl+phqCiXab0dXi6QJbv9Eo7k2TFRix06b9c 3usHzj0UShjcXVe5tL9iwR+YfCY11TXrwkJ/owHCu8D++eENcBT11Ad4FcrKtu7vuW oWPKIs1hQYCiAd/MW3LcitkhjhbSkpRnFeeSAaIU= From: Hamza Mahfooz To: rust-for-linux@vger.kernel.org Cc: Tejun Heo , Lai Jiangshan , Hamza Mahfooz , Miguel Ojeda , Alex Gaynor , Boqun Feng , Gary Guo , =?UTF-8?q?Bj=C3=B6rn=20Roy=20Baron?= , Benno Lossin , Andreas Hindborg , Alice Ryhl , Trevor Gross , Wedson Almeida Filho , Dirk Behme , Konstantin Andrikopoulos , Danilo Krummrich , Roland Xu , linux-kernel@vger.kernel.org Subject: [PATCH v2] rust: workqueue: define built-in bh queues Date: Mon, 24 Feb 2025 09:23:23 -0500 Message-ID: <20250224142326.38396-1-hamzamahfooz@linux.microsoft.com> X-Mailer: git-send-email 2.47.1 Precedence: bulk X-Mailing-List: linux-kernel@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" Provide safe getters to the system bh work queues. They will be used to reimplement the Hyper-V VMBus in rust. Signed-off-by: Hamza Mahfooz Reviewed-by: Alice Ryhl --- v2: make the commit message suck less. --- rust/kernel/workqueue.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/rust/kernel/workqueue.rs b/rust/kernel/workqueue.rs index 0cd100d2aefb..68ce70d94f2d 100644 --- a/rust/kernel/workqueue.rs +++ b/rust/kernel/workqueue.rs @@ -703,3 +703,21 @@ pub fn system_freezable_power_efficient() -> &'static = Queue { // SAFETY: `system_freezable_power_efficient_wq` is a C global, always= available. unsafe { Queue::from_raw(bindings::system_freezable_power_efficient_wq= ) } } + +/// Returns the system bottom halves work queue (`system_bh_wq`). +/// +/// It is similar to the one returned by [`system`] but for work items whi= ch +/// need to run from a softirq context. +pub fn system_bh() -> &'static Queue { + // SAFETY: `system_bh_wq` is a C global, always available. + unsafe { Queue::from_raw(bindings::system_bh_wq) } +} + +/// Returns the system bottom halves high-priority work queue (`system_bh_= highpri_wq`). +/// +/// It is similar to the one returned by [`system_bh`] but for work items = which +/// require higher scheduling priority. +pub fn system_bh_highpri() -> &'static Queue { + // SAFETY: `system_bh_highpri_wq` is a C global, always available. + unsafe { Queue::from_raw(bindings::system_bh_highpri_wq) } +} --=20 2.47.1