Received: by 10.223.176.5 with SMTP id f5csp1308414wra; Wed, 7 Feb 2018 17:01:11 -0800 (PST) X-Google-Smtp-Source: AH8x22473Fsuru53YOpynRal68bb7HaJ/lq3Z3Yga+BZ3ncKegmlHONmoeeRlrPBOeu6o8JdILrk X-Received: by 10.101.69.13 with SMTP id n13mr6448977pgq.62.1518051671445; Wed, 07 Feb 2018 17:01:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518051671; cv=none; d=google.com; s=arc-20160816; b=IXKH7HMpbAh3LTV/LbQOgHqdoiOqEuEs5G2d5DxCvvYmLzpCHGwVDHHXea7r6YtQdf SlKcwubTwGaaeadfmIqVjN0U40dmso1lXpgXC6zNpLF7JiYsKsaibaDDylq23QM+X5+k n4SfU8XdtZUaxjZWQ0e7lisMxfHHTOzPd4k6BFMB8R2UxhGj2y0236lAKpg9L0sXba5I dUtN3H4g1KRRhmZJj9O/UKV3Ta+O56CiYzh0nLJg/m2z4db/PX8HKg40pqFTeRyve+2H y2oNVsesnYkZkiskJeiHNEO1ozNycbl37RIPwNfM1XF9No13FcTFDBcdtyTBnzJXktk7 mf7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=y1hSRFCzOFH+BQXW/q7CHRyRkwVGuruavV+qn7fbpnc=; b=v9N2h7spBPz8nzuvCfq6Yu506zxrD45h8cCoqneKYwbQsnyrKemzAEI0t/0YwDc3QE 6TIDruwCY4+V8U9SkxkRFjMr1cJ/J5Sjpy4X1jCiYyqQKVJPyIKSMgSt4fEBKl9hv8UJ tqfNOyYRJUNFjPSOBJG/D4FNpejfNFnUX5MxDZ+IVpp+xS9oBKzthFv1UzuHB18DdBXz 23oADe/yJWbzPNTTX8d0Z63uFn8NM8PjdJ+Ada5BbPonFEA/+I/hLY1O0ngEIs1Iydih /oUfIWmrY6o83aE3RMl+T/S4A12c6dkByr9phhs9MQrUHT8DQba/w5TERG16x/1mHSfC IA2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=UgnJNp33; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f4-v6si1919030plb.482.2018.02.07.17.00.57; Wed, 07 Feb 2018 17:01:11 -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; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=UgnJNp33; 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=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751756AbeBHBAI (ORCPT + 99 others); Wed, 7 Feb 2018 20:00:08 -0500 Received: from aserp2130.oracle.com ([141.146.126.79]:39608 "EHLO aserp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750987AbeBHBAH (ORCPT ); Wed, 7 Feb 2018 20:00:07 -0500 Received: from pps.filterd (aserp2130.oracle.com [127.0.0.1]) by aserp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w180va1p062240; Thu, 8 Feb 2018 00:59:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2017-10-26; bh=y1hSRFCzOFH+BQXW/q7CHRyRkwVGuruavV+qn7fbpnc=; b=UgnJNp33zv9AucnaITeZ+q23lPH9KNQb+xoK/6eTvkqHH8S0xyF7vqfbMqxwXwNewBe9 SVt+tS/ym+5Zwnfxv5t2qDSbVy+VIgP6afYs7Q0FPdi6igGu7xMFr5kdlcwkcdvSo9vF V1xlEdU//g/f19N3dZfzsk48P1RUWQeSZuh34qiIvECRcewVtBlTkAP9SpLETm8Eh515 DWBomHBTU8Ikns2szlnFFCsL/ouBA4MvXCgZXViPXByvESXpemR50jF4cx94wD8ehxQo NILOk3+PU6gqdN+ouM/8bG70kiBQ9kRL4xddbDRNbADt51u8b0RxLJZqv+yP1OB9hp3G dw== Received: from userv0021.oracle.com (userv0021.oracle.com [156.151.31.71]) by aserp2130.oracle.com with ESMTP id 2g0cecr0fv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 08 Feb 2018 00:59:26 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by userv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w180xOTg015719 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 8 Feb 2018 00:59:24 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w180xMq5018924; Thu, 8 Feb 2018 00:59:23 GMT Received: from [10.39.252.190] (/10.39.252.190) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 07 Feb 2018 16:59:22 -0800 Subject: Re: [PATCH] x86/xen: Calculate __max_logical_packages on PV domains To: Prarit Bhargava , linux-kernel@vger.kernel.org Cc: Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , x86@kernel.org, Juergen Gross , Dou Liyang , Kate Stewart , Greg Kroah-Hartman , Andy Lutomirski , Andi Kleen , Vitaly Kuznetsov , xen-devel@lists.xenproject.org, simon@invisiblethingslab.com References: <20180207234923.13544-1-prarit@redhat.com> From: Boris Ostrovsky Message-ID: <5607eaea-5cc3-31a4-9685-1d7dd147f564@oracle.com> Date: Wed, 7 Feb 2018 19:59:18 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180207234923.13544-1-prarit@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8798 signatures=668663 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1802080007 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02/07/2018 06:49 PM, Prarit Bhargava wrote: > 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 (+ Simon) > --- > 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; >