Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4438527pxb; Mon, 21 Feb 2022 21:38:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCNRyzqgtWwuDDT/p0JrpUDuJ2t+m4fqyNjmOHyMPZ+HGyeA9ONnPEU7bnLpbxBJhbSkW2 X-Received: by 2002:a63:5a52:0:b0:36c:7c61:a830 with SMTP id k18-20020a635a52000000b0036c7c61a830mr18895827pgm.233.1645508289932; Mon, 21 Feb 2022 21:38:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645508289; cv=none; d=google.com; s=arc-20160816; b=0RwG8UK/QuBz0qWp7eTPjQ/jwBZWMwAa5Hf9XDy2ZLqY6e7XB8Uru8FVABHuqMsQWh iYW/wAzuVMLlQDt81OM+gev1io6D6PUZsFVzfvNTflKlgKlftaa7tXGoejrjwAGHurG1 V8pW1rtmwfhSgYGfFH5lLtSOAu615fWUJ4GEP48RD3HYCIRBohNXNHVCuDBoOSCEPB+m SJ61IcQWz9CGVVMlwe7zdyRMP8AXWnNYzOMvUndV5yTqQoo/PRqG2I7sOyXytEeIXHPQ gNSif0jWriOs1NdCdzuchh02Vr7Ggzcv7AhMb2tyMIUoRY0tkdl4Cu8Z+Bhix5jcwXGC AwsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=imdNY7evYHfBmyUFTkm6GorKOLPLXHQY9alYqo3a6FM=; b=SKwWaFxCjCY9d2hw1JaSGMxdJzGwH0mn+apaoNvE07Ris+ET6ShsEv92jfXTDIvWJv K08z5mvuQl8m0FoZnAy4gDqOXo4jA/soZav7FJqxlVSoRAZNT0nWq0FqpuSMpQHzGwjc P145sttO+GqntlUKvzOC4LSAZHWoO0dYGHXMKEB4ugps9PCLSRdfpj5OYe3rk0efQohD rls8hJIwc8dVFnSgx51vp/MTjDimKhFYhwUdh46oOxnfJHKXwbwpABZodXjHKZpa2rvY 6rkbJEwENCHaHOm1NcKwGJ6p1pnJWrtpJ+uoyE35arOcriuMXYHM2vCefSKXLIaLNWas lKHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mandIbmO; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id m3si156098pls.206.2022.02.21.21.38.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 21:38:09 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mandIbmO; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1D5BE1285AB; Mon, 21 Feb 2022 21:05:26 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350733AbiBUJfq (ORCPT + 99 others); Mon, 21 Feb 2022 04:35:46 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349961AbiBUJ06 (ORCPT ); Mon, 21 Feb 2022 04:26:58 -0500 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 458E51EED6; Mon, 21 Feb 2022 01:10:57 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id B9A3CCE0E76; Mon, 21 Feb 2022 09:10:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D19C3C340EB; Mon, 21 Feb 2022 09:10:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645434654; bh=bVSySelnyAeahJMSw/l2RKJiTmriqOVNBjS17DZ/XGc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mandIbmO1Lr6Zugza+AtLfPTYBdunbKBKD8ryGTwvD8c4FXYKMvYa4aYTBWSPmebV mNFkktlo9SrSwm1qm/hpqdXP8xiuO2jMU24R+QjYfVYo141R7DaUccCDrAlHPF8Xfh 68hmhhHCSz/IzIN08I2PtB9UKt/TKTFC0SFM4wdg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jan Beulich , Boris Ostrovsky , Juergen Gross , Sasha Levin Subject: [PATCH 5.15 051/196] x86/Xen: streamline (and fix) PV CPU enumeration Date: Mon, 21 Feb 2022 09:48:03 +0100 Message-Id: <20220221084932.647903781@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084930.872957717@linuxfoundation.org> References: <20220221084930.872957717@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jan Beulich [ Upstream commit e25a8d959992f61b64a58fc62fb7951dc6f31d1f ] This started out with me noticing that "dom0_max_vcpus=" with larger than the number of physical CPUs reported through ACPI tables would not bring up the "excess" vCPU-s. Addressing this is the primary purpose of the change; CPU maps handling is being tidied only as far as is necessary for the change here (with the effect of also avoiding the setting up of too much per-CPU infrastructure, i.e. for CPUs which can never come online). Noticing that xen_fill_possible_map() is called way too early, whereas xen_filter_cpu_maps() is called too late (after per-CPU areas were already set up), and further observing that each of the functions serves only one of Dom0 or DomU, it looked like it was better to simplify this. Use the .get_smp_config hook instead, uniformly for Dom0 and DomU. xen_fill_possible_map() can be dropped altogether, while xen_filter_cpu_maps() is re-purposed but not otherwise changed. Signed-off-by: Jan Beulich Reviewed-by: Boris Ostrovsky Link: https://lore.kernel.org/r/2dbd5f0a-9859-ca2d-085e-a02f7166c610@suse.com Signed-off-by: Juergen Gross Signed-off-by: Sasha Levin --- arch/x86/xen/enlighten_pv.c | 4 ---- arch/x86/xen/smp_pv.c | 26 ++++++-------------------- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index a7b7d674f5005..133ef31639df1 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -1364,10 +1364,6 @@ asmlinkage __visible void __init xen_start_kernel(void) xen_acpi_sleep_register(); - /* Avoid searching for BIOS MP tables */ - x86_init.mpparse.find_smp_config = x86_init_noop; - x86_init.mpparse.get_smp_config = x86_init_uint_noop; - xen_boot_params_init_edd(); #ifdef CONFIG_ACPI diff --git a/arch/x86/xen/smp_pv.c b/arch/x86/xen/smp_pv.c index 7ed56c6075b0c..477c484eb202c 100644 --- a/arch/x86/xen/smp_pv.c +++ b/arch/x86/xen/smp_pv.c @@ -148,28 +148,12 @@ int xen_smp_intr_init_pv(unsigned int cpu) return rc; } -static void __init xen_fill_possible_map(void) -{ - int i, rc; - - if (xen_initial_domain()) - return; - - for (i = 0; i < nr_cpu_ids; i++) { - rc = HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL); - if (rc >= 0) { - num_processors++; - set_cpu_possible(i, true); - } - } -} - -static void __init xen_filter_cpu_maps(void) +static void __init _get_smp_config(unsigned int early) { int i, rc; unsigned int subtract = 0; - if (!xen_initial_domain()) + if (early) return; num_processors = 0; @@ -210,7 +194,6 @@ static void __init xen_pv_smp_prepare_boot_cpu(void) * sure the old memory can be recycled. */ make_lowmem_page_readwrite(xen_initial_gdt); - xen_filter_cpu_maps(); xen_setup_vcpu_info_placement(); /* @@ -486,5 +469,8 @@ static const struct smp_ops xen_smp_ops __initconst = { void __init xen_smp_init(void) { smp_ops = xen_smp_ops; - xen_fill_possible_map(); + + /* Avoid searching for BIOS MP tables */ + x86_init.mpparse.find_smp_config = x86_init_noop; + x86_init.mpparse.get_smp_config = _get_smp_config; } -- 2.34.1