All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yazen Ghannam <yazen.ghannam@amd.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: 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 v2 1/5] x86/topology: Export helper to get CPU number from APIC ID
Date: Tue, 25 Jun 2024 21:42:12 -0400	[thread overview]
Message-ID: <20240626014212.GA1086@yaz-khff2.amd.com> (raw)
In-Reply-To: <87ed8l7byy.ffs@tglx>

On Tue, Jun 25, 2024 at 08:50:13AM +0200, Thomas Gleixner wrote:
> On Mon, Jun 24 2024 at 16:20, Yazen Ghannam wrote:
> 
> > The need to look up a CPU number from an APIC ID is done in at least one
> > other place outside of APIC/topology code:
> > apei_smca_report_x86_error().
> 
> The need .... is done?

Hmm, yeah the wording isn't clear. I'll rephrase it.

> 
> >  #ifdef CONFIG_X86_LOCAL_APIC
> >  int topology_get_logical_id(u32 apicid, enum x86_topology_domains at_level);
> > +int topology_get_cpunr(u32 apic_id);
> >  #else
> >  static inline int topology_get_logical_id(u32 apicid, enum x86_topology_domains at_level)
> >  {
> >  	return 0;
> >  }
> > +
> > +static inline int topology_get_cpunr(u32 apic_id)
> > +{
> > +	return -ENODEV;
> 
> Why ENODEV and not 0?
>

Since '0' is a valid CPU number, my first thought was that we should
return an error code if we can't explicitly find the correct CPU number.

But would/could we have SMP support without X86_LOCAL_APIC? If not, then
we'd only have CPU 0 in any case. Is this why the function above returns
0?

I can make the change to return 0 here also. But...

The MCE code depends on X86_LOCAL_APIC, and it is the only external
user. So should I drop the config check and export?

Thanks,
Yazen

  reply	other threads:[~2024-06-26  1:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-24 21:20 [PATCH v2 0/5] Rework mce_setup() Yazen Ghannam
2024-06-24 21:20 ` [PATCH v2 1/5] x86/topology: Export helper to get CPU number from APIC ID Yazen Ghannam
2024-06-25  6:50   ` Thomas Gleixner
2024-06-26  1:42     ` Yazen Ghannam [this message]
2024-06-28  8:37       ` Borislav Petkov
2024-06-28 14:15         ` Yazen Ghannam
2024-06-28 14:45           ` Borislav Petkov
2024-07-01 17:51             ` Yazen Ghannam
2024-07-01 19:07               ` Borislav Petkov
2024-07-12 14:28                 ` Yazen Ghannam
2024-06-24 21:20 ` [PATCH v2 2/5] x86/mce: Fixup APIC ID search for x86 CPER decoding Yazen Ghannam
2024-06-25  6:50   ` Thomas Gleixner
2024-06-26  1:44     ` Yazen Ghannam
2024-06-24 21:20 ` [PATCH v2 3/5] x86/mce: Rename mce_setup() to mce_prep_record() Yazen Ghannam
2024-06-24 21:20 ` [PATCH v2 4/5] x86/mce: Define mce_prep_record() helpers for common and per-CPU fields Yazen Ghannam
2024-06-25 13:19   ` Nikolay Borisov
2024-06-26  1:45     ` Yazen Ghannam
2024-06-24 21:20 ` [PATCH v2 5/5] x86/mce: Use mce_prep_record() helpers for apei_smca_report_x86_error() 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=20240626014212.GA1086@yaz-khff2.amd.com \
    --to=yazen.ghannam@amd.com \
    --cc=avadhut.naik@amd.com \
    --cc=john.allen@amd.com \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.