From: "Jan Beulich" Subject: Re: [PATCH] x86: always store APIC ID of CPU Date: Thu, 26 Jun 2014 12:30:33 +0100 Message-ID: <53AC2079020000780001D9A7@mail.emea.novell.com> References: <53AC0E06020000780001D873@mail.emea.novell.com> <53ABFDB3.1060204@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1X07sw-0005tv-BN for xen-devel@lists.xenproject.org; Thu, 26 Jun 2014 11:30:34 +0000 In-Reply-To: <53ABFDB3.1060204@citrix.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Andrew Cooper Cc: xen-devel , Keir Fraser List-Id: xen-devel@lists.xenproject.org >>> On 26.06.14 at 13:02, wrote: > On 26/06/14 11:11, Jan Beulich wrote: >> +/* >> + * cpuid returns the value latched in the HW at reset, not the APIC ID >> + * register's value. For any box whose BIOS changes APIC IDs, like >> + * clustered APIC systems, we must use hard_smp_processor_id. >> + * >> + * See Intel's IA-32 SW Dev's Manual Vol2 under CPUID. >> + */ >> +static inline u32 phys_pkg_id(u32 cpuid_apic, int index_msb) > > What is the point of the cpuid_apic parameter? It is unused. > > index_msb should probably be unsigned as it is used to shift with. For both of these - yes, I agree, but no, I don't want to change this here (I'm just moving the function up after all). The history of this is a bit difficult to interpret: Before in change in 2006 some variants of this function used both inputs, but some didn't. I suppose Keir didn't want to risk breaking clustered APIC systems, albeit as far as I looked only Summit systems were actually ignoring the passed in APIC ID, and we're not supporting these anymore. As to shift counts, I don't think it really matters whether they're signed or unsigned, as anything outside the range [0,bitwidth-1] produce undefined operations anyway. Jan