Received: by 10.213.65.68 with SMTP id h4csp423041imn; Tue, 13 Mar 2018 08:35:28 -0700 (PDT) X-Google-Smtp-Source: AG47ELtBsgMqqjkmdnpT95RbUJ305iTdeubrDOQJHN0a6CnfVmRO/qDJWY5XpkfFDUdU7L/Uu0ZI X-Received: by 10.99.160.67 with SMTP id u3mr799944pgn.389.1520955328347; Tue, 13 Mar 2018 08:35:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520955328; cv=none; d=google.com; s=arc-20160816; b=Imqv6+8FcvvIr7fwSWD7hC5EnwdSYklkEP4XB54VDw5Mr4PuLP9wTVQPTTbIonraGO KkrsGpyQMD0bBYeU1FVvkm65EzREnb0caWWHQ7KQ/lFggbk1a541RIJ7eqnVxesQYaxE t3sJQ6l01+4iph2FgpGpLfk6m6WPqkAQmkRGSg5dSZq2sCan8ERUrsI1vLJ5ia/QIH0W +/wNz34L48m3Rd8Oemb0fwXHqX8IVWja/OeX+w9JQqWhi2AqYgSuJe1Ddy0J7I9Mf3RU B4UnJBKX9KIRHknsal9yZjBLsATp7jneD8bMH5slOpkSZqMSykl5TLOB0vDqm78O7sGZ 34pA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=AgjtkANxet+SrELAK+SeGmPWldHESCAeJcEehZdZxvg=; b=kj6xLwRU1zQ4Y8EbKc/1oEOmCKXwbMBXCOMFAbc5JykVlJLqf2NwlYwouQXdaH4Fht 3Tqg8sCaqHw7Ct7a/ikLsZ7VngkdopTTMMMsMlsF8BpyYvmo3FIAg4lqqGXn3d/jpfQV JXD7W1AtRzIcrW6Rc/BBBCeCgb6sBQZwXfFhjndVZW1Nte7XgosRsk+ouxvWyuFYm9r7 0IrpYiDno4RlxOEj7udwKqWuNpUclMtWJ6eKDC2RRqcLlnNhjAq4LL5DnBNLliKNdVad x/FxhE+GUF+gU7dgaLlAiReBOrKyTC5b0VpXkndzHVsEocprxOexRd1YnFHQrBuUBPtO Dd0g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n5si258637pgd.345.2018.03.13.08.35.13; Tue, 13 Mar 2018 08:35:28 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933560AbeCMPd3 (ORCPT + 99 others); Tue, 13 Mar 2018 11:33:29 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60652 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933509AbeCMPd0 (ORCPT ); Tue, 13 Mar 2018 11:33:26 -0400 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BF58149D; Tue, 13 Mar 2018 15:33:21 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Prarit Bhargava , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Boris Ostrovsky , Juergen Gross , Dou Liyang , Kate Stewart , Andy Lutomirski , Andi Kleen , Vitaly Kuznetsov , xen-devel@lists.xenproject.org Subject: [PATCH 4.15 123/146] x86/xen: Calculate __max_logical_packages on PV domains Date: Tue, 13 Mar 2018 16:24:50 +0100 Message-Id: <20180313152329.734294228@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180313152320.439085687@linuxfoundation.org> References: <20180313152320.439085687@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Prarit Bhargava commit 63e708f826bb21470155d37b103a75d8a9e25b18 upstream. The kernel panics on PV domains because native_smp_cpus_done() is only called for HVM domains. Calculate __max_logical_packages for PV domains. Fixes: b4c0a7326f5d ("x86/smpboot: Fix __max_logical_packages estimate") Signed-off-by: Prarit Bhargava Tested-and-reported-by: Simon Gaiser Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: x86@kernel.org Cc: Boris Ostrovsky Cc: Juergen Gross Cc: Dou Liyang Cc: Prarit Bhargava Cc: Kate Stewart Cc: Greg Kroah-Hartman Cc: Andy Lutomirski Cc: Andi Kleen Cc: Vitaly Kuznetsov Cc: xen-devel@lists.xenproject.org Reviewed-by: Boris Ostrovsky Signed-off-by: Juergen Gross Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/smp.h | 1 + arch/x86/kernel/smpboot.c | 10 ++++++++-- arch/x86/xen/smp.c | 2 ++ 3 files changed, 11 insertions(+), 2 deletions(-) --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h @@ -129,6 +129,7 @@ static inline void arch_send_call_functi void cpu_disable_common(void); void native_smp_prepare_boot_cpu(void); void native_smp_prepare_cpus(unsigned int max_cpus); +void calculate_max_logical_packages(void); void native_smp_cpus_done(unsigned int max_cpus); void common_cpu_up(unsigned int cpunum, struct task_struct *tidle); int native_cpu_up(unsigned int cpunum, struct task_struct *tidle); --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1282,11 +1282,10 @@ void __init native_smp_prepare_boot_cpu( cpu_set_state_online(me); } -void __init native_smp_cpus_done(unsigned int max_cpus) +void __init calculate_max_logical_packages(void) { int ncpus; - pr_debug("Boot done\n"); /* * Today neither Intel nor AMD support heterogenous systems so * extrapolate the boot cpu's data to all packages. @@ -1294,6 +1293,13 @@ void __init native_smp_cpus_done(unsigne ncpus = cpu_data(0).booted_cores * topology_max_smt_threads(); __max_logical_packages = DIV_ROUND_UP(nr_cpu_ids, ncpus); pr_info("Max logical packages: %u\n", __max_logical_packages); +} + +void __init native_smp_cpus_done(unsigned int max_cpus) +{ + pr_debug("Boot done\n"); + + calculate_max_logical_packages(); if (x86_has_numa_in_package) set_sched_topology(x86_numa_in_package_topology); --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c @@ -122,6 +122,8 @@ void __init xen_smp_cpus_done(unsigned i if (xen_hvm_domain()) native_smp_cpus_done(max_cpus); + else + calculate_max_logical_packages(); if (xen_have_vcpu_info_placement) return;