RE: [Intel-wired-lan] [PATCH iwl-net 2/4] igb: introduce raw vfs_lock to igb_adapter
From: Romanowski, Rafal
Date: Tue Jan 07 2025 - 05:08:41 EST
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@xxxxxxxxxx> On Behalf Of
> Wander Lairson Costa
> Sent: Wednesday, December 4, 2024 12:42 PM
> To: Nguyen, Anthony L <anthony.l.nguyen@xxxxxxxxx>; Kitszel, Przemyslaw
> <przemyslaw.kitszel@xxxxxxxxx>; Andrew Lunn <andrew+netdev@xxxxxxx>;
> David S. Miller <davem@xxxxxxxxxxxxx>; Eric Dumazet
> <edumazet@xxxxxxxxxx>; Jakub Kicinski <kuba@xxxxxxxxxx>; Paolo Abeni
> <pabeni@xxxxxxxxxx>; Sebastian Andrzej Siewior <bigeasy@xxxxxxxxxxxxx>; Clark
> Williams <clrkwllms@xxxxxxxxxx>; Steven Rostedt <rostedt@xxxxxxxxxxx>; Jeff
> Garzik <jgarzik@xxxxxxxxxx>; Auke Kok <auke-jan.h.kok@xxxxxxxxx>; moderated
> list:INTEL ETHERNET DRIVERS <intel-wired-lan@xxxxxxxxxxxxxxxx>; open
> list:NETWORKING DRIVERS <netdev@xxxxxxxxxxxxxxx>; open list <linux-
> kernel@xxxxxxxxxxxxxxx>; open list:Real-time Linux
> (PREEMPT_RT):Keyword:PREEMPT_RT <linux-rt-devel@xxxxxxxxxxxxxxx>
> Cc: Wander Lairson Costa <wander@xxxxxxxxxx>; Clark Williams
> <williams@xxxxxxxxxx>
> Subject: [Intel-wired-lan] [PATCH iwl-net 2/4] igb: introduce raw vfs_lock to
> igb_adapter
>
> This change adds a raw_spinlock for the vfs_lock to the igb_adapter structure,
> enabling its use in both interrupt and preemptible contexts. This is essential for
> upcoming modifications to split igb_msg_task() into interrupt-safe and
> preemptible-safe parts.
>
> The motivation for this change stems from the need to modify
> igb_msix_other() to run in interrupt context under PREEMPT_RT.
> Currently, igb_msg_task() contains a code path that invokes
> kcalloc() with the GFP_ATOMIC flag. However, on PREEMPT_RT, GFP_ATOMIC is
> not honored, making it unsafe to call allocation functions in interrupt context. By
> introducing this raw spinlock, we can safely acquire the lock in both contexts,
> paving the way for the necessary restructuring of igb_msg_task().
>
> Signed-off-by: Wander Lairson Costa <wander@xxxxxxxxxx>
> Suggested-by: Clark Williams <williams@xxxxxxxxxx>
> ---
> drivers/net/ethernet/intel/igb/igb.h | 4 ++
> drivers/net/ethernet/intel/igb/igb_main.c | 51 ++++++++++++++++++++---
> 2 files changed, 50 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/igb/igb.h
> b/drivers/net/ethernet/intel/igb/igb.h
> index 3c2dc7bdebb50..d50c22f09d0f8 100644
> --- a/drivers/net/ethernet/intel/igb/igb.h
> +++ b/drivers/net/ethernet/intel/igb/igb.h
> @@ -666,6 +666,10 @@ struct igb_adapter {
Tested-by: Rafal Romanowski <rafal.romanowski@xxxxxxxxx>