From patchwork Tue Jun 28 16:47:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Kuznetsov X-Patchwork-Id: 9203633 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 68F386075F for ; Tue, 28 Jun 2016 16:50:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5884D285DF for ; Tue, 28 Jun 2016 16:50:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 499422860E; Tue, 28 Jun 2016 16:50:03 +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 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 A6D15285DF for ; Tue, 28 Jun 2016 16:50:02 +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 1bHwBO-00043D-2I; Tue, 28 Jun 2016 16:48:18 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bHwBM-000423-JF for xen-devel@lists.xenproject.org; Tue, 28 Jun 2016 16:48:16 +0000 Received: from [193.109.254.147] by server-14.bemta-14.messagelabs.com id 12/63-27600-F4AA2775; Tue, 28 Jun 2016 16:48:15 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrCLMWRWlGSWpSXmKPExsVysWW7jK7/qqJ wg/4trBbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8ak6etZC6bxVyyY1cfWwPicp4uRi0NIYDeT xNSeVYwQzhFGiZm3tgM5nBxsAjoS35+eYgaxRQSUJO6tmswEUsQsMIVZ4vPG7awgCWGBbInjZ y4DJTg4WARUJSZ1KIOEeQWcJG6cXMcOYnMKOEt8bt8GZgsBxU+smMcGYksIaEs8vzCZHWSmhE Afo8S3JUfYJjDyLGBkWMWoUZxaVJZapGtoopdUlJmeUZKbmJmjawjk5qYWFyemp+YkJhXrJef nbmIE+r6egYFxB+P3056HGCU5mJREeb/1FoUL8SXlp1RmJBZnxBeV5qQWH2KU4eBQkuCVXgmU EyxKTU+tSMvMAQYhTFqCg0dJhPfZCqA0b3FBYm5xZjpE6hSjopQ473mQhABIIqM0D64NFviXG GWlhHkZGRgYhHgKUotyM0tQ5V8xinMwKglDbOfJzCuBm/4KaDET0GLW6nyQxSWJCCmpBkbfpV +cLW6L6H950OXB69P756H+y07TCB8f/lNXzk49ULzzBnvTgx6jcz1STBrGfcxTW0yOuzIbTV8 uvmzng7e9CjWpSXuYDrZv4Nj9h7ds1s2YSRXC/R1sotFBXKdPCVce+bvszONlW30UfyZcfiGy /sOM8y9kK7caVP+8v7/18YtNimyb7mUrsRRnJBpqMRcVJwIA51uRJXcCAAA= X-Env-Sender: vkuznets@redhat.com X-Msg-Ref: server-10.tower-27.messagelabs.com!1467132493!50694662!1 X-Originating-IP: [209.132.183.28] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMjA5LjEzMi4xODMuMjggPT4gNTQwNjQ=\n X-StarScan-Received: X-StarScan-Version: 8.46; banners=-,-,- X-VirusChecked: Checked Received: (qmail 34144 invoked from network); 28 Jun 2016 16:48:14 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by server-10.tower-27.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 28 Jun 2016 16:48:14 -0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 071AA804E1; Tue, 28 Jun 2016 16:47:43 +0000 (UTC) Received: from vitty.brq.redhat.com (vitty.brq.redhat.com [10.34.26.3]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u5SGlUI9004662; Tue, 28 Jun 2016 12:47:40 -0400 From: Vitaly Kuznetsov To: xen-devel@lists.xenproject.org Date: Tue, 28 Jun 2016 18:47:25 +0200 Message-Id: <1467132449-1030-5-git-send-email-vkuznets@redhat.com> In-Reply-To: <1467132449-1030-1-git-send-email-vkuznets@redhat.com> References: <1467132449-1030-1-git-send-email-vkuznets@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Tue, 28 Jun 2016 16:47:43 +0000 (UTC) Cc: Juergen Gross , Stefano Stabellini , x86@kernel.org, linux-kernel@vger.kernel.org, Julien Grall , Ingo Molnar , David Vrabel , "H. Peter Anvin" , Boris Ostrovsky , Thomas Gleixner Subject: [Xen-devel] [PATCH linux 4/8] x86/xen: use xen_vcpu_id mapping when pointing vcpu_info to the shared_info page 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 shared_info page has space for 32 vcpu info slots for first 32 vCPUs but these are the first 32 vCPUs from Xen's perspective and we should map them accordingly with the newly introduced xen_vcpu_id mapping. Signed-off-by: Vitaly Kuznetsov --- arch/x86/xen/enlighten.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c index 69f4c0c..1596626 100644 --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -189,6 +189,7 @@ static void xen_vcpu_setup(int cpu) struct vcpu_register_vcpu_info info; int err; struct vcpu_info *vcpup; + int xen_cpu = per_cpu(xen_vcpu_id, cpu); BUG_ON(HYPERVISOR_shared_info == &xen_dummy_shared_info); @@ -207,8 +208,9 @@ static void xen_vcpu_setup(int cpu) if (per_cpu(xen_vcpu, cpu) == &per_cpu(xen_vcpu_info, cpu)) return; } - if (cpu < MAX_VIRT_CPUS) - per_cpu(xen_vcpu,cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu]; + if (xen_cpu < MAX_VIRT_CPUS) + per_cpu(xen_vcpu, cpu) = + &HYPERVISOR_shared_info->vcpu_info[xen_cpu]; if (!have_vcpu_info_placement) { if (cpu >= MAX_VIRT_CPUS) @@ -1752,7 +1754,7 @@ asmlinkage __visible void __init xen_start_kernel(void) void __ref xen_hvm_init_shared_info(void) { - int cpu; + int cpu, xen_cpu; struct xen_add_to_physmap xatp; static struct shared_info *shared_info_page = 0; @@ -1777,10 +1779,13 @@ void __ref xen_hvm_init_shared_info(void) * online but xen_hvm_init_shared_info is run at resume time too and * in that case multiple vcpus might be online. */ for_each_online_cpu(cpu) { + xen_cpu = per_cpu(xen_vcpu_id, cpu); + /* Leave it to be NULL. */ - if (cpu >= MAX_VIRT_CPUS) + if (xen_cpu >= MAX_VIRT_CPUS) continue; - per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu]; + per_cpu(xen_vcpu, cpu) = + &HYPERVISOR_shared_info->vcpu_info[xen_cpu]; } }