[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240807065424.74dad331@kernel.org>
Date: Wed, 7 Aug 2024 06:54:24 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Breno Leitao <leitao@...ian.org>
Cc: davem@...emloft.net, edumazet@...gle.com, pabeni@...hat.com,
thevlad@...com, thepacketgeek@...il.com, riel@...riel.com,
horms@...nel.org, netdev@...r.kernel.org, linux-kernel@...r.kernel.org,
paulmck@...nel.org, davej@...emonkey.org.uk
Subject: Re: [PATCH net-next v2 5/5] net: netconsole: Defer netpoll cleanup
to avoid lock release during list traversal
On Wed, 7 Aug 2024 02:16:51 -0700 Breno Leitao wrote:
> Current issue:
> - The `target_list_lock` spinlock is held while iterating over
> target_list() entries.
> - Mid-loop, the lock is released to call __netpoll_cleanup(), then
> reacquired.
> - This practice compromises the protection provided by
> `target_list_lock`.
>
> Reason for current design:
> 1. __netpoll_cleanup() may sleep, incompatible with holding a spinlock.
> 2. target_list_lock must be a spinlock because write_msg() cannot sleep.
> (See commit b5427c27173e ("[NET] netconsole: Support multiple logging
> targets"))
>
> Defer the cleanup of the netpoll structure to outside the
> target_list_lock() protected area. Create another list
> (target_cleanup_list) to hold the entries that need to be cleaned up,
> and clean them using a mutex (target_cleanup_list_lock).
Haven't looked closely but in the configs CI uses this breaks the build:
drivers/net/netconsole.c:251:13: error: ‘netconsole_process_cleanups’ defined but not used [-Werror=unused-function]
251 | static void netconsole_process_cleanups(void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~
--
pw-bot: cr
Powered by blists - more mailing lists