Netdev List
 help / color / mirror / Atom feed
From: "Tantilov, Emil S" <emil.s.tantilov@intel.com>
To: Tian Xun Ng <luckilystar08@gmail.com>
Cc: <intel-wired-lan@lists.osuosl.org>, <netdev@vger.kernel.org>,
	<anthony.l.nguyen@intel.com>, <przemyslaw.kitszel@intel.com>,
	<aleksander.lobakin@intel.com>, <aleksandr.loktionov@intel.com>,
	<decot@google.com>, <andrew+netdev@lunn.ch>,
	<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, Tian Xun Ng <tianxun.ng@bytedance.com>
Subject: Re: [PATCH iwl-net v2] idpf: keep the mailbox up while tearing down vports on shutdown
Date: Thu, 8 Oct 2026 16:03:32 -0700	[thread overview]
Message-ID: <2bba3179-a471-4fce-8252-d9833d3024b5@intel.com> (raw)
In-Reply-To: <20261008065426.86267-1-luckilystar08@gmail.com>



On 10/7/2026 11:54 PM, Tian Xun Ng wrote:
> On 10/7/2026 10:07 AM, Tantilov, Emil S wrote:
>> I did a rough draft, keeping your logic and I think we
>> should be able to avoid the new flags by introducing a global variable
>> adapter->vc_xn_timeout_ms and set it based on the flow we're in
> 
> Thanks, that works well. v3 is ready along those lines: no new flags,
> adapter->vc_xn_timeout_ms set to the default at probe and to 500 ms in
> idpf_shutdown() right before IDPF_REMOVE_IN_PROG, and idpf_send_mb_msg()
> caps each transaction with it and sets it to 0 after the first
> shortened transaction times out, so the rest fail at once.
> 
> Backported to our 6.17 kernel (two arm64 servers, two PFs each, IOMMU
> translating): no faults in 30 warm reboots. The slowest teardown
> message is still DEALLOC_VECTORS at ~300 ms, sent after DESTROY_VPORT;
> the queue-related ones took at most 158 ms. With the driver made to
> skip sending the teardown messages, the first one timed out at ~500 ms,
> the rest failed immediately, and every reboot faulted again.
> 
> Before I post it, two things it exposes that I would like your view on:
> 
> 1. Setting IDPF_REMOVE_IN_PROG on shutdown also moves
>     libie_ctlq_xn_shutdown() after idpf_ptp_release() and
>     idpf_deinit_task(), as on remove. mbx_task keeps running in that
>     window, so an async PTP Tx timestamp reply can reach
>     idpf_ptp_get_tx_tstamp_async_handler() after
>     idpf_ptp_release_vport_tstamp() has freed tx_tstamp_caps. Remove has
>     the same window today; shutdown would now have it too. An unmatched

If I understand correctly, this is referring to possible UAF in the ptp 
release logic ... I can't say for sure, since I don't have your patch, 
but I think it is a valid concern. Your previous patch would have the 
same effect, so I don't believe this to be new (as result of the 
refactor) and would be an existing bug in idpf_remove().

BTW, I should mention here, you need to set IDPF_REMOVE_IN_PROG before 
cancelling the tasks in idpf_shutdown() to make sure the event task is 
not re-queued.

>     VIRTCHNL2_OP_EVENT (link change) has a similar window against the
>     vport being freed, which exists on shutdown already.
> 
>     One way to close it without new flags: once IDPF_REMOVE_IN_PROG is
>     set, cancel_delayed_work_sync() and requeue mbx_task, and have the
>     PTP callback and idpf_recv_event_msg() return early when the bit is
>     set; matched replies are still consumed, so the teardown is not
>     affected. I can send that as a prerequisite patch, but I cannot
>     exercise the PTP part here (PTP init returns -EOPNOTSUPP on our
>     parts). Would you prefer that, or to handle it separately?
> 
> 2. A transaction that is already waiting when shutdown starts keeps its
>     own timeout. For example a GET_STATS from stats_task, which is only
>     cancelled in idpf_deinit_task(), can still hold shutdown for up to
>     60 s with a dead control plane, where the early xn shutdown used to
>     wake it. Fixing that would need a way in libie to expire waiting
>     transactions, so I would note it in the commit message rather than
>     claim a hard bound. Does that sound right?

Yea, I think solving this issue in general would probably require 
changes in controlq. For the purpose of this patch limiting the delay 
within reason for the more practical cases is good enough.

Another thing to note, in your previous patch you had a comment:
+	/* Destroy the vports while the mailbox is still up, so that the
+	 * device stops its queues before the next kernel reuses their memory.
+	 * A reset does not clear them on every device.
+	 */

The last sentence is incorrect - a reset must clear the vport(s) state. 
This patch is still warranted as we would like the driver to gracefully 
signal the destruction of vports, however documenting FW bug as a fact 
is not OK.

Thanks,
Emil

> 
> Thanks,
> Tian Xun


      reply	other threads:[~2026-10-08 23:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07  5:57 [PATCH iwl-net v2] idpf: keep the mailbox up while tearing down vports on shutdown Tian Xun Ng
2026-10-07 17:07 ` Tantilov, Emil S
2026-10-08  6:54   ` Tian Xun Ng
2026-10-08 23:03     ` Tantilov, Emil S [this message]

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=2bba3179-a471-4fce-8252-d9833d3024b5@intel.com \
    --to=emil.s.tantilov@intel.com \
    --cc=aleksander.lobakin@intel.com \
    --cc=aleksandr.loktionov@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=intel-wired-lan@lists.osuosl.org \
    --cc=kuba@kernel.org \
    --cc=luckilystar08@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=tianxun.ng@bytedance.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