From patchwork Fri Feb 16 15:16:51 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: 202160 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:c619:b0:108:e6aa:91d0 with SMTP id hn25csp583621dyb; Fri, 16 Feb 2024 07:18:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV0QI5gKD9bHTZMToOZhbWEo2YGunVlaxxE4Rx6x7ThLD2ZCekh6uJSW5SQzhAJnKIbvICYKFOg1oytpF9Bl1HmIgJFZQ== X-Google-Smtp-Source: AGHT+IEsoGLYV0e4iAOlo5Rig6W+k2OqdG+YshkxWnKn+OaB9AMr/FQoNB15Exf7AZYlPMcb8Npa X-Received: by 2002:a17:902:eb83:b0:1db:aef8:8db4 with SMTP id q3-20020a170902eb8300b001dbaef88db4mr1404216plg.24.1708096729636; Fri, 16 Feb 2024 07:18:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708096729; cv=pass; d=google.com; s=arc-20160816; b=XSrwtKHu8ARK6w7YSeLiT2ckFSdVVptfDlfne3L4bWZWaUzT7Z1OM2ajSnRVsJa/+b 36tpJWLLwFvsgF77I05SvYftlCGo5st70LNkIeNbb0urOg9DYylTiXI2lNPamy+Yaox0 FT9xu/wWqsFK6jktrrjW6bWLugWzwtyQP+kA/EEQgGEnL7wRXPHDSdAPHewmQBBD3cfv /oFUpUW6IRuVLnXC7e6k9rj3zZSmYuDTl7sBtuZ/s0fAAYWHUDdoMM+UMOY0z/yQQuF8 7y8M4oc0NDM6gycLp6r4KKC4pxXahzRVsdK9cHnCqc5onsNNb4CPLp040uQey2hS/zhm jF8A== 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=8rPsFwIag80nH8xCEKkQYS0E3xZOuBJPGMzSNXnwWL0=; fh=HfXWoIhgCc+vt39DMIJv/Ec0aAKnw0eFA8QxuIQTUoQ=; b=fsOIWeI/78uhOm13ITbw2qIjtrUScw9xU8Gnu2g2Xx6qTzfxeec2TcH7JsbFNie20N 4JRvShR9hxBc+49yQVncRysT7Re8YTO+/FC2vZ2BX+EtXz4T46DUiVHq9YYyzf9iiKBQ SlJCSnlA5Uf4LBp/m8dveZQHXGrH3TuRY/1hHLfCoBW4182Pkv0RRL1cqnKbHylHJUVj R2o5z7eQl8ziJP0inEYHFwxzF9eTuQtKB1njyeQ81fW1mVUAsU0M9u2DKhI5ivv2zfi4 wH64cjzsNyZNXvOD+is2j2fCQETF7MOZJpP+QYJFXQV+Ds8Lb9G8g1NlAmsFd0cXJ1Il OOEw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=o6wxKkMC; 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-68798-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68798-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. [139.178.88.99]) by mx.google.com with ESMTPS id a15-20020a170902eccf00b001da2c896119si3256460plh.432.2024.02.16.07.18.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 07:18:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68798-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=o6wxKkMC; 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-68798-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68798-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 735D228248A for ; Fri, 16 Feb 2024 15:18:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C4565132C13; Fri, 16 Feb 2024 15:16:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="o6wxKkMC"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="0dmvNtVo" 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 A96E612FF6A; Fri, 16 Feb 2024 15:16:53 +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=1708096615; cv=none; b=AuNJ9vLg38lddFVoG5iEl5ak0tmox2b9Na07gftYWVTQ83FUyL7G7J+W5SUH2WDm0ZuMHOr95LFV0ZkejKHEQf6O7AxVlhPFACTw+m67Qa+wmWPYluwx7yhBFstMlnXoOORUf5zv5vb3LyOWKB2z0ezP2M6EAxk7dZCiyPNlDoQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708096615; c=relaxed/simple; bh=+iCBmghLvJVLfiGpSV1Z3ppsEi6mg8VJ9OHCHddr75k=; h=Date:From:To:Subject:Cc:In-Reply-To:References:MIME-Version: Message-ID:Content-Type; b=McrYZBP9R9AvSWZFEi+Ah4UKYGgKWfyV+tAKKiKZH1AHqNT0M6UYaA+K0pyVKfyeOPW2YOSzf1jG7ZLoLOlGCI27tnTe5rn1I2OtMEffCdSQ2YaHxJr/+Mnz8iHaVLhruW5j5vE7yTLR9nKXuXiJ4VVaU0nInFjRNciIqUajRN0= 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=o6wxKkMC; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=0dmvNtVo; 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:16:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1708096612; 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=8rPsFwIag80nH8xCEKkQYS0E3xZOuBJPGMzSNXnwWL0=; b=o6wxKkMCEZV+95m7jOeNhcjPFCcp5UqMiP3BKv4BcsJhtqjKhBHhrVtBRPAOZXpM6zQIKL be6NP/MZ0h68Ir8MUl/vM14aNaa5YrgrF5us8zEd6x38PJ5XQk+7zdfN9nNtAOnxfP+5sI 5wbZLbxWQUTTceMnY5tN4SUgxOD/u7X/3ArfMkfOtVO9GrMIztylRjJp0xX82WeFAk9OuG X/C/8+d7ZsTruyMmo7lP5I6swxJxb6qf8LlsoPNYE3pQIZHG+aPld1ChFaHRuR1+p4pTvZ eoaVBO44+qd11k/QbUVBMo8WJFPkdOhxEWOU6lWEvIFTJAwVCBUeQ+n4iGvq9g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1708096612; 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=8rPsFwIag80nH8xCEKkQYS0E3xZOuBJPGMzSNXnwWL0=; b=0dmvNtVougfg5d9p5kIziHhBOBKPxnYVqeIYZioA5rU7QxXjrQVPffaq+3d4WWltV3LUFk CwztEJs4TssQBUBw== 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/cpu/topology: Mop up primary thread mask handling Cc: Thomas Gleixner , Michael Kelley , Sohil Mehta , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20240213210252.736104257@linutronix.de> References: <20240213210252.736104257@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <170809661157.398.17319974294779396678.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: 1790820215072640807 X-GMAIL-MSGID: 1791069236815354684 The following commit has been merged into the x86/apic branch of tip: Commit-ID: 882e0cff9ef340e7a47659a9aab9da64f4b9b847 Gitweb: https://git.kernel.org/tip/882e0cff9ef340e7a47659a9aab9da64f4b9b847 Author: Thomas Gleixner AuthorDate: Tue, 13 Feb 2024 22:06:05 +01:00 Committer: Thomas Gleixner CommitterDate: Thu, 15 Feb 2024 22:07:44 +01:00 x86/cpu/topology: Mop up primary thread mask handling The early initcall to initialize the primary thread mask is not longer required because topology_init_possible_cpus() can mark primary threads correctly when initializing the possible and present map as the number of SMT threads is already determined correctly. The XENPV workaround is not longer required because XENPV now registers fake APIC IDs which will just work like any other enumeration. Signed-off-by: Thomas Gleixner Tested-by: Michael Kelley Tested-by: Sohil Mehta Link: https://lore.kernel.org/r/20240213210252.736104257@linutronix.de --- arch/x86/kernel/cpu/topology.c | 29 ++--------------------------- 1 file changed, 2 insertions(+), 27 deletions(-) diff --git a/arch/x86/kernel/cpu/topology.c b/arch/x86/kernel/cpu/topology.c index 630ebe5..f3397e2 100644 --- a/arch/x86/kernel/cpu/topology.c +++ b/arch/x86/kernel/cpu/topology.c @@ -82,30 +82,6 @@ static void cpu_mark_primary_thread(unsigned int cpu, unsigned int apicid) if (smp_num_siblings == 1 || !(apicid & mask)) cpumask_set_cpu(cpu, &__cpu_primary_thread_mask); } - -/* - * Due to the utter mess of CPUID evaluation smp_num_siblings is not valid - * during early boot. Initialize the primary thread mask before SMP - * bringup. - */ -static int __init smp_init_primary_thread_mask(void) -{ - unsigned int cpu; - - /* - * XEN/PV provides either none or useless topology information. - * Pretend that all vCPUs are primary threads. - */ - if (xen_pv_domain()) { - cpumask_copy(&__cpu_primary_thread_mask, cpu_possible_mask); - return 0; - } - - for (cpu = 0; cpu < topo_info.nr_assigned_cpus; cpu++) - cpu_mark_primary_thread(cpu, cpuid_to_apicid[cpu]); - return 0; -} -early_initcall(smp_init_primary_thread_mask); #else static inline void cpu_mark_primary_thread(unsigned int cpu, unsigned int apicid) { } #endif @@ -151,9 +127,6 @@ static void topo_set_cpuids(unsigned int cpu, u32 apic_id, u32 acpi_id) #endif set_cpu_possible(cpu, true); set_cpu_present(cpu, true); - - if (system_state != SYSTEM_BOOTING) - cpu_mark_primary_thread(cpu, apic_id); } static __init bool check_for_real_bsp(u32 apic_id) @@ -282,6 +255,7 @@ int topology_hotplug_apic(u32 apic_id, u32 acpi_id) set_bit(apic_id, phys_cpu_present_map); topo_set_cpuids(cpu, apic_id, acpi_id); + cpu_mark_primary_thread(cpu, apic_id); return cpu; } @@ -414,6 +388,7 @@ void __init topology_init_possible_cpus(void) if (apicid == BAD_APICID) continue; + cpu_mark_primary_thread(cpu, apicid); set_cpu_present(cpu, test_bit(apicid, phys_cpu_present_map)); } }