linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/xen: Fix APIC id mismatch warning on Intel
@ 2017-01-26 18:12 Mohit Gambhir
  2017-01-27 10:27 ` Juergen Gross
  2017-01-30  2:58 ` Boris Ostrovsky
  0 siblings, 2 replies; 3+ messages in thread
From: Mohit Gambhir @ 2017-01-26 18:12 UTC (permalink / raw)
  To: Boris Ostrovsky, jgross, tglx, mingo, hpa, x86, xen-devel, linux-kernel

This patch fixes the following warning message seen when booting the
kernel as Dom0 with Xen on Intel machines.

[0.003000] [Firmware Bug]: CPU1: APIC id mismatch. Firmware: 0 APIC: 1]

The code generating the warning in validate_apic_and_package_id() matches
cpu_data(cpu).apicid (initialized in init_intel()->
detect_extended_topology() using cpuid) against the apicid returned from
xen_apic_read(). Now, xen_apic_read() makes a hypercall to retrieve apicid
for the boot  cpu but returns 0 otherwise. Hence the warning gets thrown
for all but the boot cpu.

The idea behind xen_apic_read() returning 0 for apicid is that the
guests (even Dom0) should not need to know what physical processor their
vcpus are running on. This is because we currently  do not have topology
information in Xen and also because xen allows more vcpus than physical
processors. However, boot cpu's apicid is required for loading
xen-acpi-processor driver on AMD machines. Look at following patch for
details:

commit 558daa289a40 ("xen/apic: Return the APIC ID (and version) for CPU
0.")

So to get rid of the warning, this patch modifies
xen_cpu_present_to_apicid() to return cpu_data(cpu).apicid instead of
calling xen_apic_read().

The warning is not seen on AMD machines because init_amd() populates
cpu_data(cpu).apicid by calling hard_smp_processor_id()->xen_apic_read()
as opposed to using apicid from cpuid as is done on Intel machines.

Signed-off-by: Mohit Gambhir <mohit.gambhir@oracle.com>
---
  arch/x86/xen/apic.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/xen/apic.c b/arch/x86/xen/apic.c
index 44c88ad..bcea81f 100644
--- a/arch/x86/xen/apic.c
+++ b/arch/x86/xen/apic.c
@@ -145,7 +145,7 @@ static void xen_silent_inquire(int apicid)
  static int xen_cpu_present_to_apicid(int cpu)
  {
      if (cpu_present(cpu))
-        return xen_get_apic_id(xen_apic_read(APIC_ID));
+        return cpu_data(cpu).apicid;
      else
          return BAD_APICID;
  }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/xen: Fix APIC id mismatch warning on Intel
  2017-01-26 18:12 [PATCH] x86/xen: Fix APIC id mismatch warning on Intel Mohit Gambhir
@ 2017-01-27 10:27 ` Juergen Gross
  2017-01-30  2:58 ` Boris Ostrovsky
  1 sibling, 0 replies; 3+ messages in thread
From: Juergen Gross @ 2017-01-27 10:27 UTC (permalink / raw)
  To: Mohit Gambhir, Boris Ostrovsky, tglx, mingo, hpa, x86, xen-devel,
	linux-kernel

On 26/01/17 19:12, Mohit Gambhir wrote:
> This patch fixes the following warning message seen when booting the
> kernel as Dom0 with Xen on Intel machines.
> 
> [0.003000] [Firmware Bug]: CPU1: APIC id mismatch. Firmware: 0 APIC: 1]
> 
> The code generating the warning in validate_apic_and_package_id() matches
> cpu_data(cpu).apicid (initialized in init_intel()->
> detect_extended_topology() using cpuid) against the apicid returned from
> xen_apic_read(). Now, xen_apic_read() makes a hypercall to retrieve apicid
> for the boot  cpu but returns 0 otherwise. Hence the warning gets thrown
> for all but the boot cpu.
> 
> The idea behind xen_apic_read() returning 0 for apicid is that the
> guests (even Dom0) should not need to know what physical processor their
> vcpus are running on. This is because we currently  do not have topology
> information in Xen and also because xen allows more vcpus than physical
> processors. However, boot cpu's apicid is required for loading
> xen-acpi-processor driver on AMD machines. Look at following patch for
> details:
> 
> commit 558daa289a40 ("xen/apic: Return the APIC ID (and version) for CPU
> 0.")
> 
> So to get rid of the warning, this patch modifies
> xen_cpu_present_to_apicid() to return cpu_data(cpu).apicid instead of
> calling xen_apic_read().
> 
> The warning is not seen on AMD machines because init_amd() populates
> cpu_data(cpu).apicid by calling hard_smp_processor_id()->xen_apic_read()
> as opposed to using apicid from cpuid as is done on Intel machines.
> 
> Signed-off-by: Mohit Gambhir <mohit.gambhir@oracle.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Thanks,

Juergen

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/xen: Fix APIC id mismatch warning on Intel
  2017-01-26 18:12 [PATCH] x86/xen: Fix APIC id mismatch warning on Intel Mohit Gambhir
  2017-01-27 10:27 ` Juergen Gross
@ 2017-01-30  2:58 ` Boris Ostrovsky
  1 sibling, 0 replies; 3+ messages in thread
From: Boris Ostrovsky @ 2017-01-30  2:58 UTC (permalink / raw)
  To: Mohit Gambhir, jgross, tglx, mingo, hpa, x86, xen-devel, linux-kernel



On 01/26/2017 01:12 PM, Mohit Gambhir wrote:
> This patch fixes the following warning message seen when booting the
> kernel as Dom0 with Xen on Intel machines.
>
> [0.003000] [Firmware Bug]: CPU1: APIC id mismatch. Firmware: 0 APIC: 1]
>
> The code generating the warning in validate_apic_and_package_id() matches
> cpu_data(cpu).apicid (initialized in init_intel()->
> detect_extended_topology() using cpuid) against the apicid returned from
> xen_apic_read(). Now, xen_apic_read() makes a hypercall to retrieve apicid
> for the boot  cpu but returns 0 otherwise. Hence the warning gets thrown
> for all but the boot cpu.
>
> The idea behind xen_apic_read() returning 0 for apicid is that the
> guests (even Dom0) should not need to know what physical processor their
> vcpus are running on. This is because we currently  do not have topology
> information in Xen and also because xen allows more vcpus than physical
> processors. However, boot cpu's apicid is required for loading
> xen-acpi-processor driver on AMD machines. Look at following patch for
> details:
>
> commit 558daa289a40 ("xen/apic: Return the APIC ID (and version) for CPU
> 0.")
>
> So to get rid of the warning, this patch modifies
> xen_cpu_present_to_apicid() to return cpu_data(cpu).apicid instead of
> calling xen_apic_read().
>
> The warning is not seen on AMD machines because init_amd() populates
> cpu_data(cpu).apicid by calling hard_smp_processor_id()->xen_apic_read()
> as opposed to using apicid from cpuid as is done on Intel machines.
>
> Signed-off-by: Mohit Gambhir <mohit.gambhir@oracle.com>



Applied to for-linus-4.11.

-boris

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-30  2:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-26 18:12 [PATCH] x86/xen: Fix APIC id mismatch warning on Intel Mohit Gambhir
2017-01-27 10:27 ` Juergen Gross
2017-01-30  2:58 ` Boris Ostrovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).