Skip to content

GHES: Add a notify chain for process memory section.#1804

Closed
wangchenlu2236 wants to merge 1 commit into
deepin-community:linux-6.6.yfrom
wangchenlu2236:ras-6.6.y
Closed

GHES: Add a notify chain for process memory section.#1804
wangchenlu2236 wants to merge 1 commit into
deepin-community:linux-6.6.yfrom
wangchenlu2236:ras-6.6.y

Conversation

@wangchenlu2236
Copy link
Copy Markdown
Contributor

@wangchenlu2236 wangchenlu2236 commented Jun 3, 2026

Add a notify chain for process memory section, with which other modules might do error recovery.

Summary by Sourcery

Introduce a notifier chain for reporting GHES platform memory errors so other modules can react to process memory error events.

New Features:

  • Expose a new atomic notifier chain for GHES memory errors via a globally exported symbol.

Enhancements:

  • Extend GHES processing of platform memory error sections to populate and pass structured context about the notification type and severity to listeners via the new notifier chain.

Add a notify chain for process memory section, with which
other modules might do error recovery.

Signed-off-by: Xie XiuQi <xiexiuqi@huawei.com>
Tested-by: Wang Xiongfeng <wangxiongfeng2@huawei.com>
Tested-by: Tyler Baicar <tbaicar@codeaurora.org>
Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Tested-by: Peng Min <pengmin1540@phytium.com.cn>
Signed-off-by: Wang Yinfeng <wangyinfeng@phytium.com.cn>
Signed-off-by: Wang Chenlu <wangchenlu2236@phytium.com.cn>
@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Jun 3, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Introduces a new atomic notifier chain for GHES-processed platform memory errors and propagates rich context about each memory error (notification type, severity, and CPER payload) to external modules for error recovery.

Sequence diagram for GHES memory error notify chain usage

sequenceDiagram
    participant ExternalModule
    participant ghes_mem_err_chain
    participant GHES

    ExternalModule->>ghes_mem_err_chain: atomic_notifier_chain_register(ghes_mem_err_chain, notifier_block)
    GHES->>GHES: ghes_do_proc(ghes)
    GHES->>ghes_mem_err_chain: atomic_notifier_call_chain(ghes_mem_err_chain, severity, ghes_mem_err)
    ghes_mem_err_chain->>ExternalModule: notifier_block.callback(ghes_mem_err)
Loading

File-Level Changes

Change Details Files
Add a dedicated atomic notifier chain for GHES platform memory errors and populate a context struct for callbacks.
  • Define and export a global atomic notifier head for GHES memory errors to allow other modules to register for notifications.
  • Introduce a ghes_mem_err context structure carrying notify type, error severity, and the CPER memory error section pointer.
  • Populate the ghes_mem_err structure when handling CPER_SEC_PLATFORM_MEM records in ghes_do_proc, using the GHES notification type and the section severity.
drivers/acpi/apei/ghes.c
include/acpi/ghes.h

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@deepin-ci-robot
Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign avenger-285714 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@deepin-ci-robot
Copy link
Copy Markdown

Hi @wangchenlu2236. Thanks for your PR.

I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@opsiff
Copy link
Copy Markdown
Member

opsiff commented Jun 3, 2026

I think that there are them from xiexiuqi@openeuler kernel:
https://lore.kernel.org/all/1516969885-150532-1-git-send-email-xiexiuqi@huawei.com/
I see there is in olk 4.19 but not 5.10 or 6.6, please submit to openeuler first.

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • The new ghes_mem_err_chain notifier and struct ghes_mem_err are defined but the code still calls atomic_notifier_call_chain(&ghes_report_chain, sev, mem_err), so consider switching this call to use ghes_mem_err_chain and pass a ghes_mem_err instance to actually exercise the new interface.
  • If notifier callbacks are expected to access the ghes_mem_err beyond the duration of ghes_do_proc, you may want to clarify/adjust the lifetime of the struct ghes_mem_err mem (currently stack-allocated) to avoid use-after-return issues.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The new `ghes_mem_err_chain` notifier and `struct ghes_mem_err` are defined but the code still calls `atomic_notifier_call_chain(&ghes_report_chain, sev, mem_err)`, so consider switching this call to use `ghes_mem_err_chain` and pass a `ghes_mem_err` instance to actually exercise the new interface.
- If notifier callbacks are expected to access the `ghes_mem_err` beyond the duration of `ghes_do_proc`, you may want to clarify/adjust the lifetime of the `struct ghes_mem_err mem` (currently stack-allocated) to avoid use-after-return issues.

## Individual Comments

### Comment 1
<location path="drivers/acpi/apei/ghes.c" line_range="706-714" />
<code_context>

 		if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) {
 			struct cper_sec_mem_err *mem_err = acpi_hest_get_payload(gdata);
+			struct ghes_mem_err mem;
+
+			mem.notify_type = ghes->generic->notify.type;
+			mem.severity = gdata->error_severity;
+			mem.mem_err = mem_err;

 			atomic_notifier_call_chain(&ghes_report_chain, sev, mem_err);

</code_context>
<issue_to_address>
**issue (bug_risk):** New `ghes_mem_err` wrapper is never used and `ghes_mem_err_chain` is not called here.

You construct and populate `struct ghes_mem_err mem` but still call `atomic_notifier_call_chain(&ghes_report_chain, sev, mem_err);` with the old chain and the original `mem_err` pointer. As a result, the new wrapper and `ghes_mem_err_chain` are unused at this site and no behavior changes.

If the goal is to pass the richer context, this should likely call:

```c
atomic_notifier_call_chain(&ghes_mem_err_chain, sev, &mem);
```

Otherwise, consider removing `struct ghes_mem_err` here to avoid dead code and API confusion.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread drivers/acpi/apei/ghes.c
Comment on lines 706 to 714
if (guid_equal(sec_type, &CPER_SEC_PLATFORM_MEM)) {
struct cper_sec_mem_err *mem_err = acpi_hest_get_payload(gdata);
struct ghes_mem_err mem;

mem.notify_type = ghes->generic->notify.type;
mem.severity = gdata->error_severity;
mem.mem_err = mem_err;

atomic_notifier_call_chain(&ghes_report_chain, sev, mem_err);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): New ghes_mem_err wrapper is never used and ghes_mem_err_chain is not called here.

You construct and populate struct ghes_mem_err mem but still call atomic_notifier_call_chain(&ghes_report_chain, sev, mem_err); with the old chain and the original mem_err pointer. As a result, the new wrapper and ghes_mem_err_chain are unused at this site and no behavior changes.

If the goal is to pass the richer context, this should likely call:

atomic_notifier_call_chain(&ghes_mem_err_chain, sev, &mem);

Otherwise, consider removing struct ghes_mem_err here to avoid dead code and API confusion.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to add a new notifier mechanism for GHES processing of platform memory error sections, so other kernel modules can observe (and potentially react to) these events with additional context beyond the existing ghes_report_chain callback payload.

Changes:

  • Introduces a new struct ghes_mem_err context struct in include/acpi/ghes.h.
  • Adds and exports a new ghes_mem_err_chain atomic notifier head in drivers/acpi/apei/ghes.c.
  • Extends GHES memory-section processing to populate the new context struct (but currently does not notify the new chain).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
include/acpi/ghes.h Adds a new GHES memory-error context struct and declares an exported atomic notifier chain.
drivers/acpi/apei/ghes.c Defines/exports the notifier chain and prepares a structured memory-error context during section processing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread drivers/acpi/apei/ghes.c
Comment on lines 707 to 714
struct cper_sec_mem_err *mem_err = acpi_hest_get_payload(gdata);
struct ghes_mem_err mem;

mem.notify_type = ghes->generic->notify.type;
mem.severity = gdata->error_severity;
mem.mem_err = mem_err;

atomic_notifier_call_chain(&ghes_report_chain, sev, mem_err);
@wangchenlu2236 wangchenlu2236 deleted the ras-6.6.y branch June 4, 2026 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants