Hello Jonathan,

Thanks for the complete review !

On 11/18/26 19:54, Jonathan Cameron wrote:
On Tue, 17 Nov 2026 12:10:11 +0100
Pierre Gondois<[email protected]> wrote:

Prepare for reporting CPER Memory Error Section 2 records through MCE
by extracting apei_mce_report_mem_error_common().

No functional change.

Signed-off-by: Pierre Gondois<[email protected]>
One curious question + trivial comment inline.

Otherwise, this is a simple refactor and seems clean to me.
Reviewed-by: Jonathan Cameron<[email protected]>

---
  arch/x86/kernel/cpu/mce/apei.c | 31 +++++++++++++++++--------------
  1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kernel/cpu/mce/apei.c b/arch/x86/kernel/cpu/mce/apei.c
index 0a89947e47bc8..b993ac78a3b36 100644
--- a/arch/x86/kernel/cpu/mce/apei.c
+++ b/arch/x86/kernel/cpu/mce/apei.c
@@ -26,24 +26,15 @@
#include "internal.h" -void apei_mce_report_mem_error(int severity, struct cper_sec_mem_err *mem_err)
+static void apei_mce_report_mem_error_common(int severity, u64 physical_addr,
+                                            u64 physical_addr_mask)
  {
        struct mce_hw_err err;
        struct mce *m;
        int lsb;
- if (!(mem_err->validation_bits & CPER_MEM_VALID_PA))
-               return;
-
-       /*
-        * Even if the ->validation_bits are set for address mask,
-        * to be extra safe, check and reject an error radius '0',
-        * and fall back to the default page size.
-        */
-       if (mem_err->validation_bits & CPER_MEM_VALID_PA_MASK)
-               lsb = find_first_bit((void *)&mem_err->physical_addr_mask, 
PAGE_SHIFT);
-       else
-               lsb = PAGE_SHIFT;
+       /* Missing or zero masks default to page granularity. */
+       lsb = find_first_bit((void *)&physical_addr_mask, PAGE_SHIFT);
Silly question.  What stops it being bigger than a page?  I appreciate you
aren't changing what is already here but it made me curious.  It's 8 bytes
so limiting it to page size seems odd.

That larger usecase came up last year for how to handle error injection
into a VM that was running smaller pages than the host.

I guess on x86 it simply isn't ever bigger than one page?

I also don't really see why we could not operate on multiple pages
at the same time.



Reply via email to