Article View: linux.kernel.netdev
Article #9968Re: [PATCH iwl-net] igc: Disable PTM after the last device reset on remove
From: Bjorn Helgaas
Date: Mon, 02 Nov 2026 22:28
Date: Mon, 02 Nov 2026 22:28
153 lines
15037 bytes
15037 bytes
On Sat, Oct 31, 2026 at 10:19:28AM +0800, Li Yifan wrote:
> I225/I226 have a hardware issue: after a PTM dialog, the next device
> reset through the RST bit of the Device Control register (CTRL.RST)
I assume this Device Control is a device-specific register, not the
Device Control in the PCIe Capability, right?
> can make the device send a PTM Request. The device sends it even if
> PTM is disabled in its PTM Control register (PCI config space), the EN
> bit of its PTM_CTRL register (MMIO) is clear
And I guess PTM_CTRL is another device-specific register. The
architected PTM Enable bit in the PTM Capability in config space is
supposed to be enough to prevent the device from issuing PTM Requests,
so I guess the device-specific control is only relevant because it's
not enough to work around this hardware defect.
> and Bus Master Enable is
> clear, so the driver cannot stop it. Commit c080fe262f9e ("igc: Fix
> possible system crash when loading module") disables PTM before bus
> mastering because of a related issue (PTM Requests with bus mastering
> disabled), but that does not stop the request at CTRL.RST.
c080fe262f9e and this both mention Bus Master Enable, but I don't
think it's relevant to either change. Bus Master Enable controls
ability to issue Memory and I/O Read/Write Requests. PTM Requests are
PCIe Messages (not Read/Write Requests) so Bus Master Enable should
not affect them.
If this is a documented erratum, can we include an identifier or a
pointer to it?
> The request is harmless while the upstream port has PTM enabled. Since
> commit e1092d5e15e6 ("PCI/PTM: Do not enable PTM automatically for Root
> and Switch Upstream Ports"), pci_disable_ptm() also disables PTM on the
> upstream port when the last user goes away. igc_remove() calls
> pci_disable_ptm() before unregister_netdev(). If the interface is up,
> unregister_netdev() then resets the device through igc_close() ->
> igc_down() -> igc_reset(). The upstream port now handles the PTM
> Request as an Unsupported Request. On an Intel Nova Lake-S system with
> an I226-LM, this triggers DPC on "modprobe -r igc". Recovery fails
> because the driver is unbinding, and the next probe fails:
>
> pcieport 0000:80:1d.0: DPC: containment event, status:0x1f01: unmasked uncorrectable error detected
> pcieport 0000:80:1d.0: [20] UnsupReq (First)
> pcieport 0000:80:1d.0: AER: TLP Header: 0x34000000 0x81000052 0x00000000 0x00000000
>
> Message code 0x52 in the TLP header is a PTM Request from 81:00.0.
>
> Reset the device while the upstream port still has PTM enabled, so
> that the PTM Request gets a response. Then disable PTM and bus
> mastering. With this order, a later reset sends no PTM Request (tested
> on I226-LM). igc_ptp_stop() has already cleared IGC_PTP_ENABLED, so no
> new PTM dialog starts after this reset.
IGC_PTP_ENABLED is just a software flag, and it appears to be related
to PTP, not directly related to PTM, so there are some dots missing
between it and hardware PTM messages.
> If the interface is down,
> unregister_netdev() does not reset the device, so reset it explicitly.
> PTM is still disabled before bus mastering, as the related fix above
> requires.
Which fix requires PTM disable before bus mastering disable? And why
is that required?
> Skip the reset if the device cannot respond: error recovery is in
> progress or has failed (pci_channel_offline()), the device is gone
> (pci_device_is_present()), or igc_rd32() has already reported "PCIe
> link lost" (IGC_REMOVED()). Otherwise the reset accesses a device in
> error recovery, or polls all-ones register values for about two
> seconds until igc_disable_pcie_master() times out.
>
> Call pci_disable_ptm() only if PTM is enabled. pci_enable_ptm() can
> fail in probe, for example if the upstream port does not support
> PTM, and probe continues without PTM. The PCI/PTM change above
> also made pci_disable_ptm() use a reference count: it decrements
> dev->ptm_enable_cnt without a check, and then does the same for the
> upstream port. Before, it did nothing if PTM was not enabled. After
> a failed pci_enable_ptm(), the count of the device becomes negative
> and stays negative after the driver unbinds. pcie_ptm_enabled()
> returns true for a negative count, so after the next probe
> igc_is_crosststamp_supported() reports PTM support and igc_ptp_reset()
> starts PTM cycles on a device that does not have PTM enabled. Commit
> 650f197d8ea6 ("idpf: disable PTM on probe failure and on remove")
> adds the same check to idpf.
This sounds like a bug in the PCI core PTM support, i.e., maybe
pci_disable_ptm() should be checking for PTM being enabled?
Otherwise I'm afraid lots of drivers might trip over this.
> Fixes: e1092d5e15e6 ("PCI/PTM: Do not enable PTM automatically for Root and Switch Upstream Ports")
> Suggested-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> Co-developed-by: Li Lili <lili.li@intel.com>
> Signed-off-by: Li Lili <lili.li@intel.com>
> Signed-off-by: Li Yifan <yifan2.li@intel.com>
> Tested-by: Wang Jie <jie.wang@intel.com>
> ---
> drivers/net/ethernet/intel/igc/igc_main.c | 19 ++++++++++++++++---
> 1 file changed, 16 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
> index b8ac2f4fea5a..3ee8b05f0515 100644
> --- a/drivers/net/ethernet/intel/igc/igc_main.c
> +++ b/drivers/net/ethernet/intel/igc/igc_main.c
> @@ -7406,9 +7406,6 @@ static void igc_remove(struct pci_dev *pdev)
>
> igc_ptp_stop(adapter);
>
> - pci_disable_ptm(pdev);
> - pci_clear_master(pdev);
> -
> set_bit(__IGC_DOWN, &adapter->state);
>
> timer_delete_sync(&adapter->watchdog_timer);
> @@ -7427,6 +7424,22 @@ static void igc_remove(struct pci_dev *pdev)
> igc_release_hw_control(adapter);
> unregister_netdev(netdev);
>
> + /* After a PTM dialog, I225/I226 can send a PTM Request at the next
> + * CTRL.RST, even with PTM and bus mastering disabled on the device.
> + * Reset the device while PTM is still enabled on the upstream port,
> + * so that the request gets a response. unregister_netdev() resets the
> + * device only if the interface was up. Skip the reset if the device
> + * cannot respond (error recovery, surprise removal or an earlier
> + * "PCIe link lost"). Then disable PTM before bus mastering.
> + */
> + if (!pci_channel_offline(pdev) && pci_device_is_present(pdev) &&
> + !IGC_REMOVED(adapter->hw.hw_addr))
All these tests look racy. .reset_hw() really should be able to
detect and deal with any errors that happen if it tries to access a
device that is no longer responding.
> + adapter->hw.mac.ops.reset_hw(&adapter->hw);
> +
> + if (pcie_ptm_enabled(pdev))
> + pci_disable_ptm(pdev);
> + pci_clear_master(pdev);
I don't think bus mastering has any connection to PTM, so why are we
moving pci_clear_master()?
> igc_clear_interrupt_scheme(adapter);
> pci_iounmap(pdev, adapter->io_addr);
> pci_release_mem_regions(pdev);
>
> base-commit: c550c1c9727726dcae121221c252013153fa5945
> --
> 2.43.0
>
Technical Details
Message-ID:
<20261102222817.GA983941@bhelgaas>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355082-linux-kernel-netdev=dewy.ruReferences:
<20261031021928.1714612-1-yifan2.li@intel.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-355082-linux-kernel-netdev=dewy.ru From: helgaas@kernel.org (Bjorn Helgaas) Newsgroups: linux.kernel.netdev Subject: Re: [PATCH iwl-net] igc: Disable PTM after the last device reset on remove Date: Mon, 2 Nov 2026 16:28:17 -0600 Organization: Usenet Network Message-ID: <20261102222817.GA983941@bhelgaas> References: <20261031021928.1714612-1-yifan2.li@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: usenet.network; logging-data="3045202"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:+BokKUq3K2F9zKUD5bplfdPNsrQ= sha256:xth7ej/9Bw0LNtS80D2vZTC/S17zOB0hKZsZMi/ypLk= sha1:SXJPR4k+8fZvPgXXnBL8RbxWxbU= sha256:O8PHbGRRhnzMjrEY3DRuUNm+ZMMtS9Kkqwi4eXrMJqs= Content-Disposition: inline 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 D88B21126B2; Tue, 3 Nov 2026 01:28:41 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -3.401 X-Spam-Status: No, score=-3.401 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key) header.d=kernel.org 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 iEPNQUiEUNX6; Tue, 3 Nov 2026 01:28:35 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-355082-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114]) by mail.dewy.ru (Postfix) with ESMTPS id E4B3C1126AB; Tue, 3 Nov 2026 01:28:24 +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 1A4952568D; Mon, 2 Nov 2026 22:28:21 +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=1793658500; b=T/CYZL4VG1hybG6fwN8T7R1ck1kTAJLGnmF6sdaZr1d1dqjFhM6vMulQQKnbW5MxDhzo Ekk16eP9xZyNLYVpOPtNGPW7qCnMc+O3d/n1F4vS2zfqRwQaCjmC3HmYiGWAelI9dcEPj q1IYAyyZwrRi9nfywHB280kutmGMNi0rWM86fiG8Xo5HWXutUxdVGE+cdPaAcig3L+hH6 jC0N6mrSl5Q1Pia4M/yvj+14an1cxuTaod5dkBI7ofu9KdQ7zglzLcHH/0qpLtu1Cycw/ kOW56q+7cJz0fs+LRmmYudEWsu7fYgVzvv5a3vyffCDFJcbFRCiy91JPuxljEUoOOXw== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793658500; h=X-Original-To:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:X-Mailing-List:List-Id:List-Post:List-Help: List-Subscribe:List-Unsubscribe:List-Owner:Precedence:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; bh=pLrc6IvsxvZox2frClEyQ8V7DfzXsEUEs896JOGYWfk=; b=GBr+amYCCJUuIURsObPCRxmfdJmV34GpZtZQhSKXORR45WhKJR6SXOJ8zj6ofN+Y7uCk ytxUwz2k51mbeYOMcwoPvsf3aN0M9sifTPPjj76KwxYr1Ecn9fAYChSk7ex1GtwvMJUQA 4EOU2EWaSTtHJKQyj7j8vRkfpC2UI70J8tIzVHS4BRv/UMYC9aDw/0NNxuCQkBTUIA4sB Ec8u9ShWiikXH8krFTSixAvkobrLOYdG/hpJGTwB0RPvGL1XhrEAQ7bQgLrcuNZ9XjVrJ 7hoSjOOFav4PxvAVDAiBG98avXhLjzTxh+iuTGrC7cvGDa+ZZVh54jUOCCDWV0VfjKQ== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=o0xbMNSR; 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 46AF3606A32E; Mon, 2 Nov 2026 22:28:20 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=o0xbMNSR X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793658499; b=earpQc92Ianv9nPbEapJS0BGrk57KN2k5MNFkPZvSUaKw/wHl2A9TIgI5D0ZD6AEUUxq pkXmYA43oVQ/Y5RjkpW0zNfPP0pPE3U9c0p2v6/iKYDPefEuodYyI4kLCB0M6jxUUKdXw pbmtuR0MahwP3FI8WzxkcEVYlubG6JWsN+hISosvX0DqoqpZNxcJTTKIm/owDHzZpli3l hJITlj4SwBC4u5iD9jjF4N1MttSOm7q3EFEHFbijxeg/696hoUm0fQQszIzt8gE7PIjqL pMpjlDOddSwZj0LkMGAUdQf3th130CM88CX1Gm+4Rr/QrLmt2g48jLjUetdGHLWe2Dg== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793658499; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=pLrc6IvsxvZox2frClEyQ8V7DfzXsEUEs896JOGYWfk=; b=slGxIJeoM29sJJxM9oEij2+9FGTKL6fvEbgshI+kbxxTKkYftCtub76fkpPxFHaNZjep zvX/5uiyQjZxCaLg5bMv6ORBje1wd1gzrY5Q+N5cjNSuIaNp5HCF1mFa+ocRteDWl3kFN P21ZLZLghLLIMxH1jHXTKfalBsngbegS0EJNR2lktOrsptMI1xWSLzE1L3RckdzSOtd69 pR7iu+c5hfPIb5KpnAIl3zhQePdfL5gC+XLwtOZYhepCZd2vorPR+KZ2QpJHW7s0z5Qsw 8OvB5eHWjlDPcpr9SDb5DQXTy+pYuDdL7Xg3UqA0Ejxl1GsZAxc1WVGUElVgDdVvYxA== X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=o0xbMNSR; arc=none smtp.remote-ip=100.103.45.18 X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1EE0B606A326 for <netdev@vger.kernel.org>; Mon, 2 Nov 2026 22:28:19 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id BEBCB1F00A16; Mon, 2 Nov 2026 22:28:18 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793658499; bh=pLrc6IvsxvZox2frClEyQ8V7DfzXsEUEs896JOGYWfk=; h=Date:From:To:Cc:Subject:In-Reply-To; b=o0xbMNSROg9/PhI4EqQSPzRQ+s8Ia33KoO6eIdPfjUOpHDY59v0XgycrL12PCpw1X kj+d3U4x/Tm4TBNzOh6yWQeWS/Pwy2uxoAuAU/5Q6msUXdc4M3B1lTsCSZLn3WuLrp /orWGlt8Am0+awWt1D/AbkHLrjI/lq7t/c2QTnKXIQc1Ueykunl7fiamNrNif2r0WS INkafWu1EGLsu43RccLnzsr9iFcwtrxx8giZgrraYSJuBCBjLMMrnMPsQ/qhyRpJ2N BVnXmFWnFuSWmPrtMreyM9huw6xem2KMTsQl5+4009y3i4PZxlgsT23WyBdc+8Mky8 iBlvbGMZXo7eg== X-Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, Tony Nguyen <anthony.l.nguyen@intel.com>, Przemek Kitszel <przemyslaw.kitszel@intel.com>, Bjorn Helgaas <bhelgaas@google.com>, Mika Westerberg <mika.westerberg@linux.intel.com>, Vinicius Costa Gomes <vinicius.gomes@intel.com>, Dima Ruinskiy <dima.ruinskiy@intel.com>, Li Lili <lili.li@intel.com>, Wang Jie <jie.wang@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 X-In-Reply-To: <20261031021928.1714612-1-yifan2.li@intel.com>