From nobody Mon Feb 9 20:30:09 2026 Received: from fhigh6-smtp.messagingengine.com (fhigh6-smtp.messagingengine.com [103.168.172.157]) (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 3B0E218D4DE for ; Mon, 15 Jul 2024 13:35:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721050547; cv=none; b=WkB63LE2V5XkKmkud+RkGbUtdIj1i5ZQo+o57I8RHvnd7k9MKaNjQUB56IWb2xFdGztTaiObdNNuqhNkd4lBwGMnM8zI6yjy6YBGiKBriQ+GXTES9KMEBQaBGTQRp2SKFoi3Z1g2nwNpEa1ZDCxDsQQK1KvJK8D5kayOkQL4VDI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721050547; c=relaxed/simple; bh=g8d7dxT/BVtAO8vYQcer1eyeppeyi/gG6japCtttGUs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ipR3ncYYjQiDsN/vOZ3qqTTNjAFvld7WAKefape/gVNt6s0ss2FjOZP1XFs6OEeJt9WPAe27KtejX7ezwzcbdbcfyeHdb3YJxxZNV8hULEJC5Tg8xGMSSR7CD0T9v62ZCVEbs9CMAfm/veUGeeGt6I1K8FgeWHQVoduioduX/W8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com; spf=pass smtp.mailfrom=flygoat.com; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b=MPXWouqe; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=vo7dvMe5; arc=none smtp.client-ip=103.168.172.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flygoat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="MPXWouqe"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="vo7dvMe5" Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 6D37F1147F7F; Mon, 15 Jul 2024 09:35:45 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Mon, 15 Jul 2024 09:35:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1721050545; x=1721136945; bh=QekSCibAz4MOBP65R5aP4L/Ddp8Wwagai8dXxftEX8s=; b= MPXWouqeRroTA+VOVr/PQfC/Xzt5lQpo4h34BbqZ8iyFec9hltJh2xM/guXsu/60 /0Kgbx3wH6jT2nJ3cEHUn5YZe2peguWNmLd+Bgq7QkvLiSgVWQ9mzLRgueOcLfk6 bgv/LOpPddmrFbvg48M6HMegebD2C+tt/v0QZW8O0ZaF27EVOlYihN8tVqX4Clvb iRXztO4ZXmRsTSRbk4TEqb9HrPAQqmUGYj8afbChft7Fm8i5Kz6aMpSpw5gEOPcg 253LyxoGJavKWYRrXB7XvarY1Os3UR0O4zxxesbLhtrbAz+X/d0GLMiOHAFN8V7Y 7BC2Ts5OOYYYB/cXM/P93w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1721050545; x= 1721136945; bh=QekSCibAz4MOBP65R5aP4L/Ddp8Wwagai8dXxftEX8s=; b=v o7dvMe57IlZmJR94lhTHOKfUxonymMUfywrxbfGmIAshAD2L8kvE1+GwU9canjKa rBbsi+x6xa8jZBfTH+cbgCtb6xWXzvMUZlKOKj05WKtglW4zkOvnsI9c1/6JiHtg 5TxVYtKEXRdh1kaEFRApfX2p3wQ9dGXMFx1fo4zQc6s5756E+hJ8iK4y2m0Ly//h 7UGFztV4K16y71JXdqpoAsday9hQPIIjJ/0znh2QZnbJx+eP2ZiwDWTq9Hisi5Sx 4M8jyL8N4lN0fbothVeR8ET7JscqqZ+j/Vhe7u3ZCJGIn7saLdVjOuDjgMOI8TRm VBtjHYstOPQ0YtcGxFQYg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrgedvgdeiiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheplfhirgig uhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhmqeenuc ggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleffkeegudeghfdtuddugefhueev geffgedukeejleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhm X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 15 Jul 2024 09:35:41 -0400 (EDT) From: Jiaxun Yang Date: Mon, 15 Jul 2024 21:35:28 +0800 Subject: [PATCH v2 1/3] cpu/hotplug: Make HOTPLUG_PARALLEL independent of HOTPLUG_SMT Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240715-loongarch-hotplug-v2-1-7d18b3d46b11@flygoat.com> References: <20240715-loongarch-hotplug-v2-0-7d18b3d46b11@flygoat.com> In-Reply-To: <20240715-loongarch-hotplug-v2-0-7d18b3d46b11@flygoat.com> To: Thomas Gleixner , Peter Zijlstra , Huacai Chen , WANG Xuerui Cc: linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Jiaxun Yang X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1109; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=g8d7dxT/BVtAO8vYQcer1eyeppeyi/gG6japCtttGUs=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhrSpqise38g5q6zytv3+c8X/FsvWJ7BqbvjVxNnvGaNVz Od8mOFrRykLgxgXg6yYIkuIgFLfhsaLC64/yPoDM4eVCWQIAxenAExkAwMjwyS/oDlcoQbX957b 8fhtuftOOf6HU/ROfnz34bnh+/BJnGsZGTq9Mz7yuR0Q2p5wf5HnszubPlR9cK5RvXD8jtYxzzd HXZkA X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Provide stub function for smt related parallel bring up functions so that HOTPLUG_PARALLEL can work without HOTPLUG_PARALLEL. Signed-off-by: Jiaxun Yang --- v2: Use stub function (tglx) --- kernel/cpu.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kernel/cpu.c b/kernel/cpu.c index 1209ddaec026..c89e0e91379a 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1808,6 +1808,7 @@ static int __init parallel_bringup_parse_param(char *= arg) } early_param("cpuhp.parallel", parallel_bringup_parse_param); =20 +#ifdef CONFIG_HOTPLUG_SMT static inline bool cpuhp_smt_aware(void) { return cpu_smt_max_threads > 1; @@ -1817,6 +1818,16 @@ static inline const struct cpumask *cpuhp_get_primar= y_thread_mask(void) { return cpu_primary_thread_mask; } +#else +static inline bool cpuhp_smt_aware(void) +{ + return false; +} +static inline const struct cpumask *cpuhp_get_primary_thread_mask(void) +{ + return cpu_none_mask; +} +#endif =20 /* * On architectures which have enabled parallel bringup this invokes all BP --=20 2.45.2 From nobody Mon Feb 9 20:30:09 2026 Received: from fout1-smtp.messagingengine.com (fout1-smtp.messagingengine.com [103.168.172.144]) (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 2744518E767 for ; Mon, 15 Jul 2024 13:35:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.144 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721050551; cv=none; b=qKpnqSHlh0ndNz4kiqWf2XSA+KX06r0KKGRAGMi/yLCkMTSkVHvLHcSjimfD1fd4RATKzutn23W2dHdx471eOt/qeU9z7vN3qVWUMUEq8EVNu76IpWIHX7o46Y9rtih0PVpu501u9IWsCeqvLqcE0V/aajDLALCI+VlKvKTqGYg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721050551; c=relaxed/simple; bh=Q4Js0j6Sv3g87oah8phZc5hFd0opwGeKNyGx0qz8Jl0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tQCPKsAT6zPsG/hRYg9xOyJy34Xn9hloY2X1I4hKQ9s1i80mknZHgIBRXE0K9WKUhVAboTWyixyHLI0oGtK/pXfwp7lXjskBQm8pmsDkqYHSnLJ93ZSb3Vc4ER8NZte+twHBD46sELUIwuL5fHESjSyJDaFQW+98xnTFhspvMlg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com; spf=pass smtp.mailfrom=flygoat.com; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b=E3KPs+yo; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=i8Cf1EmP; arc=none smtp.client-ip=103.168.172.144 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flygoat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="E3KPs+yo"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="i8Cf1EmP" Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfout.nyi.internal (Postfix) with ESMTP id 5A2011388BBA; Mon, 15 Jul 2024 09:35:49 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 15 Jul 2024 09:35:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1721050549; x=1721136949; bh=l7AHCxMgNqzI1B/7Gr9EX4MgOWfEuaHkRWhzdciw6I8=; b= E3KPs+yoam9z/BXArKNUHnsEx4i5X1t2hbust0HTQOb4DZHArRtFBcyKX+zlS9h7 EOAsYJaiXfnI4pKnMfJ3yPuk0uIIgChHlWW7P87BUN4pX9ZAiFHThctEf2Hvf811 Jq2wJxyi3Qk3TnVdYl2CnZR3w6jSsCzKm55HPQryWIdxyB+KM52ef4Hd3PsjSDu1 DhhFSxYCHlJ+3CEqkgBOMkHYAUlDKrdRgg+i8j2bO2W8Gb7dEKh1UG95OGhyClvI dSZPctjCtKY6mKQnxwqhzLwGb9A9j1NanyQbvrylepa+c5RDH5T1TXI2NtITYks0 hYmRb7wv0RjjDsYS35lSZg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1721050549; x= 1721136949; bh=l7AHCxMgNqzI1B/7Gr9EX4MgOWfEuaHkRWhzdciw6I8=; b=i 8Cf1EmPbu8csqvieJsGScTW1n2stTmX0FD6sSRxkDjtCuUdJKsuVORn2ahbT6ux/ erhezKhjU/Nj1z3NDvPDblkIIRd/3QmxMJjCg/zNV/ah5jD1QUE83L1dHqIi5tEc nxnNCqIb9he6hCz5GIYYim6VExs4h4Q4bDuPCsm6zM8ujvDkJXGN8s0ThoKRkmUX QY8l7Tt2Mba9/0ejoGx0JfR8M/UI1ue5kxh7D2vViARQ/8yKWzsyvTWI3ZJh224N wmXB28XMymJcu7xEBx/uEJSaI6B4vPK//h4tZ5sDOe8WDZxErSDQkJyzCvT+sYLt HWqTfgkcZDGkQCJ0o5/bA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrgedvgdeiiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheplfhirgig uhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhmqeenuc ggtffrrghtthgvrhhnpedvkeeihfefveekueevteefleffkeegudeghfdtuddugefhueev geffgedukeejleenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfh hrohhmpehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhm X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 15 Jul 2024 09:35:45 -0400 (EDT) From: Jiaxun Yang Date: Mon, 15 Jul 2024 21:35:29 +0800 Subject: [PATCH v2 2/3] cpu/hotplug: Weak fallback for arch_cpuhp_init_parallel_bringup Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240715-loongarch-hotplug-v2-2-7d18b3d46b11@flygoat.com> References: <20240715-loongarch-hotplug-v2-0-7d18b3d46b11@flygoat.com> In-Reply-To: <20240715-loongarch-hotplug-v2-0-7d18b3d46b11@flygoat.com> To: Thomas Gleixner , Peter Zijlstra , Huacai Chen , WANG Xuerui Cc: linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Jiaxun Yang X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=858; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=Q4Js0j6Sv3g87oah8phZc5hFd0opwGeKNyGx0qz8Jl0=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhrSpqiumPrpjmtHx9P+7HUsyXdZMuu/ytJpv3cXOw94Xs 23fpNy531HKwiDGxSArpsgSIqDUt6Hx4oLrD7L+wMxhZQIZwsDFKQATSZvAyLDddPqaFx2btUVu /n0exPHc22h2+K1kf+FvqYbvbsR+VxVk+GczubfhTK2zzB0+7v9P7706qfqeqXTtoq0K01WKlfL 1NzMDAA== X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 It is a general assumption that architectures entitled to parallel bringup with CONFIG_HOTPLUG_PARALLEL do expect parallel bringup to be available. Provide a weak fallback arch_cpuhp_init_parallel_bringup function to match this assumption. Signed-off-by: Jiaxun Yang --- kernel/cpu.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/kernel/cpu.c b/kernel/cpu.c index c89e0e91379a..16323610cd20 100644 --- a/kernel/cpu.c +++ b/kernel/cpu.c @@ -1829,6 +1829,11 @@ static inline const struct cpumask *cpuhp_get_primar= y_thread_mask(void) } #endif =20 +bool __weak arch_cpuhp_init_parallel_bringup(void) +{ + return true; +} + /* * On architectures which have enabled parallel bringup this invokes all BP * prepare states for each of the to be onlined APs first. The last state --=20 2.45.2 From nobody Mon Feb 9 20:30:09 2026 Received: from fhigh6-smtp.messagingengine.com (fhigh6-smtp.messagingengine.com [103.168.172.157]) (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 13A4618EA61 for ; Mon, 15 Jul 2024 13:35:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721050555; cv=none; b=t+OWNpGc22ueD48ziMXf+Fnvilf8gxkbFf6wHNQobGJ2lO9cMfWgQGOgZ7ElMKFjL1mYCL+HNmTPu6Yso0whSe1A7bMnTnAHsXOI+UQSEby2eHmAWZyiVB/T0vcL1pMC7qltQ7Omb7T8VATW9Y+eqmbBhXK+TQ5s+oWpNvWWC38= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721050555; c=relaxed/simple; bh=D2mqxCRzQvs1HI/FO9ROzuiLua0L8frnlc80PUjQ/tM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XdeeIVREodkGadFUlqqs+U09UtJc7GEItiuwKaF0cSQiSp1bcREtpIPP3ArOB4fLEmVMKAohAtbDITA8V2PPf+nCpK/COWZ56KvKsAuh2ycWK//LT2qe29YtqlCsTpxISiJZWY42hauwJA2QAoS1Fkcx25UaoYD/vuGZKsNODfQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com; spf=pass smtp.mailfrom=flygoat.com; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b=rC3aYHVe; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=eJHVU+Ho; arc=none smtp.client-ip=103.168.172.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=flygoat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flygoat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=flygoat.com header.i=@flygoat.com header.b="rC3aYHVe"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="eJHVU+Ho" Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailfhigh.nyi.internal (Postfix) with ESMTP id 6866E1147F64; Mon, 15 Jul 2024 09:35:53 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Mon, 15 Jul 2024 09:35:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=flygoat.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1721050553; x=1721136953; bh=HeqE0UK1T7UO6X2hOhXYyZrlSpcrQ0WC48brT+ZdXlU=; b= rC3aYHVePbwlgqXCGlhnLIHB5KSW9cZWAwznoJ9D8Z618oCY1CE6l+npN6VjeQ2o R/I2FnfvAojRyvpSJegPRLssL6Huc4PjM9/xZzf0ATLdUvTAF7uGZXY+7sY2oRR1 OPXae4bFAgw3qtk61P69wjmumJ72RGvtzGqiykRY9ixhc3st4PYUV8INxeDekNuW pQDz33dM4daNlt4eWZW+JlB+w1W+yYMZrhWUcPRxOMhTVAqfdVKDxE6JHYQ40hhf dVYS7whVVlYEHQLg3WM3wgZwt3TFlD1t9JWFA0EWIgV2luBDuF4RMtWdlElW415D sSXxRKNS+RQo8tmKyhxy/A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1721050553; x= 1721136953; bh=HeqE0UK1T7UO6X2hOhXYyZrlSpcrQ0WC48brT+ZdXlU=; b=e JHVU+HozAvP7IYQqYuVwyDwjHLnh4OPhqvltAYoZAibK/KM1Szx7q/Az5N/SmkAf 2a1uOCDfFtUubP2IaR9DAqIrz/iIYhWuu27Aru/Cpm5l2Yous4if8gBFfr9dUeEt 2m4V6Simwzl544VwIjlLpxC8OPR2/rVSxNBi8idpobUKFPfekG6ZlGZ6Clxsynis 6RButDpLvJ/kzR/J314oIMCezPeXEquAQwQPdjDA+30HdBOk4lpVzgnZSJIQhm7X MrNSWBB8TDOToDWu6IuV2qgDypWuYBGfepi4susAjNeaqGLTZ8+sx9WyCg2hw3P/ 3/uJFiyyff7dMR/EKFqDA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrgedvgdeiiecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffugggtgffkfhgjvfevofesthejredtredtjeenucfhrhhomheplfhirgig uhhnucgjrghnghcuoehjihgrgihunhdrhigrnhhgsehflhihghhorghtrdgtohhmqeenuc ggtffrrghtthgvrhhnpefgveeikefhgedufffggeduleejveehgfdvjeeivdeitdeiffel jefgvddvudetvdenucffohhmrghinhephhgvrggurdhssgenucevlhhushhtvghrufhiii gvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjihgrgihunhdrhigrnhhgsehflhih ghhorghtrdgtohhm X-ME-Proxy: Feedback-ID: ifd894703:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 15 Jul 2024 09:35:49 -0400 (EDT) From: Jiaxun Yang Date: Mon, 15 Jul 2024 21:35:30 +0800 Subject: [PATCH v2 3/3] LoongArch: SMP: Implement parallel CPU bring up Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20240715-loongarch-hotplug-v2-3-7d18b3d46b11@flygoat.com> References: <20240715-loongarch-hotplug-v2-0-7d18b3d46b11@flygoat.com> In-Reply-To: <20240715-loongarch-hotplug-v2-0-7d18b3d46b11@flygoat.com> To: Thomas Gleixner , Peter Zijlstra , Huacai Chen , WANG Xuerui Cc: linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Jiaxun Yang X-Mailer: b4 0.14.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5856; i=jiaxun.yang@flygoat.com; h=from:subject:message-id; bh=D2mqxCRzQvs1HI/FO9ROzuiLua0L8frnlc80PUjQ/tM=; b=owGbwMvMwCXmXMhTe71c8zDjabUkhrSpqitCCpoXuB433BvVk5FYW83BfC39V25HXM28x2YPm Dz4b5h3lLIwiHExyIopsoQIKPVtaLy44PqDrD8wc1iZQIYwcHEKwETW6jEyLE45ETrx1x0GTT3x x4xfOZzrz75cE/3qw3qV96d1Gf6zn2BkuBY6z17k/6GXP+SMnAV3PQj4+dtQ4MP5r+z7t5/b7X7 7ADcA X-Developer-Key: i=jiaxun.yang@flygoat.com; a=openpgp; fpr=980379BEFEBFBF477EA04EF9C111949073FC0F67 Implement parallel CPU bring up for LoongArch to reduce boot time consumption on bring up CPUs. On my Loongson-3A5000 ~120ms boot time improvement is observed. tp, sp register values are passed by MBUF now to avoid racing cpuboot_data global struct. cpu_running completion is handled by HOTPLUG_CORE_SYNC_FULL. Signed-off-by: Jiaxun Yang --- arch/loongarch/Kconfig | 1 + arch/loongarch/include/asm/smp.h | 6 ------ arch/loongarch/kernel/asm-offsets.c | 10 ---------- arch/loongarch/kernel/head.S | 7 ++++--- arch/loongarch/kernel/smp.c | 35 +++++++--------------------------= -- 5 files changed, 12 insertions(+), 47 deletions(-) diff --git a/arch/loongarch/Kconfig b/arch/loongarch/Kconfig index ddc042895d01..656435c1dbd5 100644 --- a/arch/loongarch/Kconfig +++ b/arch/loongarch/Kconfig @@ -162,6 +162,7 @@ config LOONGARCH select HAVE_SYSCALL_TRACEPOINTS select HAVE_TIF_NOHZ select HAVE_VIRT_CPU_ACCOUNTING_GEN if !SMP + select HOTPLUG_PARALLEL if SMP select IRQ_FORCED_THREADING select IRQ_LOONGARCH_CPU select LOCK_MM_AND_FIND_VMA diff --git a/arch/loongarch/include/asm/smp.h b/arch/loongarch/include/asm/= smp.h index 50db503f44e3..f6953cb16492 100644 --- a/arch/loongarch/include/asm/smp.h +++ b/arch/loongarch/include/asm/smp.h @@ -75,12 +75,6 @@ extern int __cpu_logical_map[NR_CPUS]; #define SMP_CALL_FUNCTION BIT(ACTION_CALL_FUNCTION) #define SMP_IRQ_WORK BIT(ACTION_IRQ_WORK) =20 -struct secondary_data { - unsigned long stack; - unsigned long thread_info; -}; -extern struct secondary_data cpuboot_data; - extern asmlinkage void smpboot_entry(void); extern asmlinkage void start_secondary(void); =20 diff --git a/arch/loongarch/kernel/asm-offsets.c b/arch/loongarch/kernel/as= m-offsets.c index bee9f7a3108f..598498f47a4c 100644 --- a/arch/loongarch/kernel/asm-offsets.c +++ b/arch/loongarch/kernel/asm-offsets.c @@ -257,16 +257,6 @@ static void __used output_signal_defines(void) BLANK(); } =20 -#ifdef CONFIG_SMP -static void __used output_smpboot_defines(void) -{ - COMMENT("Linux smp cpu boot offsets."); - OFFSET(CPU_BOOT_STACK, secondary_data, stack); - OFFSET(CPU_BOOT_TINFO, secondary_data, thread_info); - BLANK(); -} -#endif - #ifdef CONFIG_HIBERNATION static void __used output_pbe_defines(void) { diff --git a/arch/loongarch/kernel/head.S b/arch/loongarch/kernel/head.S index fdb831dc64df..8dd8fb450f46 100644 --- a/arch/loongarch/kernel/head.S +++ b/arch/loongarch/kernel/head.S @@ -136,9 +136,10 @@ SYM_CODE_START(smpboot_entry) li.w t0, 0x00 # FPE=3D0, SXE=3D0, ASXE=3D0, BTE=3D0 csrwr t0, LOONGARCH_CSR_EUEN =20 - la.pcrel t0, cpuboot_data - ld.d sp, t0, CPU_BOOT_STACK - ld.d tp, t0, CPU_BOOT_TINFO + li.w t0, LOONGARCH_IOCSR_MBUF1 + iocsrrd.d sp, t0 + li.w t0, LOONGARCH_IOCSR_MBUF2 + iocsrrd.d tp, t0 =20 bl start_secondary ASM_BUG() diff --git a/arch/loongarch/kernel/smp.c b/arch/loongarch/kernel/smp.c index ca405ab86aae..ca6a95a0280d 100644 --- a/arch/loongarch/kernel/smp.c +++ b/arch/loongarch/kernel/smp.c @@ -48,10 +48,6 @@ EXPORT_SYMBOL(cpu_sibling_map); /* Representing the core map of multi-core chips of each logical CPU */ cpumask_t cpu_core_map[NR_CPUS] __read_mostly; EXPORT_SYMBOL(cpu_core_map); - -static DECLARE_COMPLETION(cpu_starting); -static DECLARE_COMPLETION(cpu_running); - /* * A logcal cpu mask containing only one VPE per core to * reduce the number of IPIs on large MT systems. @@ -65,7 +61,6 @@ static cpumask_t cpu_sibling_setup_map; /* representing cpus for which core maps can be computed */ static cpumask_t cpu_core_setup_map; =20 -struct secondary_data cpuboot_data; static DEFINE_PER_CPU(int, cpu_state); =20 static const char *ipi_types[NR_IPI] __tracepoint_string =3D { @@ -340,14 +335,16 @@ void __init loongson_prepare_cpus(unsigned int max_cp= us) */ void loongson_boot_secondary(int cpu, struct task_struct *idle) { - unsigned long entry; + unsigned long entry, stack, thread_info; =20 pr_info("Booting CPU#%d...\n", cpu); =20 entry =3D __pa_symbol((unsigned long)&smpboot_entry); - cpuboot_data.stack =3D (unsigned long)__KSTK_TOS(idle); - cpuboot_data.thread_info =3D (unsigned long)task_thread_info(idle); + stack =3D (unsigned long)__KSTK_TOS(idle); + thread_info =3D (unsigned long)task_thread_info(idle); =20 + csr_mail_send(thread_info, cpu_logical_map(cpu), 2); + csr_mail_send(stack, cpu_logical_map(cpu), 1); csr_mail_send(entry, cpu_logical_map(cpu), 0); =20 loongson_send_ipi_single(cpu, ACTION_BOOT_CPU); @@ -525,20 +522,10 @@ void __init smp_prepare_cpus(unsigned int max_cpus) #endif } =20 -int __cpu_up(unsigned int cpu, struct task_struct *tidle) +int arch_cpuhp_kick_ap_alive(unsigned int cpu, struct task_struct *tidle) { loongson_boot_secondary(cpu, tidle); =20 - /* Wait for CPU to start and be ready to sync counters */ - if (!wait_for_completion_timeout(&cpu_starting, - msecs_to_jiffies(5000))) { - pr_crit("CPU%u: failed to start\n", cpu); - return -EIO; - } - - /* Wait for CPU to finish startup & mark itself online before return */ - wait_for_completion(&cpu_running); - return 0; } =20 @@ -561,22 +548,14 @@ asmlinkage void start_secondary(void) set_cpu_sibling_map(cpu); set_cpu_core_map(cpu); =20 + cpuhp_ap_sync_alive(); notify_cpu_starting(cpu); =20 - /* Notify boot CPU that we're starting */ - complete(&cpu_starting); - /* The CPU is running, now mark it online */ set_cpu_online(cpu, true); =20 calculate_cpu_foreign_map(); =20 - /* - * Notify boot CPU that we're up & online and it can safely return - * from __cpu_up() - */ - complete(&cpu_running); - /* * irq will be enabled in loongson_smp_finish(), enabling it too * early is dangerous. --=20 2.45.2