From patchwork Thu Nov 10 14:50:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Boris Ostrovsky X-Patchwork-Id: 9421121 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 439C2601C0 for ; Thu, 10 Nov 2016 14:52:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34151296B7 for ; Thu, 10 Nov 2016 14:52:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 273EA296A8; Thu, 10 Nov 2016 14:52:40 +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 2E314296A8 for ; Thu, 10 Nov 2016 14:52:38 +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 1c4qgW-00016C-Cd; Thu, 10 Nov 2016 14:50:36 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c4qgV-000164-Cv for xen-devel@lists.xen.org; Thu, 10 Nov 2016 14:50:35 +0000 Received: from [85.158.139.211] by server-3.bemta-5.messagelabs.com id 66/0F-04344-A3984285; Thu, 10 Nov 2016 14:50:34 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRWlGSWpSXmKPExsXSO6nOVdeyUyX CYNU9QYslHxezODB6HN39mymAMYo1My8pvyKBNeP3xeyCg1wVN9tWMzcwbuToYuTiEBLoYJJ4 +nA+I4TzhVHib8NbNghnI5DTuIUZwpnAKPG14ThQhpODTcBI4uzR6YwgtoiAtMS1z5fB2pkFm hkl1iz9w9TFyMEhLBAmcXmDLYjJIqAq8ecNF0g5r4CHxMftP1hBbAkBOYmb5zqZIWxjib5ZfS wTGHkWMDKsYlQvTi0qSy3SNdRLKspMzyjJTczM0TU0MNXLTS0uTkxPzUlMKtZLzs/dxAj0ez0 DA+MOxqZe50OMkhxMSqK8OwJUIoT4kvJTKjMSizPii0pzUosPMcpwcChJ8Ha1A+UEi1LTUyvS MnOAAQiTluDgURLhXQGS5i0uSMwtzkyHSJ1iVJQS550JkhAASWSU5sG1wYL+EqOslDAvIwMDg xBPQWpRbmYJqvwrRnEORiVh3hMgU3gy80rgpr8CWswEtHhGHNjikkSElFQDo8eDTcVxuw/cKj KTfTx1WpJdK6/Hu6DeP3y8OzduYH5rynNv4ffmLV+X8K9+8Khvd/aO65u2FWeuldq16enmfM/ e6enV3jYrF3T/MVB/FTHpiPT9+LaYCbck3hgGZP4zjrDKvKnx/MFfM/vAmzvmNj1utHt0KmBH noxXhU3NNfeqTckHp5i65iqxFGckGmoxFxUnAgBLZfNOdQIAAA== X-Env-Sender: boris.ostrovsky@oracle.com X-Msg-Ref: server-2.tower-206.messagelabs.com!1478789430!51117604!1 X-Originating-IP: [141.146.126.69] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTQxLjE0Ni4xMjYuNjkgPT4gMjc3MjE4\n X-StarScan-Received: X-StarScan-Version: 9.0.13; banners=-,-,- X-VirusChecked: Checked Received: (qmail 23943 invoked from network); 10 Nov 2016 14:50:32 -0000 Received: from aserp1040.oracle.com (HELO aserp1040.oracle.com) (141.146.126.69) by server-2.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 10 Nov 2016 14:50:32 -0000 Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by aserp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id uAAEoSYA028452 (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 10 Nov 2016 14:50:28 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.13.8/8.13.8) with ESMTP id uAAEoSbH004641 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 10 Nov 2016 14:50:28 GMT Received: from abhmp0013.oracle.com (abhmp0013.oracle.com [141.146.116.19]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id uAAEoR82021755; Thu, 10 Nov 2016 14:50:27 GMT Received: from ostr-laptop.us.oracle.com (/10.152.23.90) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 10 Nov 2016 06:50:27 -0800 From: Boris Ostrovsky To: xen-devel@lists.xen.org Date: Thu, 10 Nov 2016 09:50:24 -0500 Message-Id: <1478789424-716-1-git-send-email-boris.ostrovsky@oracle.com> X-Mailer: git-send-email 2.7.4 X-Source-IP: aserv0021.oracle.com [141.146.126.233] Cc: ian.jackson@eu.citrix.com, Boris Ostrovsky , wei.liu2@citrix.com, andrew.cooper3@citrix.com Subject: [Xen-devel] [PATCH for-4.8] libxc/x86: Report consistent initial APIC value for PV guests 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: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Currently hypervisor provides PV guest's CPUID(1).EBX[31:24] (initial APIC ID) with contents of that field on the processor that launched the guest. This results in the guest reporting different initial APIC IDs across runs. We should be consistent in how this value is reported, let's set it to 0 (which is also what Linux guests expect). Signed-off-by: Boris Ostrovsky Reviewed-by: Andrew Cooper --- I think this should go to stable branches as well. This has been causing problems lately in Linux with introduction of topology maps. tools/libxc/xc_cpuid_x86.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/libxc/xc_cpuid_x86.c b/tools/libxc/xc_cpuid_x86.c index d761805..1f26294 100644 --- a/tools/libxc/xc_cpuid_x86.c +++ b/tools/libxc/xc_cpuid_x86.c @@ -618,6 +618,12 @@ static void xc_cpuid_pv_policy(xc_interface *xch, /* Host topology exposed to PV guest. Provide host value. */ bool host_htt = regs[3] & bitmaskof(X86_FEATURE_HTT); + /* + * Don't pick host's Initial APIC ID which can change from run + * to run. + */ + regs[1] &= 0x00ffffffu; + regs[2] = info->featureset[featureword_of(X86_FEATURE_SSE3)]; regs[3] = (info->featureset[featureword_of(X86_FEATURE_FPU)] & ~bitmaskof(X86_FEATURE_HTT));