Received: by 10.223.176.5 with SMTP id f5csp1255224wra; Wed, 7 Feb 2018 15:50:22 -0800 (PST) X-Google-Smtp-Source: AH8x227auvpmcWLjuUBNT9vpthaYdWGViDvT1LFN9c5HDNjhDIC7honJ9iZwCqUCAkmy45V8kyHQ X-Received: by 2002:a17:902:6716:: with SMTP id f22-v6mr7821705plk.180.1518047422532; Wed, 07 Feb 2018 15:50:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518047422; cv=none; d=google.com; s=arc-20160816; b=zaHg6PCDMtC3f+kAc5ahX9C3YLUiwJ23Plq2Q1jz5fvnYiuakAKKQYJujne6Y7G8ui cNRtutfmGcPOks3w5NL+kxHUHE5+hIMc5fCj5k26pyn423PUTebqCThQTFADHBGHWfLd Y4INuKefKTRLPx9lFy4paG9gU2O0ZhcXXd4oBGzu2AXi2UwBR2t6lJxugkNoVkAE9UCn fGWLSOBV1L1CehNHAA0Ejb9WSKQpGBQfQxqs9Q5bM4zmO07TrBLjt6pd0jtSyePRpHxE x9zx6tzVYBMhrQaxap0WyiUa/3DTUEGsTHK42Z6JAb+m30FsNpDk5qzDTKPZ1w9e5oop cRNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :arc-authentication-results; bh=6XYV+u3XBsQC5Hbr2v1siuE6XY6pnpF1DayvYE0OIQ8=; b=ELRznyeVuqIgTEYYUowdFJOWkgJY9i3Zlr89mvHpkJ0/bWPRwaCVfpgxIk4/aYCBRr DcLVcg7KnxGjFeo8uvwGwh6th5sUIEl1WnL1jvmkUbjhOdHpQxP86eMDxfpXCGfAjsFB 12k71aKfcAedYItBBqGqB2PPhzg1qW14aoeUno084ucAVjzqFNEve7D0Cs2CMTtUscFE wA+pECcMdMyYkHL0kLUTbEPZV5ZF0viXTc564TH8oPsLl9jIzkXs38B56qT7YU7vLwc9 0NbBZhNwB2L1mQ5Unps/2xMbxObPm4ekevpYVbt/Ik5dXKG5XtyQCULE8J1CbOiF1HGZ WQ9A== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r8-v6si1834413pli.254.2018.02.07.15.50.07; Wed, 07 Feb 2018 15:50:22 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751225AbeBGXt3 (ORCPT + 99 others); Wed, 7 Feb 2018 18:49:29 -0500 Received: from mx1.redhat.com ([209.132.183.28]:47994 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750729AbeBGXt2 (ORCPT ); Wed, 7 Feb 2018 18:49:28 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D8C73356C7; Wed, 7 Feb 2018 23:49:27 +0000 (UTC) Received: from praritdesktop.bos.redhat.com (prarit-guest.khw.lab.eng.bos.redhat.com [10.16.186.145]) by smtp.corp.redhat.com (Postfix) with ESMTP id 45F325EDEA; Wed, 7 Feb 2018 23:49:26 +0000 (UTC) From: Prarit Bhargava To: linux-kernel@vger.kernel.org Cc: Prarit Bhargava , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Boris Ostrovsky , Juergen Gross , Dou Liyang , Kate Stewart , Greg Kroah-Hartman , Andy Lutomirski , Andi Kleen , Vitaly Kuznetsov , xen-devel@lists.xenproject.org Subject: [PATCH] x86/xen: Calculate __max_logical_packages on PV domains Date: Wed, 7 Feb 2018 18:49:23 -0500 Message-Id: <20180207234923.13544-1-prarit@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Wed, 07 Feb 2018 23:49:28 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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(-) diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h index 461f53d27708..a4189762b266 100644 --- a/arch/x86/include/asm/smp.h +++ b/arch/x86/include/asm/smp.h @@ -129,6 +129,7 @@ static inline void arch_send_call_function_ipi_mask(const struct cpumask *mask) 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); diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c index 6f27facbaa9b..767573b7f2db 100644 --- a/arch/x86/kernel/smpboot.c +++ b/arch/x86/kernel/smpboot.c @@ -1281,11 +1281,10 @@ void __init native_smp_prepare_boot_cpu(void) 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. @@ -1293,6 +1292,13 @@ void __init native_smp_cpus_done(unsigned int max_cpus) 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); diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c index 77c959cf81e7..7a43b2ae19f1 100644 --- a/arch/x86/xen/smp.c +++ b/arch/x86/xen/smp.c @@ -122,6 +122,8 @@ void __init xen_smp_cpus_done(unsigned int max_cpus) if (xen_hvm_domain()) native_smp_cpus_done(max_cpus); + else + calculate_max_logical_packages(); if (xen_have_vcpu_info_placement) return; -- 2.15.0.rc0.39.g2f0e14e64