public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Shuai Xue <xueshuai@linux.alibaba.com>
To: Lukas Wunner <lukas@wunner.de>, Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	linuxppc-dev@lists.ozlabs.org, kbusch@kernel.org,
	sathyanarayanan.kuppuswamy@linux.intel.com, mahesh@linux.ibm.com,
	oohall@gmail.com, Jonathan.Cameron@huawei.com,
	terry.bowman@amd.com, tianruidong@linux.alibaba.com
Subject: Re: [PATCH v6 3/5] PCI/AER: Report fatal errors of RCiEP and EP if link recoverd
Date: Fri, 24 Oct 2025 14:43:56 +0800	[thread overview]
Message-ID: <239a003e-24dc-4e75-b677-a2c596b31c32@linux.alibaba.com> (raw)
In-Reply-To: <aPoIDW_Yt90VgHL8@wunner.de>



在 2025/10/23 18:48, Lukas Wunner 写道:
> On Mon, Oct 20, 2025 at 11:20:58PM +0800, Shuai Xue wrote:
>> 2025/10/20 22:24, Lukas Wunner:
>>> On Mon, Oct 20, 2025 at 10:17:10PM +0800, Shuai Xue wrote:
>>>>>>      .slot_reset()
>>>>>>        => pci_restore_state()
>>>>>>          => pci_aer_clear_status()
>>>>>
>>>>> This was added in 2015 by b07461a8e45b.  The commit claims that
>>>>> the errors are stale and can be ignored.  It turns out they cannot.
>>>>>
>>>>> So maybe pci_restore_state() should print information about the
>>>>> errors before clearing them?
>>>>
>>>> While that could work, we would lose the error severity information at
>>>
>>> Wait, we've got that saved in pci_cap_saved_state, so we could restore
>>> the severity register, report leftover errors, then clear those errors?
>>
>> You're right that the severity register is also sticky, so we could
>> retrieve error severity directly from AER registers.
>>
>> However, I have concerns about implementing this approach:
> [...]
>> 3. Architectural consistency: As you noted earlier, "pci_restore_state()
>> is only supposed to restore state, as the name implies, and not clear
>> errors." Adding error reporting to this function would further violate
>> this principle - we'd be making it do even more than just restore state.
>>
>> Would you prefer I implement this broader change, or shall we proceed
>> with the targeted helper function approach for now? The helper function
>> solves the immediate problem while keeping the changes focused on the
>> AER recovery path.
> 
> My opinion is that b07461a8e45b was wrong and that reported errors
> should not be silently ignored. 

Thanks for your input and for discussing the history of commit
b07461a8e45b. I understand its intention to ignore errors specifically
during enumeration. As far as I know, AdvNonFatalErr events can occur in
this phase and typically should be ignored to simplify handling.

> What I'd prefer is that if
> pci_restore_state() discovers unreported errors, it asks the AER driver
> to report them.
> 
> We've already got a helper to do that:  aer_recover_queue()
> It queues up an entry in AER's kfifo and asks AER to report it.
> 
> So far the function is only used by GHES.  GHES allocates the
> aer_regs argument from ghes_estatus_pool using gen_pool_alloc().
> Consequently aer_recover_work_func() uses ghes_estatus_pool_region_free()
> to free the allocation.  That prevents using aer_recover_queue()
> for anything else than GHES.  It would first be necessary to
> refactor aer_recover_queue() + aer_recover_work_func() such that
> it can cope with arbitrary allocations (e.g. kmalloc()).

I agree that aer_recover_queue() and aer_recover_work_func() offer a
generalized way to report errors.

However, I’d like to highlight some concerns regarding error discovery
during pci_restore_state():

- Errors During Enumeration via Hotplug: Errors such as AdvNonFatalErr
   seen during enumeration or hotplug are generally intended to be
   ignored, as handling them adds unnecessary complexity without
   practical benefits.

- Errors During Downstream Port Containment (DPC): When an error is
   detected and not masked, it is expected to propagate through the usual
   AER path, either reported directly to the OS or to the firmware.
   Finally, these errors should be cleared and reported in a single
   cohesive step.

For missed fatal errors during DPC, queuing additional work to report
these errors using aer_recover_queue() could introduce significant
overhead. Specifically: It may result in the bus being reset and the
device reset again, which could unnecessarily disrupt system operation.

Do we really need the heavy way?

I would appreciate more feedback from the community on whether queuing
another recovery task for errors detected during pci_restore_state()

Thanks
Shuai

  reply	other threads:[~2025-10-24  6:44 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-15  2:41 [PATCH v6 0/5] PCI/AER: Report fatal errors of RCiEP and EP if link recoverd Shuai Xue
2025-10-15  2:41 ` [PATCH v6 1/5] PCI/DPC: Clarify naming for error port in DPC Handling Shuai Xue
2025-10-15  2:41 ` [PATCH v6 2/5] PCI/DPC: Run recovery on device that detected the error Shuai Xue
2025-10-15  2:41 ` [PATCH v6 3/5] PCI/AER: Report fatal errors of RCiEP and EP if link recoverd Shuai Xue
2025-10-20 10:10   ` Lukas Wunner
2025-10-20 12:58     ` Shuai Xue
2025-10-20 13:54       ` Lukas Wunner
2025-10-20 14:17         ` Shuai Xue
2025-10-20 14:24           ` Lukas Wunner
2025-10-20 15:20             ` Shuai Xue
2025-10-23 10:48               ` Lukas Wunner
2025-10-24  6:43                 ` Shuai Xue [this message]
2025-12-16  8:07                   ` Shuai Xue
2025-10-20 18:38   ` Kuppuswamy Sathyanarayanan
2025-10-21  1:51     ` Shuai Xue
2025-10-15  2:41 ` [PATCH v6 4/5] PCI/ERR: Use pcie_aer_is_native() to check for native AER control Shuai Xue
2025-10-20 10:17   ` Lukas Wunner
2025-10-20 13:09     ` Shuai Xue
2025-10-20 13:58       ` Lukas Wunner
2025-10-20 14:45         ` Shuai Xue
2025-10-23 10:29           ` Lukas Wunner
2025-10-24  3:09             ` Shuai Xue
2025-10-24  3:14               ` Lukas Wunner
2025-10-24  3:38                 ` Shuai Xue
2025-10-24  4:03                   ` Lukas Wunner
2025-10-24  5:37                     ` Shuai Xue
2025-10-20 18:43   ` Kuppuswamy Sathyanarayanan
2025-10-15  2:41 ` [PATCH v6 5/5] PCI/AER: Clear both AER fatal and non-fatal status Shuai Xue
2025-10-20 18:44   ` Kuppuswamy Sathyanarayanan
2025-10-21  1:33     ` Shuai Xue

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=239a003e-24dc-4e75-b677-a2c596b31c32@linux.alibaba.com \
    --to=xueshuai@linux.alibaba.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=bhelgaas@google.com \
    --cc=kbusch@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=lukas@wunner.de \
    --cc=mahesh@linux.ibm.com \
    --cc=oohall@gmail.com \
    --cc=sathyanarayanan.kuppuswamy@linux.intel.com \
    --cc=terry.bowman@amd.com \
    --cc=tianruidong@linux.alibaba.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