[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6d508036-befd-4d5c-b02e-abb228ed9144@amd.com>
Date: Mon, 3 Jun 2024 10:34:10 -0400
From: Yazen Ghannam <yazen.ghannam@....com>
To: Borislav Petkov <bp@...en8.de>
Cc: yazen.ghannam@....com, linux-edac@...r.kernel.org,
linux-kernel@...r.kernel.org, tony.luck@...el.com, x86@...nel.org,
avadhut.naik@....com, john.allen@....com
Subject: Re: [PATCH 3/3] x86/mce: Use mce_prep_record() helpers for
apei_smca_report_x86_error()
On 5/29/24 1:28 PM, Borislav Petkov wrote:
> On Tue, May 21, 2024 at 07:54:34AM -0500, Yazen Ghannam wrote:
>> Current AMD systems can report MCA errors using the ACPI Boot Error
>> Record Table (BERT). The BERT entries for MCA errors will be an x86
>> Common Platform Error Record (CPER) with an MSR register context that
>> matches the MCAX/SMCA register space.
>>
>> However, the BERT will not necessarily be processed on the CPU that
>> reported the MCA errors. Therefore, the correct CPU number needs to be
>> determined and the information saved in struct mce.
>>
>> The CPU number is determined by searching all possible CPUs for a Local
>> APIC ID matching the value in the x86 CPER.
>
> You're explaining the code again. :)
>
One day I'll break this habit. Thanks again for the reminder. :)
>> for_each_possible_cpu(cpu) {
>> - if (cpu_data(cpu).topo.initial_apicid == lapic_id) {
>> - m.extcpu = cpu;
>> - m.socketid = cpu_data(m.extcpu).topo.pkg_id;
>> + if (cpu_data(cpu).topo.initial_apicid == lapic_id)
>> break;
>> - }
>> }
>>
>> - m.apicid = lapic_id;
>> + if (!cpu_possible(cpu))
>> + return -EINVAL;
>
> What's that test for? You just iterated over the possible CPUs using
> "cpu" as the iterator there...
>
This is to catch the case where there was no break from the loop.
If there is no match during the iterator, then "cpu" will be equal to
nr_cpu_ids.
I wanted to use a helper that goes with with the iterator rather than
checking against nr_cpu_ids directly.
Thanks,
Yazen
Powered by blists - more mailing lists