From patchwork Thu Jan 26 18:12:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mohit Gambhir X-Patchwork-Id: 9539933 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 7CE87604A0 for ; Thu, 26 Jan 2017 18:15:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 78B9226B39 for ; Thu, 26 Jan 2017 18:15:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6D37028178; Thu, 26 Jan 2017 18:15:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 54AD626B39 for ; Thu, 26 Jan 2017 18:15:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cWoXP-0000FX-64; Thu, 26 Jan 2017 18:12:47 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cWoXN-0000FR-91 for xen-devel@lists.xenproject.org; Thu, 26 Jan 2017 18:12:45 +0000 Received: from [193.109.254.147] by server-10.bemta-6.messagelabs.com id BA/C3-13192-C1C3A885; Thu, 26 Jan 2017 18:12:44 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrJIsWRWlGSWpSXmKPExsUyZ7p8oK6MTVe EwccPHBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8bPt5/ZC07yV/TMcWpg7OXtYuTiEBKYyCTR /XsqC4Tzl1FicttUJghnI6PE1VuHoDLbGSVWzOtn7GLk5GAT0JPYtGYxO4jNL6Ag0dP1kxmkS ETgCqPExllLwBLCAvYSMybMA7N5BWwlTn07CWazCKhKPPyzmg3EFhUIl+jYdQ2qRlDi5MwnLC A2s4CZxLzND5khbHmJ7W/ngNkSAoYSpx9uY5zAyD8LScssJC2zkLQsYGRexahRnFpUllqka2S ql1SUmZ5RkpuYmaNraGCml5taXJyYnpqTmFSsl5yfu4kRGIwMQLCDcdWCwEOMkhxMSqK8jSpd EUJ8SfkplRmJxRnxRaU5qcWHGGU4OJQkeA2sgXKCRanpqRVpmTnAuIBJS3DwKInwHrcCSvMWF yTmFmemQ6ROMepynLpx+iWTEEtefl6qlDjvUZAiAZCijNI8uBGwGL3EKCslzMsIdJQQT0FqUW 5mCar8K0ZxDkYlYd5AkCk8mXklcJteAR3BBHTEBeZ2kCNKEhFSUg2MUydZ1v0zXtezv6whYuE l20uGUU+0OXerLl/bdebZvlUyypmmgnqbSvJm3Fc94PB692KtIzaPOb72PUubmGvVE7ti07au 6Sw2cnplOu1dqgbv5mV6bPutPvVRjoW515NEjdnz7YO/t/LG9+TaKqpcnHP4VI7hT1fHGTOsf nF8tLPZrmalE6OjxFKckWioxVxUnAgA1KILL8wCAAA= X-Env-Sender: mohit.gambhir@oracle.com X-Msg-Ref: server-8.tower-27.messagelabs.com!1485454362!73655827!1 X-Originating-IP: [156.151.31.81] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTU2LjE1MS4zMS44MSA9PiAyODgzMzk=\n X-StarScan-Received: X-StarScan-Version: 9.1.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 52863 invoked from network); 26 Jan 2017 18:12:43 -0000 Received: from userp1040.oracle.com (HELO userp1040.oracle.com) (156.151.31.81) by server-8.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 26 Jan 2017 18:12:43 -0000 Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id v0QICVee015010 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Jan 2017 18:12:31 GMT Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id v0QICUAR031531 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 26 Jan 2017 18:12:31 GMT Received: from abhmp0018.oracle.com (abhmp0018.oracle.com [141.146.116.24]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id v0QICTrn006866; Thu, 26 Jan 2017 18:12:29 GMT Received: from dhcp-burlington9-3rd-A-east-10-152-23-100.usdhcp.oraclecorp.com (/10.152.23.100) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 26 Jan 2017 10:12:28 -0800 From: Mohit Gambhir Organization: Oracle Corporation To: Boris Ostrovsky , jgross@suse.com, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Message-ID: Date: Thu, 26 Jan 2017 13:12:27 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 X-Source-IP: userv0021.oracle.com [156.151.31.71] Subject: [Xen-devel] [PATCH] x86/xen: Fix APIC id mismatch warning on Intel X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Juergen Gross --- 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; }