From: Shuai Xue <xueshuai@linux.alibaba.com>
To: "Rafael J. Wysocki" <rafael@kernel.org>
Cc: Donglin Peng <dolinux.peng@gmail.com>,
tony.luck@intel.com, guohanjun@huawei.com, mchehab@kernel.org,
yazen.ghannam@amd.com, dave.jiang@intel.com,
Smita.KoralahalliChannabasappa@amd.com, leitao@debian.org,
pengdonglin@xiaomi.com, baolin.wang@linux.alibaba.com,
benjamin.cheatham@amd.com, bp@alien8.de,
dan.j.williams@intel.com, james.morse@arm.com, lenb@kernel.org,
linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
zhuo.song@linux.alibaba.com
Subject: Re: [PATCH v2 2/3] ACPI: APEI: GHES: Extract helper functions for error status handling
Date: Mon, 12 Jan 2026 10:57:08 +0800 [thread overview]
Message-ID: <c164959b-6d51-4a6d-af3f-8c44106f57d3@linux.alibaba.com> (raw)
In-Reply-To: <CAJZ5v0jgfXDf4kxpQ7v8xapZw+S8Qc7gmt3txCKN7zptHs1biA@mail.gmail.com>
On 1/10/26 5:22 AM, Rafael J. Wysocki wrote:
> On Mon, Jan 5, 2026 at 6:42 AM Shuai Xue <xueshuai@linux.alibaba.com> wrote:
>>
>>
>>
>> On 1/5/26 1:12 PM, Donglin Peng wrote:
>>> On Sun, Jan 4, 2026 at 8:05 PM Shuai Xue <xueshuai@linux.alibaba.com> wrote:
>>>>
>>>> Refactors the GHES driver by extracting common functionality into
>>>> reusable helper functions:
>>>>
>>>> 1. ghes_has_active_errors() - Checks if any error sources in a given list
>>>> have active errors
>>>> 2. ghes_map_error_status() - Maps error status address to virtual address
>>>> 3. ghes_unmap_error_status() - Unmaps error status virtual address
>>>>
>>>> These helpers eliminate code duplication in the NMI path and prepare for
>>>> similar usage in the SEA path in a subsequent patch.
>>>>
>>>> No functional change intended.
>>>>
>>>> Tested-by: Tony Luck <tony.luck@intel.com>
>>>> Reviewed-by: Tony Luck <tony.luck@intel.com>
>>>> Signed-off-by: Shuai Xue <xueshuai@linux.alibaba.com>
>>>> ---
>>>> drivers/acpi/apei/ghes.c | 93 +++++++++++++++++++++++++++++++---------
>>>> 1 file changed, 72 insertions(+), 21 deletions(-)
>>>>
>>>> diff --git a/drivers/acpi/apei/ghes.c b/drivers/acpi/apei/ghes.c
>>>> index 0e97d50b0240..7600063fe263 100644
>>>> --- a/drivers/acpi/apei/ghes.c
>>>> +++ b/drivers/acpi/apei/ghes.c
>>>> @@ -1406,6 +1406,75 @@ static int ghes_in_nmi_spool_from_list(struct list_head *rcu_list,
>>>> return ret;
>>>> }
>>>>
>>>> +/**
>>>> + * ghes_has_active_errors - Check if there are active errors in error sources
>>>> + * @ghes_list: List of GHES entries to check for active errors
>>>> + *
>>>> + * This function iterates through all GHES entries in the given list and
>>>> + * checks if any of them has active error status by reading the error
>>>> + * status register.
>>>> + *
>>>> + * Return: true if at least one source has active error, false otherwise.
>>>> + */
>>>> +static bool __maybe_unused ghes_has_active_errors(struct list_head *ghes_list)
>>>> +{
>>>> + bool active_error = false;
>>>> + struct ghes *ghes;
>>>> +
>>>> + rcu_read_lock();
>>>
>>> Nit: Use `guard(rcu)()` instead of explicit
>>> `rcu_read_lock()`/`rcu_read_unlock()`.
>>>
>>> Thanks,
>>> Donglin
>>>
>>
>> Hi, Donglin,
>>
>> Good point. Will fix in next version.
>
> If you do so, you may also get rid of the active_error local variable.
Got it. Thanks for reminding.
Shuai
next prev parent reply other threads:[~2026-01-12 3:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-04 12:04 [PATCH v2 0/3] ACPI: APEI: GHES: Performance improvements for error notification handlers Shuai Xue
2026-01-04 12:04 ` [PATCH v2 1/3] ACPI: APEI: GHES: Improve ghes_notify_nmi() status check Shuai Xue
2026-01-04 12:04 ` [PATCH v2 2/3] ACPI: APEI: GHES: Extract helper functions for error status handling Shuai Xue
2026-01-05 5:12 ` Donglin Peng
2026-01-05 5:41 ` Shuai Xue
2026-01-09 21:22 ` Rafael J. Wysocki
2026-01-12 2:57 ` Shuai Xue [this message]
2026-01-04 12:04 ` [PATCH v2 3/3] ACPI: APEI: GHES: Improve ghes_notify_sea() status check 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=c164959b-6d51-4a6d-af3f-8c44106f57d3@linux.alibaba.com \
--to=xueshuai@linux.alibaba.com \
--cc=Smita.KoralahalliChannabasappa@amd.com \
--cc=baolin.wang@linux.alibaba.com \
--cc=benjamin.cheatham@amd.com \
--cc=bp@alien8.de \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dolinux.peng@gmail.com \
--cc=guohanjun@huawei.com \
--cc=james.morse@arm.com \
--cc=leitao@debian.org \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=pengdonglin@xiaomi.com \
--cc=rafael@kernel.org \
--cc=tony.luck@intel.com \
--cc=yazen.ghannam@amd.com \
--cc=zhuo.song@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
all inboxes | Powered by JetHome®