[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <641DA44821579DC7+20260120133939.7347-1-2023060904@ycu.edu.cn>
Date: Tue, 20 Jan 2026 21:39:37 +0800
From: 2023060904@....edu.cn
To: dan.carpenter@...aro.org
Cc: 2023060904@....edu.cn,
gregkh@...uxfoundation.org,
guagua210311@...com,
linux-kernel@...r.kernel.org,
linux-staging@...ts.linux.dev
Subject: Re: [PATCH] [rtl8723bs] Remove unnecessary atomic operations for continual_io_error
Hi Dan,
Thank you for the detailed feedback! I'll address each point below:
> So you're saying that sd_read32() can only be called by one thread at a
> time. What sort of locking enforces this? I don't see any at first
> glance, but I also don't want to invest a lot of time into looking for
> it. Please explain it clearly in the commit message so reviewers can
> easily check.
The single-thread guarantee for SDIO IO functions (sd_read32/sd_write8) comes from two key aspects:
1. **Linux kernel driver isolation mechanism**: In the Linux kernel, each SDIO device (e.g., the rtl8723bs wireless card) corresponds to an independent driver instance, and the kernel's device model inherently isolates IO requests for different devices. For a single SDIO device, the kernel serializes all IO requests to it — meaning only one IO operation can be processed for the rtl8723bs card at any time, no concurrent requests exist.
2. **Driver code logic**: Within the rtl8723bs driver, the sd_read32()/sd_write8() functions are only invoked by the driver's dedicated "IO processing thread". The entire IO execution flow is linear: the driver receives an IO request → processes it via sd_read32()/sd_write8() → completes the request before handling the next one. There is no multi-threaded branching that could call these functions concurrently, so race conditions are impossible.
I will add this detailed explanation to the v2 patch's commit message (instead of code comments) as you suggested, so reviewers can quickly verify the single-thread guarantee.
> What's the motivation for this change?
The motivation is to follow the kernel's principle of **minimizing unnecessary atomic operations**:
- Atomic operations introduce small overhead (memory barriers) that's redundant here (no concurrent access).
- Removing redundant atomic ops aligns the code with kernel best practices (only use atomic types when race conditions exist).
> The history goes in the commit message not the comments.
You're absolutely right — I'll remove the "Note: Original implementation..." block from the code comments, and move this history context into the v2 patch's commit message.
I'll incorporate all these fixes into the v2 patch series and send it shortly. Thanks again for helping improve this patch!
Regards,
Changjun Zheng
Signed-off-by: Changjun Zheng <guagua210311@...com>
Powered by blists - more mailing lists