lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Tue, 25 Jun 2024 21:42:12 -0400
From: Yazen Ghannam <yazen.ghannam@....com>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: 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 v2 1/5] x86/topology: Export helper to get CPU number
 from APIC ID

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ