From: "Chittim, Madhu" <madhu.chittim@intel.com>
To: "Tantilov, Emil S" <emil.s.tantilov@intel.com>,
"intel-wired-lan@lists.osuosl.org"
<intel-wired-lan@lists.osuosl.org>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"Loktionov, Aleksandr" <Aleksandr.Loktionov@intel.com>,
"Kitszel, Przemyslaw" <przemyslaw.kitszel@intel.com>,
"Nguyen, Anthony L" <anthony.l.nguyen@intel.com>,
"andrew+netdev@lunn.ch" <andrew+netdev@lunn.ch>,
"davem@davemloft.net" <davem@davemloft.net>,
"edumazet@google.com" <edumazet@google.com>,
"kuba@kernel.org" <kuba@kernel.org>,
"pabeni@redhat.com" <pabeni@redhat.com>,
"decot@google.com" <decot@google.com>,
"willemb@google.com" <willemb@google.com>,
"Hay, Joshua A" <joshua.a.hay@intel.com>,
"Lobakin, Aleksander" <aleksander.lobakin@intel.com>,
"Zaremba, Larysa" <larysa.zaremba@intel.com>,
"iamvivekkumar@google.com" <iamvivekkumar@google.com>
Subject: Re: [Intel-wired-lan] [PATCH iwl-net v2 5/5] idpf: fix error handling in the init_task on load
Date: Mon, 1 Dec 2025 13:44:01 -0800 [thread overview]
Message-ID: <31f701e6-fbd3-4674-82ef-2f835d4a8b41@intel.com> (raw)
In-Reply-To: <20251121001218.4565-6-emil.s.tantilov@intel.com>
On 11/20/2025 4:12 PM, Tantilov, Emil S wrote:
> If the init_task fails during a driver load, we end up without vports and
> netdevs, effectively failing the entire process. In that state a
> subsequent reset will result in a crash as the service task attempts to
> access uninitialized resources. Following trace is from an error in the
> init_task where the CREATE_VPORT (op 501) is rejected by the FW:
>
> [40922.763136] idpf 0000:83:00.0: Device HW Reset initiated
> [40924.449797] idpf 0000:83:00.0: Transaction failed (op 501)
> [40958.148190] idpf 0000:83:00.0: HW reset detected
> [40958.161202] BUG: kernel NULL pointer dereference, address: 00000000000000a8
> ...
> [40958.168094] Workqueue: idpf-0000:83:00.0-vc_event idpf_vc_event_task [idpf]
> [40958.168865] RIP: 0010:idpf_vc_event_task+0x9b/0x350 [idpf]
> ...
> [40958.177932] Call Trace:
> [40958.178491] <TASK>
> [40958.179040] process_one_work+0x226/0x6d0
> [40958.179609] worker_thread+0x19e/0x340
> [40958.180158] ? __pfx_worker_thread+0x10/0x10
> [40958.180702] kthread+0x10f/0x250
> [40958.181238] ? __pfx_kthread+0x10/0x10
> [40958.181774] ret_from_fork+0x251/0x2b0
> [40958.182307] ? __pfx_kthread+0x10/0x10
> [40958.182834] ret_from_fork_asm+0x1a/0x30
> [40958.183370] </TASK>
>
> Fix the error handling in the init_task to make sure the service and
> mailbox tasks are disabled if the error happens during load. These are
> started in idpf_vc_core_init(), which spawns the init_task and has no way
> of knowing if it failed. If the error happens on reset, following
> successful driver load, the tasks can still run, as that will allow the
> netdevs to attempt recovery through another reset. Stop the PTP callbacks
> either way as those will be restarted by the call to idpf_vc_core_init()
> during a successful reset.
>
> Fixes: 0fe45467a104 ("idpf: add create vport and netdev configuration")
> Reported-by: Vivek Kumar <iamvivekkumar@google.com>
> Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Reviewed-by: Madhu Chittim <madhu.chittim@intel.com>
> ---
> drivers/net/ethernet/intel/idpf/idpf_lib.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c
> index 5193968c9bb1..89f3b46378c4 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_lib.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c
> @@ -1716,10 +1716,9 @@ void idpf_init_task(struct work_struct *work)
> set_bit(IDPF_VPORT_REG_NETDEV, vport_config->flags);
> }
>
> - /* As all the required vports are created, clear the reset flag
> - * unconditionally here in case we were in reset and the link was down.
> - */
> + /* Clear the reset and load bits as all vports are created */
> clear_bit(IDPF_HR_RESET_IN_PROG, adapter->flags);
> + clear_bit(IDPF_HR_DRV_LOAD, adapter->flags);
> /* Start the statistics task now */
> queue_delayed_work(adapter->stats_wq, &adapter->stats_task,
> msecs_to_jiffies(10 * (pdev->devfn & 0x07)));
> @@ -1733,6 +1732,15 @@ void idpf_init_task(struct work_struct *work)
> idpf_vport_dealloc(adapter->vports[index]);
> }
> }
> + /* Cleanup after vc_core_init, which has no way of knowing the
> + * init task failed on driver load.
> + */
> + if (test_and_clear_bit(IDPF_HR_DRV_LOAD, adapter->flags)) {
> + cancel_delayed_work_sync(&adapter->serv_task);
> + cancel_delayed_work_sync(&adapter->mbx_task);
> + }
> + idpf_ptp_release(adapter);
> +
> clear_bit(IDPF_HR_RESET_IN_PROG, adapter->flags);
> }
>
> @@ -1882,7 +1890,7 @@ static void idpf_init_hard_reset(struct idpf_adapter *adapter)
> dev_info(dev, "Device HW Reset initiated\n");
>
> /* Prepare for reset */
> - if (test_and_clear_bit(IDPF_HR_DRV_LOAD, adapter->flags)) {
> + if (test_bit(IDPF_HR_DRV_LOAD, adapter->flags)) {
> reg_ops->trigger_reset(adapter, IDPF_HR_DRV_LOAD);
> } else if (test_and_clear_bit(IDPF_HR_FUNC_RESET, adapter->flags)) {
> bool is_reset = idpf_is_reset_detected(adapter);
next prev parent reply other threads:[~2025-12-01 21:44 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-21 0:12 [Intel-wired-lan] [PATCH iwl-net v2 0/5] idpf: fix issues in the reset handling path Emil Tantilov
2025-11-21 0:12 ` [Intel-wired-lan] [PATCH iwl-net v2 1/5] idpf: keep the netdev when a reset fails Emil Tantilov
2025-12-10 22:28 ` Salin, Samuel
2025-11-21 0:12 ` [Intel-wired-lan] [PATCH iwl-net v2 2/5] idpf: detach and close netdevs while handling a reset Emil Tantilov
2025-11-25 13:42 ` Simon Horman
2025-11-25 14:58 ` Tantilov, Emil S
2025-11-26 17:10 ` Simon Horman
2025-12-10 22:28 ` Salin, Samuel
2025-12-01 21:34 ` Chittim, Madhu
2025-11-21 0:12 ` [Intel-wired-lan] [PATCH iwl-net v2 3/5] idpf: fix memory leak in idpf_vport_rel() Emil Tantilov
2025-12-10 22:28 ` Salin, Samuel
2025-11-21 0:12 ` [Intel-wired-lan] [PATCH iwl-net v2 4/5] idpf: fix memory leak in idpf_vc_core_deinit() Emil Tantilov
2025-12-10 22:28 ` Salin, Samuel
2025-11-21 0:12 ` [Intel-wired-lan] [PATCH iwl-net v2 5/5] idpf: fix error handling in the init_task on load Emil Tantilov
2025-12-01 21:44 ` Chittim, Madhu [this message]
2025-12-10 22:29 ` Salin, Samuel
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=31f701e6-fbd3-4674-82ef-2f835d4a8b41@intel.com \
--to=madhu.chittim@intel.com \
--cc=Aleksandr.Loktionov@intel.com \
--cc=aleksander.lobakin@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=decot@google.com \
--cc=edumazet@google.com \
--cc=emil.s.tantilov@intel.com \
--cc=iamvivekkumar@google.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=joshua.a.hay@intel.com \
--cc=kuba@kernel.org \
--cc=larysa.zaremba@intel.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=willemb@google.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