From patchwork Sat Jan 17 01:14:24 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1562 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768612512; bh=9o0yWpPhPt6AvU1C2OYWBzRtDX/Jk4aTulxpIregaZg=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=qKon/LiD5Isaifu7Mz6ZdjEJ7FVWTY+ZBk1PJJX3lNEa8nx+nW3x7ROwhHW7AXwj5 UECsffiZL6doL0Yka3W6MoWY/5X7DpBUZDn5940zH0+2EWMQm/UxPOi3HQK85VNtt/ 6UA/TrgQ7W1Z/qcnjVtnJM7dKIdeqM0/s/3CHVXfW7vD1NO1LaUT9BxCYWveFFKNHO SajqQGB2jZXFQyEsE0fBb/umYy3JtAcPI+n9wy9oWTI9pOEzkqJUDRr9fm5gt7wOHw 65YFWfAIm6/Ff5v9JYt2tFR7YREHhGBrXA62kmZIeitLQJAsLj/xqodK6VHFTF2L0Z I5cBCF/mdDJ3w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 380D6693F7 for ; Fri, 16 Jan 2026 18:15:12 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id osppX7jIk3w4 for ; Fri, 16 Jan 2026 18:15:12 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768612512; bh=9o0yWpPhPt6AvU1C2OYWBzRtDX/Jk4aTulxpIregaZg=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=qKon/LiD5Isaifu7Mz6ZdjEJ7FVWTY+ZBk1PJJX3lNEa8nx+nW3x7ROwhHW7AXwj5 UECsffiZL6doL0Yka3W6MoWY/5X7DpBUZDn5940zH0+2EWMQm/UxPOi3HQK85VNtt/ 6UA/TrgQ7W1Z/qcnjVtnJM7dKIdeqM0/s/3CHVXfW7vD1NO1LaUT9BxCYWveFFKNHO SajqQGB2jZXFQyEsE0fBb/umYy3JtAcPI+n9wy9oWTI9pOEzkqJUDRr9fm5gt7wOHw 65YFWfAIm6/Ff5v9JYt2tFR7YREHhGBrXA62kmZIeitLQJAsLj/xqodK6VHFTF2L0Z I5cBCF/mdDJ3w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 26D88693E9 for ; Fri, 16 Jan 2026 18:15:12 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768612510; bh=uquEh0uBckEyOFQixd2qCaHzsbJ1ANQcL+B4RGkkDiU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j0Cp5zLjWTDAB6s3tzJBOjBC5dy07ojNsCxqcbbJjRLCVz5uaogAZh9moAjTw+mKJ LNTgwp8ybZD1kHQqs1RkXwXY7D47w7rG2TftzYXflyjo4V6O6H+xgCS2S+zKKk1myU Q9GIzvrL1Nik/SrZnTfmbgWGkAEZjtmd4cfrjqT3gU0DBlmyYFzgqh4e8mQIC0w18O zABwqKgt9v2h9rgn/kWU885wDGcuJyFt4/66wsKDig2mVbsO+5vEmucHbpV8/CHcGF ybS5PukihZCZ8F83lNGJE3OpiNW4TQK291fqOuW57QnYjMjVgd/eu8hlsXreZ8GmTT t4Sdt7vmI4KVQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 27C0C6913F; Fri, 16 Jan 2026 18:15:10 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id b2_rQ3-CCbD6; Fri, 16 Jan 2026 18:15:10 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768612506; bh=7yL2G02Jr29EPW0zzwiLDpLynqVVl28TmtRHxKys5gA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gm8AxHhWRWme1guwJyGNWBmK+vzQWxy1FJ336W7cz8tDTbR7zwI7e4EB/RZrTd2st PuTItbiMet28/foau1PEowQALnh6xRlGECYq9DdZkUKJQcty0XN6gu2px2Zp2DWS8Z vaakbety14dXqOYeZNDlxpxKEp9ZG0WC6dZTr5Am3Ggt3yzsrVJZn/xgYl6ZIFbZiR yTgg6UneOnD6E39VO5SGZ4WG9IjrgzpCxsD7F9rR75/25UMmPoS6+u7yZG6EBKp+Wr lQUf3x3/iztLCQzY2+zWvtuNVAwg+h+EHLz6dRXzzaB5iW+wL+/vM/XYd9ytfiAmBr z4cXGSOhFIieg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id BF34F693E0; Fri, 16 Jan 2026 18:15:05 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 18:14:24 -0700 Message-ID: <20260117011448.3007171-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260117011448.3007171-1-sjg@u-boot.org> References: <20260117011448.3007171-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: STJLMJYEQQNUNGOA72BPPQGORYWVHCMZ X-Message-ID-Hash: STJLMJYEQQNUNGOA72BPPQGORYWVHCMZ X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 02/19] linux: Add rcupdate.h header with RCU stubs List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass U-Boot is single-threaded, so RCU (Read-Copy-Update) synchronisation is not needed. The ext4l filesystem uses several RCU macros which are currently defined in ext4_uboot.h. Create a new linux/rcupdate.h header file with stub implementations to better match the Linux kernel structure. This reduces duplication and makes ext4_uboot.h smaller. Stubs moved: - rcu_read_lock() / rcu_read_unlock() - rcu_dereference() / rcu_dereference_protected() - rcu_assign_pointer() - call_rcu() - synchronize_rcu() - rcu_barrier() - list_for_each_entry_rcu() - list_del_rcu() / list_add_rcu() / list_add_tail_rcu() Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 21 +++------------- include/linux/rcupdate.h | 54 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+), 18 deletions(-) create mode 100644 include/linux/rcupdate.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 04872c0a34e..47236e63911 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -357,14 +357,8 @@ int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, /* Block group lock - stub */ #define bgl_lock_ptr(lock, group) NULL -/* RCU stubs */ -#define rcu_read_lock() do { } while (0) -#define rcu_read_unlock() do { } while (0) -#define rcu_dereference(p) (p) -#define rcu_dereference_protected(p, c) (p) -#define rcu_assign_pointer(p, v) ((p) = (v)) -#define call_rcu(head, func) do { func(head); } while (0) -#define synchronize_rcu() do { } while (0) +/* RCU stubs - use linux/rcupdate.h */ +#include /* RCU head for callbacks - defined in linux/compat.h as callback_head */ @@ -384,9 +378,6 @@ int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, * implementation - do not stub them! */ -/* RCU barrier - stub */ -#define rcu_barrier() do { } while (0) - /* inode/dentry operations */ void iput(struct inode *inode); @@ -2198,13 +2189,7 @@ static inline unsigned long ext4_find_next_bit_le(const void *addr, /* atomic_sub, atomic64_sub, atomic_dec_and_test are in asm-generic/atomic.h */ -/* RCU list operations - use regular list operations in U-Boot */ -#define list_for_each_entry_rcu(pos, head, member, ...) \ - list_for_each_entry(pos, head, member) -#define list_del_rcu(entry) list_del(entry) -#define list_add_rcu(new, head) list_add(new, head) -#define list_add_tail_rcu(new, head) list_add_tail(new, head) -/* Other RCU stubs are defined earlier in this file */ +/* RCU list operations are in linux/rcupdate.h */ /* raw_cpu_ptr - get pointer to per-CPU data for current CPU */ #define raw_cpu_ptr(ptr) (ptr) diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h new file mode 100644 index 00000000000..209e0d4ec8c --- /dev/null +++ b/include/linux/rcupdate.h @@ -0,0 +1,54 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Read-Copy Update mechanism stub for U-Boot + * + * U-Boot is single-threaded, so RCU operations are no-ops. + */ +#ifndef __LINUX_RCUPDATE_H +#define __LINUX_RCUPDATE_H + +#include + +/* + * RCU read-side critical section markers - no-ops in single-threaded U-Boot + */ +#define rcu_read_lock() do { } while (0) +#define rcu_read_unlock() do { } while (0) + +/* + * RCU pointer access - just return the pointer directly + */ +#define rcu_dereference(p) (p) +#define rcu_dereference_protected(p, c) (p) +#define rcu_dereference_raw(p) (p) + +/* + * RCU pointer assignment - direct assignment in single-threaded environment + */ +#define rcu_assign_pointer(p, v) ((p) = (v)) + +/* + * RCU callbacks - execute immediately in single-threaded U-Boot + */ +#define call_rcu(head, func) do { func(head); } while (0) + +/* + * Synchronize RCU - no-op since there are no concurrent readers + */ +#define synchronize_rcu() do { } while (0) + +/* + * RCU barrier - wait for all RCU callbacks to complete (no-op in U-Boot) + */ +#define rcu_barrier() do { } while (0) + +/* + * RCU list operations - use regular list operations in single-threaded U-Boot + */ +#define list_for_each_entry_rcu(pos, head, member, ...) \ + list_for_each_entry(pos, head, member) +#define list_del_rcu(entry) list_del(entry) +#define list_add_rcu(new, head) list_add(new, head) +#define list_add_tail_rcu(new, head) list_add_tail(new, head) + +#endif /* __LINUX_RCUPDATE_H */