From: Yazen Ghannam <yazen.ghannam@amd.com>
To: Borislav Petkov <bp@alien8.de>
Cc: yazen.ghannam@amd.com, linux-edac@vger.kernel.org,
linux-kernel@vger.kernel.org, tony.luck@intel.com,
x86@kernel.org, avadhut.naik@amd.com, john.allen@amd.com
Subject: Re: [PATCH 3/3] x86/mce: Use mce_prep_record() helpers for apei_smca_report_x86_error()
Date: Mon, 3 Jun 2024 10:34:10 -0400 [thread overview]
Message-ID: <6d508036-befd-4d5c-b02e-abb228ed9144@amd.com> (raw)
In-Reply-To: <20240529172809.GJZldlqSr5km0frQ_o@fat_crate.local>
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
next prev parent reply other threads:[~2024-06-03 14:34 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-21 12:54 [PATCH 0/3] Rework mce_setup() Yazen Ghannam
2024-05-21 12:54 ` [PATCH 1/3] x86/mce: Rename mce_setup() to mce_prep_record() Yazen Ghannam
2024-05-21 12:54 ` [PATCH 2/3] x86/mce: Define mce_prep_record() helpers for common and per-CPU fields Yazen Ghannam
2024-05-21 12:54 ` [PATCH 3/3] x86/mce: Use mce_prep_record() helpers for apei_smca_report_x86_error() Yazen Ghannam
2024-05-29 17:28 ` Borislav Petkov
2024-06-03 14:34 ` Yazen Ghannam [this message]
2024-06-03 16:55 ` Borislav Petkov
2024-06-14 21:47 ` Yazen Ghannam
2024-06-14 22:44 ` Borislav Petkov
2024-06-18 15:11 ` Yazen Ghannam
2024-06-18 17:24 ` Yazen Ghannam
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=6d508036-befd-4d5c-b02e-abb228ed9144@amd.com \
--to=yazen.ghannam@amd.com \
--cc=avadhut.naik@amd.com \
--cc=bp@alien8.de \
--cc=john.allen@amd.com \
--cc=linux-edac@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
/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