Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp8468234ybl; Thu, 16 Jan 2020 17:27:24 -0800 (PST) X-Google-Smtp-Source: APXvYqzxkZjjt1IUr4TfMqwmhWtYFuj9ifrnWgiIButUj0EO6wds+zp6RGQwlSJY6Z0VWc5ZX2Bf X-Received: by 2002:a9d:5c86:: with SMTP id a6mr4460517oti.68.1579224444389; Thu, 16 Jan 2020 17:27:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579224444; cv=none; d=google.com; s=arc-20160816; b=0tW7hJDGlLNE3a+BybP/NGGtCOehxYYhN0TAIfZjIxgfiZy3wi86RC7kWGyXEwnWWj ZH/B+WTAIWzYvzK5AxA+rVyORxpkc2XeoXqgc83JQvad9tIwpaWFE3IRuFpj+Nx65TTs smi0WAiIzDHzxCI+vtw0mQPFPheKuRG1pclsNMQZIBa1YmRHDFuDiqcTTflpRTxPoHsy En7lHWCFuq+HxoHIHrM5YBlMV6YNGgqqEz6/l5wN7voIPz3bP4ZKnHMA/G2Uhml8hBYX bE6HM46ANxmS3FLZ1Zd8cC5b7ITTdi3qakP1baeMaNxpkowtVvCUU66IcwnbOq1rXcoc 6xSQ== 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:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=lC+eBbivxVdvtoWKUIZ+TQMYrgOdUa8RTwULWTXQJeE=; b=MfrxxaWHM06X2usNReHt2F2+od8baTGe5WO/ojCQp7CDKXQv3VLpqbMSpBFNnJlL1B vf8j8skNabBkGN3b/Mb90YwPKHh/TBppL7WZkRqLjqtQ3JMDHNagDoqS/yF+pgHqRAlM 1m/v61pbN0EFLVi6oPP4XAw+t9jwdRn+x93XSjOVTod/RJG49fK9DBRoei/KvWfTKoB0 0GgF9TAb1OMyQmYq0CS82mg3GhrSp/fntLh+YRwms7ojIF3JrGJD//w9hUHt3JZyl40I Zu698KJC7b2E8ypnsPIJki/Ba9NtiaYsecPwQX1Zbq2xCa3eZfHXQZuZeb71WVu6IHlQ Z+0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xIirf1F6; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d21si12732917oic.168.2020.01.16.17.27.11; Thu, 16 Jan 2020 17:27:24 -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=@kernel.org header.s=default header.b=xIirf1F6; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389278AbgAPXZx (ORCPT + 99 others); Thu, 16 Jan 2020 18:25:53 -0500 Received: from mail.kernel.org ([198.145.29.99]:55302 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387457AbgAPXZf (ORCPT ); Thu, 16 Jan 2020 18:25:35 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6006E2075B; Thu, 16 Jan 2020 23:25:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579217134; bh=hkqpsqSBLywGL/7OMIIJ7C1ZmHjgpKxuUaaDc0LFdT4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xIirf1F6lTAlVSv3alz/s5pncjlCqX8CIsn6XS29/qa3TZDXYCSFAMI79pllYeb/G 8yWdVb3SF2njsI0OmPdKMI7tAA0MhgSdUv//ichH6hBxIpnUlkoTShDIImoUZm0oen dj66K16PaL8ngo/Uoq10vQ3CNFPp1t7ASzIN0sbI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sudeep Holla , Lukasz Luba , Ondrej Jirman , Dietmar Eggemann , Russell King Subject: [PATCH 5.4 145/203] ARM: 8943/1: Fix topology setup in case of CPU hotplug for CONFIG_SCHED_MC Date: Fri, 17 Jan 2020 00:17:42 +0100 Message-Id: <20200116231757.610546114@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200116231745.218684830@linuxfoundation.org> References: <20200116231745.218684830@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dietmar Eggemann commit ff98a5f624d2910de050f1fc7f2a32769da86b51 upstream. Commit ca74b316df96 ("arm: Use common cpu_topology structure and functions.") changed cpu_coregroup_mask() from the ARM32 specific implementation in arch/arm/include/asm/topology.h to the one shared with ARM64 and RISCV in drivers/base/arch_topology.c. Currently on ARM32 (TC2 w/ CONFIG_SCHED_MC) the task scheduler setup code (w/ CONFIG_SCHED_DEBUG) shows this during CPU hotplug: ERROR: groups don't span domain->span It happens to CPUs of the cluster of the CPU which gets hot-plugged out on scheduler domain MC. Turns out that the shared cpu_coregroup_mask() requires that the hot-plugged CPU is removed from the core_sibling mask via remove_cpu_topology(). Otherwise the 'is core_sibling subset of cpumask_of_node()' doesn't work. In this case the task scheduler has to deal with cpumask_of_node instead of core_sibling which is wrong on scheduler domain MC. e.g. CPU3 hot-plugged out on TC2 [cluster0: 0,3-4 cluster1: 1-2]: cpu_coregroup_mask(): CPU3 cpumask_of_node=0-2,4 core_sibling=0,3-4 ^ should be: cpu_coregroup_mask(): CPU3 cpumask_of_node=0-2,4 core_sibling=0,4 Add remove_cpu_topology() to __cpu_disable() to remove the CPU from the topology masks in case of a CPU hotplug out operation. At the same time tweak store_cpu_topology() slightly so it will call update_siblings_masks() in case of CPU hotplug in operation via secondary_start_kernel()->smp_store_cpu_info(). This aligns the ARM32 implementation with the ARM64 one. Guarding remove_cpu_topology() with CONFIG_GENERIC_ARCH_TOPOLOGY is necessary since some Arm32 defconfigs (aspeed_g5_defconfig, milbeaut_m10v_defconfig, spear13xx_defconfig) specify an explicit # CONFIG_ARM_CPU_TOPOLOGY is not set w/ ./arch/arm/Kconfig: select GENERIC_ARCH_TOPOLOGY if ARM_CPU_TOPOLOGY Fixes: ca74b316df96 ("arm: Use common cpu_topology structure and functions") Reviewed-by: Sudeep Holla Reviewed-by: Lukasz Luba Tested-by: Lukasz Luba Tested-by: Ondrej Jirman Signed-off-by: Dietmar Eggemann Signed-off-by: Russell King Signed-off-by: Greg Kroah-Hartman --- arch/arm/kernel/smp.c | 4 ++++ arch/arm/kernel/topology.c | 10 +++++----- 2 files changed, 9 insertions(+), 5 deletions(-) --- a/arch/arm/kernel/smp.c +++ b/arch/arm/kernel/smp.c @@ -240,6 +240,10 @@ int __cpu_disable(void) if (ret) return ret; +#ifdef CONFIG_GENERIC_ARCH_TOPOLOGY + remove_cpu_topology(cpu); +#endif + /* * Take this CPU offline. Once we clear this, we can't return, * and we must not schedule until we're ready to give up the cpu. --- a/arch/arm/kernel/topology.c +++ b/arch/arm/kernel/topology.c @@ -196,9 +196,8 @@ void store_cpu_topology(unsigned int cpu struct cpu_topology *cpuid_topo = &cpu_topology[cpuid]; unsigned int mpidr; - /* If the cpu topology has been already set, just return */ - if (cpuid_topo->core_id != -1) - return; + if (cpuid_topo->package_id != -1) + goto topology_populated; mpidr = read_cpuid_mpidr(); @@ -231,14 +230,15 @@ void store_cpu_topology(unsigned int cpu cpuid_topo->package_id = -1; } - update_siblings_masks(cpuid); - update_cpu_capacity(cpuid); pr_info("CPU%u: thread %d, cpu %d, socket %d, mpidr %x\n", cpuid, cpu_topology[cpuid].thread_id, cpu_topology[cpuid].core_id, cpu_topology[cpuid].package_id, mpidr); + +topology_populated: + update_siblings_masks(cpuid); } static inline int cpu_corepower_flags(void)