From patchwork Thu Mar 2 17:53:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vitaly Kuznetsov X-Patchwork-Id: 9601247 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 073DC60522 for ; Thu, 2 Mar 2017 17:56:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1E11285CB for ; Thu, 2 Mar 2017 17:56:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6F90285CC; Thu, 2 Mar 2017 17:56:12 +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 99F88285CD for ; Thu, 2 Mar 2017 17:56:12 +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 1cjUvl-0003aX-3v; Thu, 02 Mar 2017 17:54:21 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cjUvj-0003XU-9r for xen-devel@lists.xenproject.org; Thu, 02 Mar 2017 17:54:19 +0000 Received: from [85.158.143.35] by server-10.bemta-6.messagelabs.com id 51/5E-13192-A4C58B85; Thu, 02 Mar 2017 17:54:18 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPLMWRWlGSWpSXmKPExsVysWW7jK5HzI4 Ig3ffeCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1oznB/8yFbwRq3j0ZQ57A+Mx4S5GLg4hgd1M Eku3nmKHcA4zStz895axi5GTg01AR+L701PMILaIgJLEvVWTmUCKmAU2MUo8aD3NDpIQFnCW+ LF3IyuIzSKgKrHy2XmwZl4Bc4nlO2+BNXMKWEjcnHQZLC4EFJ90ZQZYvYSAtsTZhl/sEHYfo8 SaHocJjDwLGBlWMaoXpxaVpRbpGuklFWWmZ5TkJmbm6BoamOnlphYXJ6an5iQmFesl5+duYgR 6ngEIdjAu++t0iFGSg0lJlNcqekeEEF9SfkplRmJxRnxRaU5q8SFGGQ4OJQneepCcYFFqempF WmYOMARh0hIcPEoivPdA0rzFBYm5xZnpEKlTjLocc2bvfsMkxJKXn5cqJc7LCVIkAFKUUZoHN wIWD5cYZaWEeRmBjhLiKUgtys0sQZV/xSjOwagkzFsDMoUnM68EbtMroCOYgI54obIV5IiSRI SUVAOj6+Unh20EpwcKBJ2XXsUpv2ZmVyDPRImCZ2+/b9rjmOH0qb/ywdQmE4XgHaf9bOqOar+ pFzq9hMNmi9/zSa8O/xc7uKdStvvWoa/PfgbNu3eM61Bitr3/jFy+yvvhWbzmfxb22nRqVmqw VUaeulJ5z9Tc73antb0zUwdf14QXvcq79CMubahVYinOSDTUYi4qTgQAdYL6IoICAAA= X-Env-Sender: vkuznets@redhat.com X-Msg-Ref: server-10.tower-21.messagelabs.com!1488477254!53729888!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: 9.4.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 18159 invoked from network); 2 Mar 2017 17:54:15 -0000 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by server-10.tower-21.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 2 Mar 2017 17:54:15 -0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (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 5F8E78048A; Thu, 2 Mar 2017 17:54:15 +0000 (UTC) Received: from vitty.brq.redhat.com (vitty.brq.redhat.com [10.34.26.3]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v22Hrwk4010760; Thu, 2 Mar 2017 12:54:13 -0500 From: Vitaly Kuznetsov To: xen-devel@lists.xenproject.org Date: Thu, 2 Mar 2017 18:53:44 +0100 Message-Id: <20170302175357.8222-9-vkuznets@redhat.com> In-Reply-To: <20170302175357.8222-1-vkuznets@redhat.com> References: <20170302175357.8222-1-vkuznets@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 02 Mar 2017 17:54:15 +0000 (UTC) Cc: Juergen Gross , Boris Ostrovsky , x86@kernel.org, Andrew Jones , linux-kernel@vger.kernel.org Subject: [Xen-devel] [PATCH v2 08/21] x86/xen: split xen_smp_prepare_boot_cpu() 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 Split xen_smp_prepare_boot_cpu() into xen_pv_smp_prepare_boot_cpu() and xen_hvm_smp_prepare_boot_cpu() to support further splitting of smp.c. Signed-off-by: Vitaly Kuznetsov Reviewed-by: Juergen Gross --- arch/x86/xen/smp.c | 49 ++++++++++++++++++++++++++++++------------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index ff6aaff..6c8a3a5 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c @@ -296,35 +296,46 @@ static void __init xen_filter_cpu_maps(void) } -static void __init xen_smp_prepare_boot_cpu(void) +static void __init xen_pv_smp_prepare_boot_cpu(void) { BUG_ON(smp_processor_id() != 0); native_smp_prepare_boot_cpu(); - if (xen_pv_domain()) { - if (!xen_feature(XENFEAT_writable_page_tables)) - /* We've switched to the "real" per-cpu gdt, so make - * sure the old memory can be recycled. */ - make_lowmem_page_readwrite(xen_initial_gdt); + if (!xen_feature(XENFEAT_writable_page_tables)) + /* We've switched to the "real" per-cpu gdt, so make + * sure the old memory can be recycled. */ + make_lowmem_page_readwrite(xen_initial_gdt); #ifdef CONFIG_X86_32 - /* - * Xen starts us with XEN_FLAT_RING1_DS, but linux code - * expects __USER_DS - */ - loadsegment(ds, __USER_DS); - loadsegment(es, __USER_DS); + /* + * Xen starts us with XEN_FLAT_RING1_DS, but linux code + * expects __USER_DS + */ + loadsegment(ds, __USER_DS); + loadsegment(es, __USER_DS); #endif - xen_filter_cpu_maps(); - xen_setup_vcpu_info_placement(); - } + xen_filter_cpu_maps(); + xen_setup_vcpu_info_placement(); + + /* + * The alternative logic (which patches the unlock/lock) runs before + * the smp bootup up code is activated. Hence we need to set this up + * the core kernel is being patched. Otherwise we will have only + * modules patched but not core code. + */ + xen_init_spinlocks(); +} + +static void __init xen_hvm_smp_prepare_boot_cpu(void) +{ + BUG_ON(smp_processor_id() != 0); + native_smp_prepare_boot_cpu(); /* * Setup vcpu_info for boot CPU. */ - if (xen_hvm_domain()) - xen_vcpu_setup(0); + xen_vcpu_setup(0); /* * The alternative logic (which patches the unlock/lock) runs before @@ -716,7 +727,7 @@ static irqreturn_t xen_irq_work_interrupt(int irq, void *dev_id) } static const struct smp_ops xen_smp_ops __initconst = { - .smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu, + .smp_prepare_boot_cpu = xen_pv_smp_prepare_boot_cpu, .smp_prepare_cpus = xen_smp_prepare_cpus, .smp_cpus_done = xen_smp_cpus_done, @@ -753,5 +764,5 @@ void __init xen_hvm_smp_init(void) smp_ops.cpu_die = xen_cpu_die; smp_ops.send_call_func_ipi = xen_smp_send_call_function_ipi; smp_ops.send_call_func_single_ipi = xen_smp_send_call_function_single_ipi; - smp_ops.smp_prepare_boot_cpu = xen_smp_prepare_boot_cpu; + smp_ops.smp_prepare_boot_cpu = xen_hvm_smp_prepare_boot_cpu; }