Article View: linux.kernel.netdev
Article #27115[PATCH net v2 2/6] idpf: ignore Tx timestamp replies once removal has started
From: Tony Nguyen
Date: Fri, 04 Dec 2026 19:46
Date: Fri, 04 Dec 2026 19:46
71 lines
12294 bytes
12294 bytes
From: Tian Xun Ng <tianxun.ng@bytedance.com>
On remove, idpf_vc_core_deinit() keeps the virtchnl transaction manager
up until the vports have been torn down, so mbx_task keeps processing
replies while idpf_ptp_release() frees the Tx timestamp trackers. An
async VIRTCHNL2_OP_PTP_GET_VPORT_TX_TSTAMP reply handled in that window
reaches idpf_ptp_get_tx_tstamp_async_handler(), which reads
vport->tx_tstamp_caps and takes its lock after
idpf_ptp_release_vport_tstamp() may already have freed it.
Once IDPF_REMOVE_IN_PROG is set, wait for a mailbox task that may be
running a callback before releasing anything, and make the Tx timestamp
callback return when the bit is set. Matched replies to synchronous
transactions are not affected, so the vport teardown still receives
them; mbx_task is requeued straight away for that.
The last patch of this series sets IDPF_REMOVE_IN_PROG on shutdown too,
which would otherwise expose shutdown to the same window.
Fixes: 1a49cf814fe1 ("idpf: add Tx timestamp flows")
Cc: stable@vger.kernel.org
Signed-off-by: Tian Xun Ng <tianxun.ng@bytedance.com>
Reviewed-by: Emil Tantilov <emil.s.tantilov@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_virtchnl.c | 12 +++++++++++-
drivers/net/ethernet/intel/idpf/idpf_virtchnl_ptp.c | 3 ++-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
index c89783966bae..348c7875134a 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl.c
@@ -3262,8 +3262,18 @@ void idpf_vc_core_deinit(struct idpf_adapter *adapter)
/* Avoid transaction timeouts when called during reset */
remove_in_prog = test_bit(IDPF_REMOVE_IN_PROG, adapter->flags);
- if (!remove_in_prog)
+ if (!remove_in_prog) {
libie_ctlq_xn_shutdown(adapter->xnm);
+ } else {
+ /* The transaction manager stays up for the teardown below, so
+ * async replies can still arrive. Wait for a mailbox task that
+ * may be running an async callback; callbacks that run later
+ * see IDPF_REMOVE_IN_PROG and leave the state released below
+ * alone.
+ */
+ cancel_delayed_work_sync(&adapter->mbx_task);
+ queue_delayed_work(adapter->mbx_wq, &adapter->mbx_task, 0);
+ }
idpf_ptp_release(adapter);
idpf_deinit_task(adapter);
diff --git a/drivers/net/ethernet/intel/idpf/idpf_virtchnl_ptp.c b/drivers/net/ethernet/intel/idpf/idpf_virtchnl_ptp.c
index 14dba40a993f..1422b30d09a3 100644
--- a/drivers/net/ethernet/intel/idpf/idpf_virtchnl_ptp.c
+++ b/drivers/net/ethernet/intel/idpf/idpf_virtchnl_ptp.c
@@ -550,7 +550,8 @@ idpf_ptp_get_tx_tstamp_async_handler(void *ctx, struct kvec *mem, int status)
u16 num_latches;
u32 vport_id;
- if (status)
+ /* The Tx timestamp trackers are released on remove and shutdown */
+ if (status || test_bit(IDPF_REMOVE_IN_PROG, adapter->flags))
return;
recv_tx_tstamp_msg = mem->iov_base;
--
2.47.1
Technical Details
Message-ID:
<20261204194642.3048406-3-anthony.l.nguyen@intel.com>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377594-linux-kernel-netdev=dewy.ruReferences:
<20261204194642.3048406-1-anthony.l.nguyen@intel.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-377594-linux-kernel-netdev=dewy.ru From: anthony.l.nguyen@intel.com (Tony Nguyen) Newsgroups: linux.kernel.netdev Subject: [PATCH net v2 2/6] idpf: ignore Tx timestamp replies once removal has started Date: Fri, 4 Dec 2026 11:46:37 -0800 Organization: Usenet Network Message-ID: <20261204194642.3048406-3-anthony.l.nguyen@intel.com> References: <20261204194642.3048406-1-anthony.l.nguyen@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Injection-Info: usenet.network; logging-data="2848544"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:9hW1yT3zgLqG6XHVhQf/bYqVCpg= sha256:AyHev4Jcv5DRJ55lm9UEmUNDFb2ACB+vbXjvyhvfd8g= sha1:vugYLRchPwrU3iurcJIlEgWh9eM= sha256:kMyE7hLv9CDaxG7wvov8UtGPLBscavtlR0i1hdJctws= List-ID: <netdev.vger.kernel.org> X-Mailpost-Empty-Hdrs: X-Spam-Level X-Received: from localhost (localhost [127.0.0.1]) by mail.dewy.ru (Postfix) with ESMTP id 9ABF1117CC8; Fri, 4 Dec 2026 22:47:29 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.54 X-Spam-Status: No, score=-3.54 tagged_above=-9999 required=6.31 tests=[DKIMWL_WL_HIGH=-0.142, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.001, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=intel.com X-Received: from mail.dewy.ru ([127.0.0.1]) by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id If_JdBq65Jns; Fri, 4 Dec 2026 22:47:27 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-377594-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=intel.com X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id 4C330117CC2; Fri, 4 Dec 2026 22:47:19 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by tor.lore.kernel.org (Postfix) with ESMTP id 15D732CB6B; Fri, 4 Dec 2026 19:47:08 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1796413621; b=RgaceSjwR2WlfSfSKN3Ibqi4v6XavD7HTKT/WD0IhpuAmprSeI/VMxxVg2IypYjWFJGO 9ITwfwDBkuZTXN7UGcih4+N9AQE1aKfdmplXm55xMPy368eBtxfeNpq7uUK25gMJ6C54W cuixJUDdDAdaGDnimK8dZi9TYiItYRkkGqxdG1jwFzaioezG83nDgohikYisDt2oc2Rrr KZhjzDWyUPbrMV1sGe7p+an8vqyS1I+0ViZLGz7rF6m2miJa1WDtju2r2NBNIbgRYDlDQ ZgkOSVE3Uu4QzrpDNEPXBEQL1VP8kbMRwBmTRn7PKgIQxfpe8qfyYD6Eqe/Y+JmaxIA== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796413621; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature: X-CSE-ConnectionGUID:X-CSE-MsgGUID:X-IronPort-AV:X-IronPort-AV: Received:X-CSE-ConnectionGUID:X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV: Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To: References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe: List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Transfer-Encoding; bh=lL9hw+IR+AsTGtPTwf9R+JgSVV6KkFIrNc6QulH/3ng=; b=VOSsv48L279U3uYjP3XaRr+Y1/4fIdpFLqqb6/zHnf8RmG/qhBQFVTcL+7pHMDPffiKk WELAMHp9uKhRP62HsLhXX65k0fhQmS2O1Di3zvIOBXOtbKXOArG7gWHKnEK/51GJff2Hw PUSOic6ARa61NEj7xvMBoPBQoutCq/Ll6JXdThIPaCAEYBkpIECyqyxVYw/O7XDGvh3tG dtaHtbLMKA7coeayRjb6HilbwHA36yFQs1572YXPNHZaxjCtjxqQtxzNEJYlgj3wA1C05 sT1xRwO5+msHt0X2i7TMR9VX9F9AxEXDC1BtgQdyBOnKVbNYf0Fz69/Nxynvqgz/5yQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=S4QDa4vz; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1 X-Received: from localhost.localdomain (localhost [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B3556606A322; Fri, 4 Dec 2026 19:47:01 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=S4QDa4vz X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=192.198.163.9 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796413615; b=Il0j3VWQpf/MeX8WaMtnbvp1YrINWWcY+vMRevCf8yvbXkffwJ1pyTBH4rJN+vP1Yx8c e9FV63+LMPUEkmDph3RWxHJ5q77B3QZUtaJWWaJR/6YPu/vdG2gngeEauzmnn6yi0bXLO ZtFjO+C4HV8kgEWY8riJMzJz6WpTRVlV/uFtGPmVrmFu0kHKNjUIzLrwhFga55BenPRrb nIuH/frVWRIdA/ItS8syKDT3eCndI51SZ5DKjIFMGbgP8ahaFKecrJLZXnQY6DIV4noga 7fbAc3s9Qpy5IzAWCdH/ui2Qot+I3FOZmv60jwyKoWtyEyO8TfXLo48XNf4WS0Rx0+g== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796413615; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:From:To:Cc:Subject: Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=lL9hw+IR+AsTGtPTwf9R+JgSVV6KkFIrNc6QulH/3ng=; b=nrKdduyvApq65roz+7lswLvTjInyuMMXr3tTBEts9nek2cFwuteoYrezTJWSRB5n4K3J Z906vfRrcjnJYVgqvJR3vHGxtadP0RmawCWI0gCtEZaz+mbGk0edeHJKaMIQwvv1Y9Uof 5ch3JZHZ3+aLr4TqX+FXdUHKQmmkAxXM/z9AkKVOH/IQO9vTP1nyKabI4nv/r2OA2gmP4 1uw902wbth5j/BpAC0OeNi4S8rcYo2Fb7Oc0ZkOs7qsFd4HgpHOvh3b+opNjJAOJleli/ dq8n7PWq0i8Is9hGA4cs0GVxcj7c6iuyviVXDH8RSV0rjE9jacSkuRgb0Gzb/y2rITA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=S4QDa4vz; arc=none smtp.remote-ip=192.198.163.9 X-Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.9]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69D60606A334; Fri, 4 Dec 2026 19:46:55 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 69D60606A334 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796413616; x=1827949616; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lL9hw+IR+AsTGtPTwf9R+JgSVV6KkFIrNc6QulH/3ng=; b=S4QDa4vzd7xUtUEYxht5DXffGwbD2XBzZRKEIs9B4kggPYLmckdo0ESR 3DIBbVvi9uak+ZDsojHkcUmm6J0h0eCBQdOuZqKTfDf+iFl3whjqpF0qo wFsf3xiIZxlWlkV15DtE5b7TFx/tyBS6Y1Dpk2YMXCKvAJ7HpvOPHcQH/ fk4JNJ+/RHqIAYZ3RPGYPYPOp1qjnXLsLX+p6MXRjK0Qumf6a3DFEThN8 VBz6QXec3OuDZEPnrnRolG9Is0uC4qhHcphXzZol45/7KsVZb6I67rNVQ KUKhOJTqzWYphog7RGYJTIVt6DQrHKgx+MXbAJ8GYj2NgAYa1bOEjdZ/R g==; X-CSE-ConnectionGUID: xGXCpFDLSSCVc/ZP8yh6BQ== X-CSE-MsgGUID: mJgROD4hRRytLxnIVtfhNw== X-IronPort-AV: E=McAfee;i="6800,10657,11986"; a="5267126" X-IronPort-AV: E=Sophos;i="6.29,79,1794902400"; d="scan'208";a="5267126" X-Received: from orviesa010.jf.intel.com ([10.64.159.150]) by fmvoesa103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2026 11:46:54 -0800 X-CSE-ConnectionGUID: pNfdYdZJRKKrYC+kZ60nKw== X-CSE-MsgGUID: uluMx4tCTuWqFmdhU4vF/A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.29,79,1794902400"; d="scan'208";a="5635514" X-Received: from anguy11-upstream.jf.intel.com ([10.166.9.133]) by orviesa010.jf.intel.com with ESMTP; 04 Dec 2026 11:46:53 -0800 X-Cc: Tian Xun Ng <tianxun.ng@bytedance.com>, anthony.l.nguyen@intel.com, oss.patchbox@gmail.com, luckilystar08@gmail.com, emil.s.tantilov@intel.com, richardcochran@gmail.com, milena.olech@intel.com, konstantin.ilichev@intel.com, stable@vger.kernel.org, Samuel Salin <Samuel.salin@intel.com> X-Mailer: git-send-email 2.47.1 X-In-Reply-To: <20261204194642.3048406-1-anthony.l.nguyen@intel.com> X-Mailing-List: netdev@vger.kernel.org X-List-Post: <mailto:netdev@vger.kernel.org> X-List-Help: <mailto:netdev+help@vger.kernel.org> X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org> X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org> X-List-Owner: <mailto:netdev+owner@vger.kernel.org> X-Precedence: list