* [PATCH iwl-net v2 1/3] idpf: fix PREEMPT_RT raw/bh spinlock nesting for async VC handling [not found] <20260319211335.23236-1-emil.s.tantilov@intel.com> @ 2026-03-19 21:13 ` Emil Tantilov 2026-03-20 7:23 ` Loktionov, Aleksandr 2026-03-19 21:13 ` [PATCH iwl-net v2 2/3] idpf: improve locking around idpf_vc_xn_push_free() Emil Tantilov 2026-03-19 21:13 ` [PATCH iwl-net v2 3/3] idpf: set the payload size before calling the async handler Emil Tantilov 2 siblings, 1 reply; 7+ messages in thread From: Emil Tantilov @ 2026-03-19 21:13 UTC (permalink / raw) To: intel-wired-lan Cc: netdev, anthony.l.nguyen, aleksandr.loktionov, przemyslaw.kitszel, andrew+netdev, davem, edumazet, kuba, pabeni, bigeasy, clrkwllms, rostedt, linux-rt-devel, sgzhang, boolli, Emil Tantilov, stable Switch from using the completion's raw spinlock to a local lock in the idpf_vc_xn struct. The conversion is safe because complete/_all() are called outside the lock and there is no reason to share the completion lock in the current logic. This avoids invalid wait context reported by the kernel due to the async handler taking BH spinlock: [ 805.726977] ============================= [ 805.726991] [ BUG: Invalid wait context ] [ 805.727006] 7.0.0-rc2-net-devq-031026+ #28 Tainted: G S OE [ 805.727026] ----------------------------- [ 805.727038] kworker/u261:0/572 is trying to lock: [ 805.727051] ff190da6a8dbb6a0 (&vport_config->mac_filter_list_lock){+...}-{3:3}, at: idpf_mac_filter_async_handler+0xe9/0x260 [idpf] [ 805.727099] other info that might help us debug this: [ 805.727111] context-{5:5} [ 805.727119] 3 locks held by kworker/u261:0/572: [ 805.727132] #0: ff190da6db3e6148 ((wq_completion)idpf-0000:83:00.0-mbx){+.+.}-{0:0}, at: process_one_work+0x4b5/0x730 [ 805.727163] #1: ff3c6f0a6131fe50 ((work_completion)(&(&adapter->mbx_task)->work)){+.+.}-{0:0}, at: process_one_work+0x1e5/0x730 [ 805.727191] #2: ff190da765190020 (&x->wait#34){+.+.}-{2:2}, at: idpf_recv_mb_msg+0xc8/0x710 [idpf] [ 805.727218] stack backtrace: ... [ 805.727238] Workqueue: idpf-0000:83:00.0-mbx idpf_mbx_task [idpf] [ 805.727247] Call Trace: [ 805.727249] <TASK> [ 805.727251] dump_stack_lvl+0x77/0xb0 [ 805.727259] __lock_acquire+0xb3b/0x2290 [ 805.727268] ? __irq_work_queue_local+0x59/0x130 [ 805.727275] lock_acquire+0xc6/0x2f0 [ 805.727277] ? idpf_mac_filter_async_handler+0xe9/0x260 [idpf] [ 805.727284] ? _printk+0x5b/0x80 [ 805.727290] _raw_spin_lock_bh+0x38/0x50 [ 805.727298] ? idpf_mac_filter_async_handler+0xe9/0x260 [idpf] [ 805.727303] idpf_mac_filter_async_handler+0xe9/0x260 [idpf] [ 805.727310] idpf_recv_mb_msg+0x1c8/0x710 [idpf] [ 805.727317] process_one_work+0x226/0x730 [ 805.727322] worker_thread+0x19e/0x340 [ 805.727325] ? __pfx_worker_thread+0x10/0x10 [ 805.727328] kthread+0xf4/0x130 [ 805.727333] ? __pfx_kthread+0x10/0x10 [ 805.727336] ret_from_fork+0x32c/0x410 [ 805.727345] ? __pfx_kthread+0x10/0x10 [ 805.727347] ret_from_fork_asm+0x1a/0x30 [ 805.727354] </TASK> Fixes: 34c21fa894a1 ("idpf: implement virtchnl transaction manager") Cc: stable@vger.kernel.org Suggested-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Reported-by: Ray Zhang <sgzhang@google.com> Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com> --- drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 14 +++++--------- drivers/net/ethernet/intel/idpf/idpf_virtchnl.h | 5 +++-- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c index 113ecfc16dd7..582e0c8e9dc0 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c @@ -287,26 +287,21 @@ int idpf_send_mb_msg(struct idpf_adapter *adapter, struct idpf_ctlq_info *asq, return err; } -/* API for virtchnl "transaction" support ("xn" for short). - * - * We are reusing the completion lock to serialize the accesses to the - * transaction state for simplicity, but it could be its own separate synchro - * as well. For now, this API is only used from within a workqueue context; - * raw_spin_lock() is enough. - */ +/* API for virtchnl "transaction" support ("xn" for short). */ + /** * idpf_vc_xn_lock - Request exclusive access to vc transaction * @xn: struct idpf_vc_xn* to access */ #define idpf_vc_xn_lock(xn) \ - raw_spin_lock(&(xn)->completed.wait.lock) + spin_lock(&(xn)->lock) /** * idpf_vc_xn_unlock - Release exclusive access to vc transaction * @xn: struct idpf_vc_xn* to access */ #define idpf_vc_xn_unlock(xn) \ - raw_spin_unlock(&(xn)->completed.wait.lock) + spin_unlock(&(xn)->lock) /** * idpf_vc_xn_release_bufs - Release reference to reply buffer(s) and @@ -338,6 +333,7 @@ static void idpf_vc_xn_init(struct idpf_vc_xn_manager *vcxn_mngr) xn->state = IDPF_VC_XN_IDLE; xn->idx = i; idpf_vc_xn_release_bufs(xn); + spin_lock_init(&xn->lock); init_completion(&xn->completed); } diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.h b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.h index fe065911ad5a..6876e3ed9d1b 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.h +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.h @@ -42,8 +42,8 @@ typedef int (*async_vc_cb) (struct idpf_adapter *, struct idpf_vc_xn *, * struct idpf_vc_xn - Data structure representing virtchnl transactions * @completed: virtchnl event loop uses that to signal when a reply is * available, uses kernel completion API - * @state: virtchnl event loop stores the data below, protected by the - * completion's lock. + * @lock: protects the transaction state fields below + * @state: virtchnl event loop stores the data below, protected by @lock * @reply_sz: Original size of reply, may be > reply_buf.iov_len; it will be * truncated on its way to the receiver thread according to * reply_buf.iov_len. @@ -58,6 +58,7 @@ typedef int (*async_vc_cb) (struct idpf_adapter *, struct idpf_vc_xn *, */ struct idpf_vc_xn { struct completion completed; + spinlock_t lock; enum idpf_vc_xn_state state; size_t reply_sz; struct kvec reply; -- 2.37.3 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* RE: [PATCH iwl-net v2 1/3] idpf: fix PREEMPT_RT raw/bh spinlock nesting for async VC handling 2026-03-19 21:13 ` [PATCH iwl-net v2 1/3] idpf: fix PREEMPT_RT raw/bh spinlock nesting for async VC handling Emil Tantilov @ 2026-03-20 7:23 ` Loktionov, Aleksandr 0 siblings, 0 replies; 7+ messages in thread From: Loktionov, Aleksandr @ 2026-03-20 7:23 UTC (permalink / raw) To: Tantilov, Emil S, intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, Nguyen, Anthony L, Kitszel, Przemyslaw, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, bigeasy@linutronix.de, clrkwllms@kernel.org, rostedt@goodmis.org, linux-rt-devel@lists.linux.dev, sgzhang@google.com, boolli@google.com, stable@vger.kernel.org > -----Original Message----- > From: Tantilov, Emil S <emil.s.tantilov@intel.com> > Sent: Thursday, March 19, 2026 10:14 PM > To: intel-wired-lan@lists.osuosl.org > Cc: netdev@vger.kernel.org; Nguyen, Anthony L > <anthony.l.nguyen@intel.com>; Loktionov, Aleksandr > <aleksandr.loktionov@intel.com>; Kitszel, Przemyslaw > <przemyslaw.kitszel@intel.com>; andrew+netdev@lunn.ch; > davem@davemloft.net; edumazet@google.com; kuba@kernel.org; > pabeni@redhat.com; bigeasy@linutronix.de; clrkwllms@kernel.org; > rostedt@goodmis.org; linux-rt-devel@lists.linux.dev; > sgzhang@google.com; boolli@google.com; Tantilov, Emil S > <emil.s.tantilov@intel.com>; stable@vger.kernel.org > Subject: [PATCH iwl-net v2 1/3] idpf: fix PREEMPT_RT raw/bh spinlock > nesting for async VC handling > > Switch from using the completion's raw spinlock to a local lock in the > idpf_vc_xn struct. The conversion is safe because complete/_all() are > called outside the lock and there is no reason to share the completion > lock in the current logic. This avoids invalid wait context reported > by the kernel due to the async handler taking BH spinlock: > > [ 805.726977] ============================= [ 805.726991] [ BUG: > Invalid wait context ] > [ 805.727006] 7.0.0-rc2-net-devq-031026+ #28 Tainted: G S OE > [ 805.727026] ----------------------------- [ 805.727038] > kworker/u261:0/572 is trying to lock: > [ 805.727051] ff190da6a8dbb6a0 (&vport_config- > >mac_filter_list_lock){+...}-{3:3}, at: > idpf_mac_filter_async_handler+0xe9/0x260 [idpf] [ 805.727099] other > info that might help us debug this: > [ 805.727111] context-{5:5} > [ 805.727119] 3 locks held by kworker/u261:0/572: > [ 805.727132] #0: ff190da6db3e6148 ((wq_completion)idpf- > 0000:83:00.0-mbx){+.+.}-{0:0}, at: process_one_work+0x4b5/0x730 [ > 805.727163] #1: ff3c6f0a6131fe50 ((work_completion)(&(&adapter- > >mbx_task)->work)){+.+.}-{0:0}, at: process_one_work+0x1e5/0x730 [ > 805.727191] #2: ff190da765190020 (&x->wait#34){+.+.}-{2:2}, at: > idpf_recv_mb_msg+0xc8/0x710 [idpf] [ 805.727218] stack backtrace: > ... > [ 805.727238] Workqueue: idpf-0000:83:00.0-mbx idpf_mbx_task [idpf] [ > 805.727247] Call Trace: > [ 805.727249] <TASK> > [ 805.727251] dump_stack_lvl+0x77/0xb0 [ 805.727259] > __lock_acquire+0xb3b/0x2290 [ 805.727268] ? > __irq_work_queue_local+0x59/0x130 [ 805.727275] > lock_acquire+0xc6/0x2f0 [ 805.727277] ? > idpf_mac_filter_async_handler+0xe9/0x260 [idpf] [ 805.727284] ? > _printk+0x5b/0x80 [ 805.727290] _raw_spin_lock_bh+0x38/0x50 [ > 805.727298] ? idpf_mac_filter_async_handler+0xe9/0x260 [idpf] [ > 805.727303] idpf_mac_filter_async_handler+0xe9/0x260 [idpf] [ > 805.727310] idpf_recv_mb_msg+0x1c8/0x710 [idpf] [ 805.727317] > process_one_work+0x226/0x730 [ 805.727322] worker_thread+0x19e/0x340 > [ 805.727325] ? __pfx_worker_thread+0x10/0x10 [ 805.727328] > kthread+0xf4/0x130 [ 805.727333] ? __pfx_kthread+0x10/0x10 [ > 805.727336] ret_from_fork+0x32c/0x410 [ 805.727345] ? > __pfx_kthread+0x10/0x10 [ 805.727347] ret_from_fork_asm+0x1a/0x30 [ > 805.727354] </TASK> > > Fixes: 34c21fa894a1 ("idpf: implement virtchnl transaction manager") > Cc: stable@vger.kernel.org > Suggested-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> > Reported-by: Ray Zhang <sgzhang@google.com> > Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com> > --- > drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 14 +++++--------- > drivers/net/ethernet/intel/idpf/idpf_virtchnl.h | 5 +++-- > 2 files changed, 8 insertions(+), 11 deletions(-) > > diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c > b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c > index 113ecfc16dd7..582e0c8e9dc0 100644 > --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c > +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c > @@ -287,26 +287,21 @@ int idpf_send_mb_msg(struct idpf_adapter > *adapter, struct idpf_ctlq_info *asq, > return err; > } > > -/* API for virtchnl "transaction" support ("xn" for short). > - * > - * We are reusing the completion lock to serialize the accesses to > the > - * transaction state for simplicity, but it could be its own separate > synchro > - * as well. For now, this API is only used from within a workqueue > context; > - * raw_spin_lock() is enough. > - */ > +/* API for virtchnl "transaction" support ("xn" for short). */ > + > /** > * idpf_vc_xn_lock - Request exclusive access to vc transaction > * @xn: struct idpf_vc_xn* to access > */ > #define idpf_vc_xn_lock(xn) \ > - raw_spin_lock(&(xn)->completed.wait.lock) > + spin_lock(&(xn)->lock) > > /** > * idpf_vc_xn_unlock - Release exclusive access to vc transaction > * @xn: struct idpf_vc_xn* to access > */ > #define idpf_vc_xn_unlock(xn) \ > - raw_spin_unlock(&(xn)->completed.wait.lock) > + spin_unlock(&(xn)->lock) > > /** > * idpf_vc_xn_release_bufs - Release reference to reply buffer(s) and > @@ -338,6 +333,7 @@ static void idpf_vc_xn_init(struct > idpf_vc_xn_manager *vcxn_mngr) > xn->state = IDPF_VC_XN_IDLE; > xn->idx = i; > idpf_vc_xn_release_bufs(xn); > + spin_lock_init(&xn->lock); > init_completion(&xn->completed); > } > > diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.h > b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.h > index fe065911ad5a..6876e3ed9d1b 100644 > --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.h > +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.h > @@ -42,8 +42,8 @@ typedef int (*async_vc_cb) (struct idpf_adapter *, > struct idpf_vc_xn *, > * struct idpf_vc_xn - Data structure representing virtchnl > transactions > * @completed: virtchnl event loop uses that to signal when a reply > is > * available, uses kernel completion API > - * @state: virtchnl event loop stores the data below, protected by > the > - * completion's lock. > + * @lock: protects the transaction state fields below > + * @state: virtchnl event loop stores the data below, protected by > + @lock > * @reply_sz: Original size of reply, may be > reply_buf.iov_len; it > will be > * truncated on its way to the receiver thread according to > * reply_buf.iov_len. > @@ -58,6 +58,7 @@ typedef int (*async_vc_cb) (struct idpf_adapter *, > struct idpf_vc_xn *, > */ > struct idpf_vc_xn { > struct completion completed; > + spinlock_t lock; > enum idpf_vc_xn_state state; > size_t reply_sz; > struct kvec reply; > -- > 2.37.3 Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH iwl-net v2 2/3] idpf: improve locking around idpf_vc_xn_push_free() [not found] <20260319211335.23236-1-emil.s.tantilov@intel.com> 2026-03-19 21:13 ` [PATCH iwl-net v2 1/3] idpf: fix PREEMPT_RT raw/bh spinlock nesting for async VC handling Emil Tantilov @ 2026-03-19 21:13 ` Emil Tantilov 2026-03-20 7:23 ` Loktionov, Aleksandr 2026-03-20 7:42 ` Sebastian Andrzej Siewior 2026-03-19 21:13 ` [PATCH iwl-net v2 3/3] idpf: set the payload size before calling the async handler Emil Tantilov 2 siblings, 2 replies; 7+ messages in thread From: Emil Tantilov @ 2026-03-19 21:13 UTC (permalink / raw) To: intel-wired-lan Cc: netdev, anthony.l.nguyen, aleksandr.loktionov, przemyslaw.kitszel, andrew+netdev, davem, edumazet, kuba, pabeni, bigeasy, clrkwllms, rostedt, linux-rt-devel, sgzhang, boolli, Emil Tantilov, stable Protect the set_bit() operation for the free_xn bitmask in idpf_vc_xn_push_free(), to make the locking consistent with rest of the code and avoid potential races in that logic. Fixes: 34c21fa894a1 ("idpf: implement virtchnl transaction manager") Cc: stable@vger.kernel.org Reported-by: Ray Zhang <sgzhang@google.com> Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com> --- drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c index 582e0c8e9dc0..fbd5a15b015c 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c @@ -402,7 +402,9 @@ static void idpf_vc_xn_push_free(struct idpf_vc_xn_manager *vcxn_mngr, struct idpf_vc_xn *xn) { idpf_vc_xn_release_bufs(xn); + spin_lock_bh(&vcxn_mngr->xn_bm_lock); set_bit(xn->idx, vcxn_mngr->free_xn_bm); + spin_unlock_bh(&vcxn_mngr->xn_bm_lock); } /** -- 2.37.3 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* RE: [PATCH iwl-net v2 2/3] idpf: improve locking around idpf_vc_xn_push_free() 2026-03-19 21:13 ` [PATCH iwl-net v2 2/3] idpf: improve locking around idpf_vc_xn_push_free() Emil Tantilov @ 2026-03-20 7:23 ` Loktionov, Aleksandr 2026-03-20 7:42 ` Sebastian Andrzej Siewior 1 sibling, 0 replies; 7+ messages in thread From: Loktionov, Aleksandr @ 2026-03-20 7:23 UTC (permalink / raw) To: Tantilov, Emil S, intel-wired-lan@lists.osuosl.org Cc: netdev@vger.kernel.org, Nguyen, Anthony L, Kitszel, Przemyslaw, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, bigeasy@linutronix.de, clrkwllms@kernel.org, rostedt@goodmis.org, linux-rt-devel@lists.linux.dev, sgzhang@google.com, boolli@google.com, stable@vger.kernel.org > -----Original Message----- > From: Tantilov, Emil S <emil.s.tantilov@intel.com> > Sent: Thursday, March 19, 2026 10:14 PM > To: intel-wired-lan@lists.osuosl.org > Cc: netdev@vger.kernel.org; Nguyen, Anthony L > <anthony.l.nguyen@intel.com>; Loktionov, Aleksandr > <aleksandr.loktionov@intel.com>; Kitszel, Przemyslaw > <przemyslaw.kitszel@intel.com>; andrew+netdev@lunn.ch; > davem@davemloft.net; edumazet@google.com; kuba@kernel.org; > pabeni@redhat.com; bigeasy@linutronix.de; clrkwllms@kernel.org; > rostedt@goodmis.org; linux-rt-devel@lists.linux.dev; > sgzhang@google.com; boolli@google.com; Tantilov, Emil S > <emil.s.tantilov@intel.com>; stable@vger.kernel.org > Subject: [PATCH iwl-net v2 2/3] idpf: improve locking around > idpf_vc_xn_push_free() > > Protect the set_bit() operation for the free_xn bitmask in > idpf_vc_xn_push_free(), to make the locking consistent with rest of > the code and avoid potential races in that logic. > > Fixes: 34c21fa894a1 ("idpf: implement virtchnl transaction manager") > Cc: stable@vger.kernel.org > Reported-by: Ray Zhang <sgzhang@google.com> > Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com> > --- > drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c > b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c > index 582e0c8e9dc0..fbd5a15b015c 100644 > --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c > +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c > @@ -402,7 +402,9 @@ static void idpf_vc_xn_push_free(struct > idpf_vc_xn_manager *vcxn_mngr, > struct idpf_vc_xn *xn) > { > idpf_vc_xn_release_bufs(xn); > + spin_lock_bh(&vcxn_mngr->xn_bm_lock); > set_bit(xn->idx, vcxn_mngr->free_xn_bm); > + spin_unlock_bh(&vcxn_mngr->xn_bm_lock); > } > > /** > -- > 2.37.3 Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH iwl-net v2 2/3] idpf: improve locking around idpf_vc_xn_push_free() 2026-03-19 21:13 ` [PATCH iwl-net v2 2/3] idpf: improve locking around idpf_vc_xn_push_free() Emil Tantilov 2026-03-20 7:23 ` Loktionov, Aleksandr @ 2026-03-20 7:42 ` Sebastian Andrzej Siewior 2026-03-23 16:20 ` Tantilov, Emil S 1 sibling, 1 reply; 7+ messages in thread From: Sebastian Andrzej Siewior @ 2026-03-20 7:42 UTC (permalink / raw) To: Emil Tantilov Cc: intel-wired-lan, netdev, anthony.l.nguyen, aleksandr.loktionov, przemyslaw.kitszel, andrew+netdev, davem, edumazet, kuba, pabeni, clrkwllms, rostedt, linux-rt-devel, sgzhang, boolli, stable On 2026-03-19 14:13:34 [-0700], Emil Tantilov wrote: > drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c > index 582e0c8e9dc0..fbd5a15b015c 100644 > --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c > +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c > @@ -402,7 +402,9 @@ static void idpf_vc_xn_push_free(struct idpf_vc_xn_manager *vcxn_mngr, > struct idpf_vc_xn *xn) > { > idpf_vc_xn_release_bufs(xn); > + spin_lock_bh(&vcxn_mngr->xn_bm_lock); > set_bit(xn->idx, vcxn_mngr->free_xn_bm); If all of your bit manipulations happen under the same lock you could replace atomic set_bit()/ clear_bit() with their non-atomic counter parts __set_bit()/ __clear_bit(). The lockless alternative would be find_first_bit() + test_and_set_bit() loop. Probably another atomic op for salt. Using the __ is free with this change. > + spin_unlock_bh(&vcxn_mngr->xn_bm_lock); > } Sebastian ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH iwl-net v2 2/3] idpf: improve locking around idpf_vc_xn_push_free() 2026-03-20 7:42 ` Sebastian Andrzej Siewior @ 2026-03-23 16:20 ` Tantilov, Emil S 0 siblings, 0 replies; 7+ messages in thread From: Tantilov, Emil S @ 2026-03-23 16:20 UTC (permalink / raw) To: Sebastian Andrzej Siewior Cc: intel-wired-lan, netdev, anthony.l.nguyen, aleksandr.loktionov, przemyslaw.kitszel, andrew+netdev, davem, edumazet, kuba, pabeni, clrkwllms, rostedt, linux-rt-devel, sgzhang, boolli, stable On 3/20/2026 12:42 AM, Sebastian Andrzej Siewior wrote: > On 2026-03-19 14:13:34 [-0700], Emil Tantilov wrote: >> drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 2 ++ >> 1 file changed, 2 insertions(+) >> >> diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c >> index 582e0c8e9dc0..fbd5a15b015c 100644 >> --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c >> +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c >> @@ -402,7 +402,9 @@ static void idpf_vc_xn_push_free(struct idpf_vc_xn_manager *vcxn_mngr, >> struct idpf_vc_xn *xn) >> { >> idpf_vc_xn_release_bufs(xn); >> + spin_lock_bh(&vcxn_mngr->xn_bm_lock); >> set_bit(xn->idx, vcxn_mngr->free_xn_bm); > > If all of your bit manipulations happen under the same lock you could > replace atomic set_bit()/ clear_bit() with their non-atomic counter > parts __set_bit()/ __clear_bit(). We have taken similar approach in the refactor/move to libie: https://lore.kernel.org/netdev/20251117134912.18566-7-larysa.zaremba@intel.com/ Thanks, Emil > > The lockless alternative would be find_first_bit() + > test_and_set_bit() loop. Probably another atomic op for salt. Using the > __ is free with this change. > >> + spin_unlock_bh(&vcxn_mngr->xn_bm_lock); >> } > > Sebastian ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH iwl-net v2 3/3] idpf: set the payload size before calling the async handler [not found] <20260319211335.23236-1-emil.s.tantilov@intel.com> 2026-03-19 21:13 ` [PATCH iwl-net v2 1/3] idpf: fix PREEMPT_RT raw/bh spinlock nesting for async VC handling Emil Tantilov 2026-03-19 21:13 ` [PATCH iwl-net v2 2/3] idpf: improve locking around idpf_vc_xn_push_free() Emil Tantilov @ 2026-03-19 21:13 ` Emil Tantilov 2 siblings, 0 replies; 7+ messages in thread From: Emil Tantilov @ 2026-03-19 21:13 UTC (permalink / raw) To: intel-wired-lan Cc: netdev, anthony.l.nguyen, aleksandr.loktionov, przemyslaw.kitszel, andrew+netdev, davem, edumazet, kuba, pabeni, bigeasy, clrkwllms, rostedt, linux-rt-devel, sgzhang, boolli, Emil Tantilov, stable Set the payload size before forwarding the reply to the async handler. Without this, xn->reply_sz will be 0 and idpf_mac_filter_async_handler() will never get past the size check. Fixes: 34c21fa894a1 ("idpf: implement virtchnl transaction manager") Cc: stable@vger.kernel.org Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com> Reviewed-by: Aleksandr Loktionov <aleksandr.loktionov@intel.com> Reviewed-by: Li Li <boolli@google.com> --- drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c index fbd5a15b015c..be66f9b2e101 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c +++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c @@ -615,6 +615,10 @@ idpf_vc_xn_forward_reply(struct idpf_adapter *adapter, err = -ENXIO; goto out_unlock; case IDPF_VC_XN_ASYNC: + /* Set reply_sz from the actual payload so that async_handler + * can evaluate the response. + */ + xn->reply_sz = ctlq_msg->data_len; err = idpf_vc_xn_forward_async(adapter, xn, ctlq_msg); idpf_vc_xn_unlock(xn); return err; -- 2.37.3 ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-03-23 16:20 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260319211335.23236-1-emil.s.tantilov@intel.com>
2026-03-19 21:13 ` [PATCH iwl-net v2 1/3] idpf: fix PREEMPT_RT raw/bh spinlock nesting for async VC handling Emil Tantilov
2026-03-20 7:23 ` Loktionov, Aleksandr
2026-03-19 21:13 ` [PATCH iwl-net v2 2/3] idpf: improve locking around idpf_vc_xn_push_free() Emil Tantilov
2026-03-20 7:23 ` Loktionov, Aleksandr
2026-03-20 7:42 ` Sebastian Andrzej Siewior
2026-03-23 16:20 ` Tantilov, Emil S
2026-03-19 21:13 ` [PATCH iwl-net v2 3/3] idpf: set the payload size before calling the async handler Emil Tantilov
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox