All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Yazen Ghannam" <yazen.ghannam@amd.com>
Cc: linux-pci@vger.kernel.org
Subject: Re: [PATCH 4/5] PCI/FLIT: Add trace event for flit errors
Date: Tue, 14 Jul 2026 19:16:22 +0000	[thread overview]
Message-ID: <20260714191623.17E381F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260714183950.1620016-5-yazen.ghannam@amd.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Infinite loop in threaded IRQ handler due to missing check for PCI device removal/error.
--

--- Patch [4]: [PATCH 4/5] PCI/FLIT: Add trace event for flit errors ---
commit e2a5453df78634ff77f29016af766d1994cda605
Author: Yazen Ghannam <yazen.ghannam@amd.com>

PCI/FLIT: Add trace event for flit errors

This commit emits a trace event for each erroneous flit logged by the Flit
Error Counter. It captures the counter control/status and both Error Log
registers to provide a structured record for userspace RAS tooling.

> diff --git a/drivers/pci/pcie/flit.c b/drivers/pci/pcie/flit.c
> index 12f2b6fbf1de0..83cf53f392913 100644
> --- a/drivers/pci/pcie/flit.c
> +++ b/drivers/pci/pcie/flit.c

[ ... ]

> @@ -84,6 +85,7 @@ static irqreturn_t flit_isr(int irq, void *context)
>  
>  		pci_read_config_dword(pdev, flit + PCI_FLIT_ERR_LOG2, &err_log2);
>  		pci_info(pdev, HW_ERR "  Error Log1: 0x%08x Error Log2: 0x%08x\n", err_log1, err_log2);
> +		trace_flit_event(pci_name(pdev), cntr_ctrl, cntr_sta, err_log1, err_log2);
>  
>  		pci_write_config_dword(pdev, flit + PCI_FLIT_ERR_LOG1, err_log1);
>  	} while (err_log1 & PCI_FLIT_ERR_LOG_MORE);

[Severity: High]
If the PCI device is hot-unplugged or the link goes down while flit_isr()
is executing, pci_read_config_dword() will fail and set err_log1 to all 1s
(0xFFFFFFFF).

Because 0xFFFFFFFF has all bits set, it will bypass any valid bit checks and
the loop condition (err_log1 & PCI_FLIT_ERR_LOG_MORE) will evaluate to true.

Could this trap the kernel thread in an infinite loop and flood the trace
buffer?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260714183950.1620016-1-yazen.ghannam@amd.com?part=4

  reply	other threads:[~2026-07-14 19:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-14 18:39 [PATCH 0/5] PCIe Flit Logging Ext Capability Support Yazen Ghannam
2026-07-14 18:39 ` [PATCH 1/5] PCI/portdrv: Group PCI Exp Cap services into a single mask Yazen Ghannam
2026-07-14 19:11   ` sashiko-bot
2026-07-14 18:39 ` [PATCH 2/5] PCI/FLIT: Add support for Flit Logging Extended Capability Yazen Ghannam
2026-07-14 19:17   ` sashiko-bot
2026-07-14 18:39 ` [PATCH 3/5] PCI/FLIT: Negotiate _OSC control for Flit Error Logging Yazen Ghannam
2026-07-14 19:36   ` sashiko-bot
2026-07-14 18:39 ` [PATCH 4/5] PCI/FLIT: Add trace event for flit errors Yazen Ghannam
2026-07-14 19:16   ` sashiko-bot [this message]
2026-07-14 18:39 ` [PATCH 5/5] PCI/FLIT: Ratelimit flit error logging Yazen Ghannam
2026-07-14 19:18   ` sashiko-bot

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=20260714191623.17E381F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=yazen.ghannam@amd.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.