From patchwork Fri Feb 16 15:17:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 202170 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp585788dyb; Fri, 16 Feb 2024 07:22:04 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW1gWFMDYTP8Vx8KCpuf4Xz5HTCmBsIu8mWtyi+VxyvVnk9fkH+93+KNNWkBaKHUD72G/v9rENHLOWXHBbpNBtwqoyzXA== X-Google-Smtp-Source: AGHT+IHDG6yZVRIbTyRSwYN68memry6ubLcvk3AgUranHR+MhIVTBpZHOPiyocfSwwWsTO/vlnl+ X-Received: by 2002:a17:902:bb91:b0:1d9:a2d3:8127 with SMTP id m17-20020a170902bb9100b001d9a2d38127mr5423645pls.52.1708096924081; Fri, 16 Feb 2024 07:22:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708096924; cv=pass; d=google.com; s=arc-20160816; b=l734zTtR1A1kV8AlR2WZxG7bWh3F0bPXxdaQjDNwQOAjV6FL1c7V4/OdhzVOVJQI6X VDY1nWU7HKbCa+ueWTmUl7hrzsyB+HSxIH0MATjbUxe+REtf9jdebAk1kWnpEiLHGycS S+mlFiuBfIX78qIWQbx76XC+NMpvzLHC+aslRMuMWqsDg8ZMre5FQL4uUTxAbP0YymJu +5NvoAuiYj2VSo/ngU8oUBJ8QjLtVXfjQZtdaI/IDwGHlUZVZ9d5PJ71QlCnXTruBlVe ccgpObsOZCmcq5Xf0wT6UuXsSxG0mQRAHXzLVmARhvRlKXWnc1myfgEW/zRa/7wXeeed J81Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:precedence:robot-unsubscribe:robot-id :message-id:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:references:in-reply-to:cc:subject:to:reply-to:sender :from:dkim-signature:dkim-signature:date; bh=YBPQzE0M5aGFTZgvsP8CZBcikdBaFd0XoMSUyLHP2R8=; fh=HfXWoIhgCc+vt39DMIJv/Ec0aAKnw0eFA8QxuIQTUoQ=; b=A5TuOg5OqOZ5Cw/mfN0x13cq7Yf/I2CBLCosGh4NLKjYQaRtHkRyLVjqIgbzREjL3l jYleyCisxuJOhWxq0j1TnUXAcSTDQjaBMUJA81mHKzXsArNwnBczOP330yFYCxxk4/// 1JyIK3SL7mleaZpdxGzSYXwi+Js70yblPGhG24eHpzkqpxM9wnaTw0d6cRM5ajH3OfjB CDA6Set269c2tvFdWa4i5NBL04sPBNoWlJCDx6Pnwu9lQ9dHiciY9lNlHYIo+r5ZN8+G AXQhBhGReFMKXeiHvB5+zJE6q8MxBkGmPiIW3b2yx00us59No3zUwVP5iVnk4eUS2m1J 4vKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=e1+OFHf6; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-68812-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68812-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id g24-20020a1709029f9800b001db29999242si2704plq.251.2024.02.16.07.22.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 07:22:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68812-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=e1+OFHf6; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; arc=pass (i=1 spf=pass spfdomain=linutronix.de dkim=pass dkdomain=linutronix.de dmarc=pass fromdomain=linutronix.de); spf=pass (google.com: domain of linux-kernel+bounces-68812-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68812-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 40018282B32 for ; Fri, 16 Feb 2024 15:21:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8680F137C52; Fri, 16 Feb 2024 15:17:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="e1+OFHf6"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="9vhBZkBS" Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E44AA1350ED; Fri, 16 Feb 2024 15:17:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708096627; cv=none; b=BwWywcv/TJ/SJEdVKNyY+pOULvp4zYba9wbHAQgWE5AW0CixsLDh9djw2TEeWWLeppabVGNosqnhyX2tS+PGqMOSBO4CyPQ6uF/sczCRWd1Q50OIfADmK4ny9f9gUfu7NzONyyaa5Iv7C57N+dGo3GWmzVk2cdFFkZReTlFqYxg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708096627; c=relaxed/simple; bh=K5+qlSc4Yo4B3VFaQSLecQE9/0oNut1jsvDJ5maU9nk=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=WnG/T3jA6OBz2WDIEpRI/S3KOJKkacJxp99E/QNr/W12UmjzoU+lcyKSMqyaNjd4HYkbrcipl+2GqP6cYSWkKP9Apq8QDM7aUUxRLZXiuan/3yR5UcpCKbYs+oSlGNAsnThQSU1cIfezqMlsKvuYf3MJIyTkV8ryUfxLC/u0zU4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=e1+OFHf6; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=9vhBZkBS; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Date: Fri, 16 Feb 2024 15:17:03 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708096624; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YBPQzE0M5aGFTZgvsP8CZBcikdBaFd0XoMSUyLHP2R8=; b=e1+OFHf6CuFEEkhdSqgI+xuKp5CMTJ2DHFs+s4P3mpE0a5UKLgjh3d3zKgbMqjvOwHAva7 rZexorXG8ibv+4tQoMv3SzgdCbQ0XHRTNTRyH5Hb30fCYpo01ZPlrJXoX4Yg2yg09UCOKx K9cfbP9bw+qowUniiTiGvd9v2xfrUAVVx5ixkGZse5j93YH1LaoAXecujdFS46Tpj3oNWd +xpJZyYjXYUMFR1zDg2XMXVDT/zHqgQciG8qXA+81Igcdof7A8pueIrALyskz9U37m5imI 8IUAJjROyhfal4lXS1nCoMqEsqoIDBcNhO//0dlEYhdjyWcjdGHfd7ZIcb5PDQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708096624; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YBPQzE0M5aGFTZgvsP8CZBcikdBaFd0XoMSUyLHP2R8=; b=9vhBZkBSr1G38EFolh6PC84QTJ7wwTu4MMnODPnIx7TaGwt0S5+651R8fTzu2McBzaRzmf uOd3Yzn0sF+zPUDA== From: "tip-bot2 for Thomas Gleixner" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/apic] x86/xen/smp_pv: Register fake APICs Cc: Thomas Gleixner , Michael Kelley , Sohil Mehta , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240213210251.940043512@linutronix.de> References: <20240213210251.940043512@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170809662371.398.14602580617204463788.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Precedence: bulk X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1790820154315610609 X-GMAIL-MSGID: 1791069439972530673 The following commit has been merged into the x86/apic branch of tip: Commit-ID: e7530702346637af46bca1d114e6d63312eb3461 Gitweb: https://git.kernel.org/tip/e7530702346637af46bca1d114e6d63312eb3461 Author: Thomas Gleixner AuthorDate: Tue, 13 Feb 2024 22:05:44 +01:00 Committer: Thomas Gleixner CommitterDate: Thu, 15 Feb 2024 22:07:42 +01:00 x86/xen/smp_pv: Register fake APICs XENPV does not use the APIC. It's just piggy packing on the infrastructure and fiddles with global variables as it sees fit. These global variables are going away, so let XENPV register pseudo APIC IDs to keep the accounting correct and keep up the illusion that XEN/PV is something sane. Signed-off-by: Thomas Gleixner Tested-by: Michael Kelley Tested-by: Sohil Mehta Link: https://lore.kernel.org/r/20240213210251.940043512@linutronix.de --- arch/x86/xen/smp_pv.c | 37 ++++++++++--------------------------- 1 file changed, 10 insertions(+), 27 deletions(-) diff --git a/arch/x86/xen/smp_pv.c b/arch/x86/xen/smp_pv.c index 7f6f340..98849b3 100644 --- a/arch/x86/xen/smp_pv.c +++ b/arch/x86/xen/smp_pv.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include @@ -150,34 +151,16 @@ int xen_smp_intr_init_pv(unsigned int cpu) static void __init xen_pv_smp_config(void) { - int i, rc; - unsigned int subtract = 0; - - num_processors = 0; - disabled_cpus = 0; - 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); - } else { - set_cpu_possible(i, false); - set_cpu_present(i, false); - subtract++; - } + u32 apicid = 0; + int i; + + topology_register_boot_apic(apicid++); + + for (i = 1; i < nr_cpu_ids; i++) { + if (HYPERVISOR_vcpu_op(VCPUOP_is_up, i, NULL) < 0) + break; + topology_register_apic(apicid++, CPU_ACPIID_INVALID, true); } -#ifdef CONFIG_HOTPLUG_CPU - /* This is akin to using 'nr_cpus' on the Linux command line. - * Which is OK as when we use 'dom0_max_vcpus=X' we can only - * have up to X, while nr_cpu_ids is greater than X. This - * normally is not a problem, except when CPU hotplugging - * is involved and then there might be more than X CPUs - * in the guest - which will not work as there is no - * hypercall to expand the max number of VCPUs an already - * running guest has. So cap it up to X. */ - if (subtract) - set_nr_cpu_ids(nr_cpu_ids - subtract); -#endif /* Pretend to be a proper enumerated system */ smp_found_config = 1; }