lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0jgfXDf4kxpQ7v8xapZw+S8Qc7gmt3txCKN7zptHs1biA@mail.gmail.com>
Date: Fri, 9 Jan 2026 22:22:51 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Shuai Xue <xueshuai@...ux.alibaba.com>
Cc: Donglin Peng <dolinux.peng@...il.com>, tony.luck@...el.com, guohanjun@...wei.com, 
	mchehab@...nel.org, yazen.ghannam@....com, dave.jiang@...el.com, 
	Smita.KoralahalliChannabasappa@....com, leitao@...ian.org, 
	pengdonglin@...omi.com, baolin.wang@...ux.alibaba.com, 
	benjamin.cheatham@....com, bp@...en8.de, dan.j.williams@...el.com, 
	james.morse@....com, lenb@...nel.org, linux-acpi@...r.kernel.org, 
	linux-kernel@...r.kernel.org, rafael@...nel.org, zhuo.song@...ux.alibaba.com
Subject: Re: [PATCH v2 2/3] ACPI: APEI: GHES: Extract helper functions for
 error status handling

On Mon, Jan 5, 2026 at 6:42 AM Shuai Xue <xueshuai@...ux.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@...ux.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@...el.com>
> >> Reviewed-by: Tony Luck <tony.luck@...el.com>
> >> Signed-off-by: Shuai Xue <xueshuai@...ux.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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ