diff mbox series

[net] s390/qeth: move netif_napi_add_tx() and napi_enable() from under BH

Message ID 20250212163659.2287292-1-wintera@linux.ibm.com (mailing list archive)
State Accepted
Commit 0d0b752f2497471ddd2b32143d167d42e18a8f3c
Delegated to: Netdev Maintainers
Headers show
Series [net] s390/qeth: move netif_napi_add_tx() and napi_enable() from under BH | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 13 of 13 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 19 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 7 this patch: 7
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2025-02-13--12-00 (tests: 889)

Commit Message

Alexandra Winter Feb. 12, 2025, 4:36 p.m. UTC
Like other drivers qeth is calling local_bh_enable() after napi_schedule()
to kick-start softirqs [0].
Since netif_napi_add_tx() and napi_enable() now take the netdev_lock()
mutex [1], move them out from under the BH protection. Same solution as in
commit a60558644e20 ("wifi: mt76: move napi_enable() from under BH")

Fixes: 1b23cdbd2bbc ("net: protect netdev->napi_list with netdev_lock()")
Link: https://lore.kernel.org/netdev/20240612181900.4d9d18d0@kernel.org/ [0]
Link: https://lore.kernel.org/netdev/20250115035319.559603-1-kuba@kernel.org/ [1]
Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
---
 drivers/s390/net/qeth_core_main.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

Comments

Joe Damato Feb. 12, 2025, 7:35 p.m. UTC | #1
On Wed, Feb 12, 2025 at 05:36:59PM +0100, Alexandra Winter wrote:
> Like other drivers qeth is calling local_bh_enable() after napi_schedule()
> to kick-start softirqs [0].
> Since netif_napi_add_tx() and napi_enable() now take the netdev_lock()
> mutex [1], move them out from under the BH protection. Same solution as in
> commit a60558644e20 ("wifi: mt76: move napi_enable() from under BH")
> 
> Fixes: 1b23cdbd2bbc ("net: protect netdev->napi_list with netdev_lock()")

Hm, I wonder if the fixes should be for commit 413f0271f396 ("net:
protect NAPI enablement with netdev_lock()") instead ?

> Link: https://lore.kernel.org/netdev/20240612181900.4d9d18d0@kernel.org/ [0]
> Link: https://lore.kernel.org/netdev/20250115035319.559603-1-kuba@kernel.org/ [1]
> Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
> ---
>  drivers/s390/net/qeth_core_main.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)

Other than the above, I briefly scanned the driver source and the
change seems reasonable.

I am not sure whether a different Fixes is needed or not (I'll leave
that to the maintainers to decide), but whether this is fine as is
or is re-posted with a new Fixes tag:

Acked-by: Joe Damato <jdamato@fastly.com>
Alexandra Winter Feb. 13, 2025, 7:37 a.m. UTC | #2
On 12.02.25 20:35, Joe Damato wrote:
> On Wed, Feb 12, 2025 at 05:36:59PM +0100, Alexandra Winter wrote:
>> Like other drivers qeth is calling local_bh_enable() after napi_schedule()
>> to kick-start softirqs [0].
>> Since netif_napi_add_tx() and napi_enable() now take the netdev_lock()
>> mutex [1], move them out from under the BH protection. Same solution as in
>> commit a60558644e20 ("wifi: mt76: move napi_enable() from under BH")
>>
>> Fixes: 1b23cdbd2bbc ("net: protect netdev->napi_list with netdev_lock()")
> Hm, I wonder if the fixes should be for commit 413f0271f396 ("net:
> protect NAPI enablement with netdev_lock()") instead ?


I was wondering about that too. netif_napi_add_tx() got  the lock in
1b23cdbd2bbc and napi_enable() got the lock in 413f0271f396.
I don't think I can have 2 Fixes tags, can I?
(And I don't think it makes sense to split these few lines up into 2 commits)
I chose 1b23cdbd2bbc because it is the earlier one.
patchwork-bot+netdevbpf@kernel.org Feb. 13, 2025, 5:40 p.m. UTC | #3
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 12 Feb 2025 17:36:59 +0100 you wrote:
> Like other drivers qeth is calling local_bh_enable() after napi_schedule()
> to kick-start softirqs [0].
> Since netif_napi_add_tx() and napi_enable() now take the netdev_lock()
> mutex [1], move them out from under the BH protection. Same solution as in
> commit a60558644e20 ("wifi: mt76: move napi_enable() from under BH")
> 
> Fixes: 1b23cdbd2bbc ("net: protect netdev->napi_list with netdev_lock()")
> Link: https://lore.kernel.org/netdev/20240612181900.4d9d18d0@kernel.org/ [0]
> Link: https://lore.kernel.org/netdev/20250115035319.559603-1-kuba@kernel.org/ [1]
> Signed-off-by: Alexandra Winter <wintera@linux.ibm.com>
> 
> [...]

Here is the summary with links:
  - [net] s390/qeth: move netif_napi_add_tx() and napi_enable() from under BH
    https://git.kernel.org/netdev/net/c/0d0b752f2497

You are awesome, thank you!
diff mbox series

Patch

diff --git a/drivers/s390/net/qeth_core_main.c b/drivers/s390/net/qeth_core_main.c
index a3adaec5504e..20328d695ef9 100644
--- a/drivers/s390/net/qeth_core_main.c
+++ b/drivers/s390/net/qeth_core_main.c
@@ -7050,14 +7050,16 @@  int qeth_open(struct net_device *dev)
 	card->data.state = CH_STATE_UP;
 	netif_tx_start_all_queues(dev);
 
-	local_bh_disable();
 	qeth_for_each_output_queue(card, queue, i) {
 		netif_napi_add_tx(dev, &queue->napi, qeth_tx_poll);
 		napi_enable(&queue->napi);
-		napi_schedule(&queue->napi);
 	}
-
 	napi_enable(&card->napi);
+
+	local_bh_disable();
+	qeth_for_each_output_queue(card, queue, i) {
+		napi_schedule(&queue->napi);
+	}
 	napi_schedule(&card->napi);
 	/* kick-start the NAPI softirq: */
 	local_bh_enable();