From: Larysa Zaremba <larysa.zaremba@intel.com>
To: intel-wired-lan@lists.osuosl.org,
Tony Nguyen <anthony.l.nguyen@intel.com>
Cc: aleksander.lobakin@intel.com, sridhar.samudrala@intel.com,
"Singhai, Anjali" <anjali.singhai@intel.com>,
Michal Swiatkowski <michal.swiatkowski@linux.intel.com>,
Larysa Zaremba <larysa.zaremba@intel.com>,
"Fijalkowski, Maciej" <maciej.fijalkowski@intel.com>,
Emil Tantilov <emil.s.tantilov@intel.com>,
Madhu Chittim <madhu.chittim@intel.com>,
Josh Hay <joshua.a.hay@intel.com>,
"Keller, Jacob E" <jacob.e.keller@intel.com>,
jayaprakash.shanmugam@intel.com, Jiri Pirko <jiri@resnulli.us>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>, Jonathan Corbet <corbet@lwn.net>,
Richard Cochran <richardcochran@gmail.com>,
Przemek Kitszel <przemyslaw.kitszel@intel.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
netdev@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [PATCH iwl-next v6 09/14] idpf: make mbx_task queueing and cancelling more consistent
Date: Mon, 23 Mar 2026 18:40:40 +0100 [thread overview]
Message-ID: <20260323174052.5355-10-larysa.zaremba@intel.com> (raw)
In-Reply-To: <20260323174052.5355-1-larysa.zaremba@intel.com>
As a consequence of refactoring idpf code to use libeth APIs,
idpf_vc_xn_shutdown was merged with and replaced by idpf_deinit_dflt_mbx.
This does not affect the Tx path, as it checked for a presence of an xn
manager anyway. Rx processing is handled by the mbx_task that is not always
cancelled before calling the new consolidated mailbox deinit function.
Moreover, in the reset path idpf_intr_rel() reschedules it after the deinit
is done. This leads to mbx_task referencing the freed mailbox and causing
KASAN warnings.
To remedy this, in the init path, do the first queueing of mbx_task in
idpf_init_dflt_mbx(), in deinit and reset, always cancel the task in
idpf_deinit_dflt_mbx() and in every flow first call idpf_mb_intr_rel_irq().
Reviewed-by: Emil Tantilov <emil.s.tantilov@intel.com>
Reviewed-by: Michal Kubiak <michal.kubiak@intel.com>
Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
Tested-by: Samuel Salin <Samuel.salin@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
---
drivers/net/ethernet/intel/idpf/idpf.h | 1 +
drivers/net/ethernet/intel/idpf/idpf_lib.c | 9 ++++-----
drivers/net/ethernet/intel/idpf/idpf_virtchnl.c | 6 +++++-
3 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/intel/idpf/idpf.h b/drivers/net/ethernet/intel/idpf/idpf.h
index b06640925fb9..9606c0de018f 100644
--- a/drivers/net/ethernet/intel/idpf/idpf.h
+++ b/drivers/net/ethernet/intel/idpf/idpf.h
@@ -984,6 +984,7 @@ void idpf_vc_event_task(struct work_struct *work);
void idpf_dev_ops_init(struct idpf_adapter *adapter);
void idpf_vf_dev_ops_init(struct idpf_adapter *adapter);
int idpf_intr_req(struct idpf_adapter *adapter);
+void idpf_mb_intr_rel_irq(struct idpf_adapter *adapter);
void idpf_intr_rel(struct idpf_adapter *adapter);
u16 idpf_get_max_tx_hdr_size(struct idpf_adapter *adapter);
int idpf_initiate_soft_reset(struct idpf_vport *vport,
diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c
index 0d131bf0993e..7988836fbae0 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_lib.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c
@@ -68,9 +68,11 @@ static void idpf_deinit_vector_stack(struct idpf_adapter *adapter)
* This will also disable interrupt mode and queue up mailbox task. Mailbox
* task will reschedule itself if not in interrupt mode.
*/
-static void idpf_mb_intr_rel_irq(struct idpf_adapter *adapter)
+void idpf_mb_intr_rel_irq(struct idpf_adapter *adapter)
{
- clear_bit(IDPF_MB_INTR_MODE, adapter->flags);
+ if (!test_and_clear_bit(IDPF_MB_INTR_MODE, adapter->flags))
+ return;
+
kfree(free_irq(adapter->msix_entries[0].vector, adapter));
queue_delayed_work(adapter->mbx_wq, &adapter->mbx_task, 0);
}
@@ -1938,14 +1940,11 @@ static void idpf_init_hard_reset(struct idpf_adapter *adapter)
goto unlock_mutex;
}
- queue_delayed_work(adapter->mbx_wq, &adapter->mbx_task, 0);
-
/* Initialize the state machine, also allocate memory and request
* resources
*/
err = idpf_vc_core_init(adapter);
if (err) {
- cancel_delayed_work_sync(&adapter->mbx_task);
idpf_deinit_dflt_mbx(adapter);
goto unlock_mutex;
}
diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
index 6d847aea00e4..38d119147ab6 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
@@ -2974,6 +2974,8 @@ int idpf_init_dflt_mbx(struct idpf_adapter *adapter)
adapter->xnm = params.xnm;
adapter->state = __IDPF_VER_CHECK;
+ queue_delayed_work(adapter->mbx_wq, &adapter->mbx_task, 0);
+
return 0;
}
@@ -2983,6 +2985,9 @@ int idpf_init_dflt_mbx(struct idpf_adapter *adapter)
*/
void idpf_deinit_dflt_mbx(struct idpf_adapter *adapter)
{
+ idpf_mb_intr_rel_irq(adapter);
+ cancel_delayed_work_sync(&adapter->mbx_task);
+
if (adapter->arq && adapter->asq) {
idpf_mb_clean(adapter, adapter->asq, true);
libie_ctlq_xn_deinit(adapter->xnm, &adapter->ctlq_ctx);
@@ -3237,7 +3242,6 @@ void idpf_vc_core_deinit(struct idpf_adapter *adapter)
idpf_deinit_dflt_mbx(adapter);
cancel_delayed_work_sync(&adapter->serv_task);
- cancel_delayed_work_sync(&adapter->mbx_task);
idpf_vport_params_buf_rel(adapter);
--
2.47.0
next prev parent reply other threads:[~2026-03-23 17:41 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-23 17:40 [PATCH iwl-next v6 00/14] Introduce iXD driver Larysa Zaremba
2026-03-23 17:40 ` [PATCH iwl-next v6 01/14] virtchnl: create 'include/linux/intel' and move necessary header files Larysa Zaremba
2026-03-24 7:52 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-23 17:40 ` [PATCH iwl-next v6 02/14] libie: add PCI device initialization helpers to libie Larysa Zaremba
2026-03-24 7:52 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-23 17:40 ` [PATCH iwl-next v6 03/14] libeth: allow to create fill queues without NAPI Larysa Zaremba
2026-03-24 7:53 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-23 17:40 ` [PATCH iwl-next v6 04/14] libie: add control queue support Larysa Zaremba
2026-03-24 7:54 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-23 17:40 ` [PATCH iwl-next v6 05/14] libie: add bookkeeping support for control queue messages Larysa Zaremba
2026-03-24 7:54 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-23 17:40 ` [PATCH iwl-next v6 06/14] idpf: remove 'vport_params_reqd' field Larysa Zaremba
2026-03-24 7:55 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-23 17:40 ` [PATCH iwl-next v6 07/14] idpf: refactor idpf to use libie_pci APIs Larysa Zaremba
2026-03-24 7:56 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-23 17:40 ` [PATCH iwl-next v6 08/14] idpf: refactor idpf to use libie control queues Larysa Zaremba
2026-03-23 18:58 ` [Intel-wired-lan] " Paul Menzel
2026-03-31 16:19 ` Salin, Samuel
2026-03-23 17:40 ` Larysa Zaremba [this message]
2026-03-24 7:57 ` [Intel-wired-lan] [PATCH iwl-next v6 09/14] idpf: make mbx_task queueing and cancelling more consistent Loktionov, Aleksandr
2026-03-23 17:40 ` [PATCH iwl-next v6 10/14] idpf: print a debug message and bail in case of non-event ctlq message Larysa Zaremba
2026-03-23 17:40 ` [PATCH iwl-next v6 11/14] ixd: add basic driver framework for Intel(R) Control Plane Function Larysa Zaremba
2026-03-24 7:58 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-23 17:40 ` [PATCH iwl-next v6 12/14] ixd: add reset checks and initialize the mailbox Larysa Zaremba
2026-03-23 17:40 ` [PATCH iwl-next v6 13/14] ixd: add the core initialization Larysa Zaremba
2026-03-24 7:59 ` [Intel-wired-lan] " Loktionov, Aleksandr
2026-03-23 17:40 ` [PATCH iwl-next v6 14/14] ixd: add devlink support Larysa Zaremba
2026-03-24 7:59 ` [Intel-wired-lan] " Loktionov, Aleksandr
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260323174052.5355-10-larysa.zaremba@intel.com \
--to=larysa.zaremba@intel.com \
--cc=aleksander.lobakin@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anjali.singhai@intel.com \
--cc=anthony.l.nguyen@intel.com \
--cc=corbet@lwn.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=emil.s.tantilov@intel.com \
--cc=horms@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jacob.e.keller@intel.com \
--cc=jayaprakash.shanmugam@intel.com \
--cc=jiri@resnulli.us \
--cc=joshua.a.hay@intel.com \
--cc=kuba@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maciej.fijalkowski@intel.com \
--cc=madhu.chittim@intel.com \
--cc=michal.swiatkowski@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=richardcochran@gmail.com \
--cc=sridhar.samudrala@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox