From patchwork Sun Feb 26 11:07:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usama Arif X-Patchwork-Id: 61593 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp1897976wrd; Sun, 26 Feb 2023 03:09:41 -0800 (PST) X-Google-Smtp-Source: AK7set9SE0VksEWSNKYTllbQU8UQ7GBqlgY+oYba7YTFQqg8NiWRAwCR1PW1TWUG1EZ9z8KS29gi X-Received: by 2002:a05:6a20:6914:b0:c7:5700:30bb with SMTP id q20-20020a056a20691400b000c7570030bbmr17066331pzj.4.1677409780630; Sun, 26 Feb 2023 03:09:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677409780; cv=none; d=google.com; s=arc-20160816; b=0aJcpKqPmtPQvlJZRasBGBwrDL64t1c3If0n1a0k+vNphcN5w7oYt9XIx+mvDTNpKO MwnLjh99OJJ3GrwHQYCMYredmDrL7PUZdLBaDhKgTPGjomJ6DWhUcBt6rNz1U4jbMbn/ lJqESuZcGxQZ6Al3/QfLjvU7E7vOpqkOt2ZHqoTmqsAUJ+ktc/Ac/u7U2gTsewbMDNsr bqPbAhgLQ2s/5R1l60YZqilO/vc8yD6hsRyFOPE5lztg5zsFRwhRtwfkJRb/8SxQxj11 RnYQjV/IB8lLtVRD2sfG3UTBZxsVubjdqo9pDdoNKxzqXm2FoKftnhlz5n4+TDMWe38s h6Pw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=7yne835l8M0Qgk6uaQXrJLgxrNefMQSePYhKpKknocM=; b=vgNerQIp3LsywG25BCzTxbg3k3Jt9KRbNFXSUJF5H6xTkFluo1y4vHbYtUHkz4srK3 dE3vNhDFz3xsZb/ml5VzDAPVYzqgjbd4lXk1mrQ/J71Q5p9UB0b4wMC2yk9iNbvxduAx VfE3P6+6hVeMYdqVmdc8AW3DW+DQbAt6blP09gzJcD7Ab7tSzxFr9YUjVjMmhLKTeYaU 7vQGzbajyzyb/6CRGvIpY5Hd3VK/VO44+8ysMNdGf+Y0AyGoAylvFeSn3Ke1rmiYFOqJ Ls/hhWrlrR3NHTI3tfpQ8oGBBBijUpxPHytmiD7XaDFiTkC0ltWUM04yU8WrAlXm+DIG xSJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=Vdmli2xd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fa24-20020a056a002d1800b005a8aef3567bsi4333145pfb.100.2023.02.26.03.09.26; Sun, 26 Feb 2023 03:09:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=Vdmli2xd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229657AbjBZLIk (ORCPT + 99 others); Sun, 26 Feb 2023 06:08:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35934 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbjBZLIi (ORCPT ); Sun, 26 Feb 2023 06:08:38 -0500 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7E5DAD33B for ; Sun, 26 Feb 2023 03:08:08 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id c18so2524137wmr.3 for ; Sun, 26 Feb 2023 03:08:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=7yne835l8M0Qgk6uaQXrJLgxrNefMQSePYhKpKknocM=; b=Vdmli2xdqqTFvFajej6BB3WjL5gX6kzXUQGsY/1NZ8H7n5Gnr4CKYxNsCZXbok81JA zVSdR0aOwQ5OQLk7wimvdRz7uv7ebiDukmGfPNpSBzLWFX+PHn/QmHr6mk1hKqEerdWo 13DqD17obUw8AE2Iurcm2ND4c/p6rPkZiq1Up0YrBfQS3R2+xPg5Yy7U5z0PRVFsRYNN nUjuZu0ro9na0ZN2HWU9tQMqE3LJxIiHet33Duwdt5VhpMbN62ZoANHgob46Pj5cfDeY kIacdjh1vIClKSrtoSVAUejXgkyd60bxL+DGr5VJo6oE8xZ7AiYokCKxOzRbsuty8aGH k2jQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7yne835l8M0Qgk6uaQXrJLgxrNefMQSePYhKpKknocM=; b=NTjNIxI9cdqKoNtrLI1yBBolKQv6cxSphHpNAKtXsk+9Kpwe0Yg5/fHqR9Ww9P9Jm2 c95jJUDv/5rDiNRy5qCuGldt0ZRhli6F2xhTs4a/5x/VoEaBKyhXf11bANYegPdiBkUD TWEzzAUrQ0L31YMfM/nOl9hGDrifbiCeoDzcgkBMJXLzr3WU/i+Xzm0N1aZOIjuh693v rlcllOVfNJroSa14eK1NB5WnYJ5VsqMyadmc/GvD5cPisyjt3e8ptROr6A7cAAAcBgcy 2Q5Dw1NpxPSwRSywJN9ZWRBAsaL3Kk9T0o7DSCN5bsf2hmQXsVGNolqLM7TozqWezWHB ++Iw== X-Gm-Message-State: AO0yUKVcGzTckv2eIhWRS8VgQ5zNPFNbnr2zTEosMaQaG9p17TsAhLyh 2BcYw27A5vuFuTtXYObNhW5xYw== X-Received: by 2002:a05:600c:829:b0:3eb:399d:ab24 with SMTP id k41-20020a05600c082900b003eb399dab24mr1739119wmp.28.1677409686868; Sun, 26 Feb 2023 03:08:06 -0800 (PST) Received: from usaari01.cust.communityfibre.co.uk ([2a02:6b6a:b566:0:df7b:4668:3e23:d0c9]) by smtp.gmail.com with ESMTPSA id v22-20020a1cf716000000b003e1fee8baacsm9157318wmh.25.2023.02.26.03.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Feb 2023 03:08:06 -0800 (PST) From: Usama Arif To: dwmw2@infradead.org, tglx@linutronix.de, kim.phillips@amd.com, brgerst@gmail.com Cc: piotrgorski@cachyos.org, oleksandr@natalenko.name, arjan@linux.intel.com, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, x86@kernel.org, pbonzini@redhat.com, paulmck@kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, rcu@vger.kernel.org, mimoja@mimoja.de, hewenliang4@huawei.com, thomas.lendacky@amd.com, seanjc@google.com, pmenzel@molgen.mpg.de, fam.zheng@bytedance.com, punit.agrawal@bytedance.com, simon.evans@bytedance.com, liangma@liangbit.com, David Woodhouse , Usama Arif Subject: [PATCH v12 02/11] cpu/hotplug: Move idle_thread_get() to Date: Sun, 26 Feb 2023 11:07:53 +0000 Message-Id: <20230226110802.103134-3-usama.arif@bytedance.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230226110802.103134-1-usama.arif@bytedance.com> References: <20230226110802.103134-1-usama.arif@bytedance.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758891637832549465?= X-GMAIL-MSGID: =?utf-8?q?1758891637832549465?= From: David Woodhouse Instead of relying purely on the special-case wrapper in bringup_cpu() to pass the idle thread to __cpu_up(), expose idle_thread_get() so that the architecture code can obtain it directly when necessary. This will be useful when the existing __cpu_up() is split into multiple phases, only *one* of which will actually need the idle thread. If the architecture code is to register its new pre-bringup states with the cpuhp core, having a special-case wrapper to pass extra arguments is non-trivial and it's easier just to let the arch register its function pointer to be invoked with the standard API. Signed-off-by: David Woodhouse Reviewed-by: Thomas Gleixner Signed-off-by: Usama Arif Tested-by: Paul E. McKenney Tested-by: Kim Phillips Tested-by: Oleksandr Natalenko --- include/linux/smpboot.h | 7 +++++++ kernel/smpboot.h | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h index 9d1bc65d226c..3862addcaa34 100644 --- a/include/linux/smpboot.h +++ b/include/linux/smpboot.h @@ -5,6 +5,13 @@ #include struct task_struct; + +#ifdef CONFIG_GENERIC_SMP_IDLE_THREAD +struct task_struct *idle_thread_get(unsigned int cpu); +#else +static inline struct task_struct *idle_thread_get(unsigned int cpu) { return NULL; } +#endif + /* Cookie handed to the thread_fn*/ struct smpboot_thread_data; diff --git a/kernel/smpboot.h b/kernel/smpboot.h index 34dd3d7ba40b..60c609318ad6 100644 --- a/kernel/smpboot.h +++ b/kernel/smpboot.h @@ -5,11 +5,9 @@ struct task_struct; #ifdef CONFIG_GENERIC_SMP_IDLE_THREAD -struct task_struct *idle_thread_get(unsigned int cpu); void idle_thread_set_boot_cpu(void); void idle_threads_init(void); #else -static inline struct task_struct *idle_thread_get(unsigned int cpu) { return NULL; } static inline void idle_thread_set_boot_cpu(void) { } static inline void idle_threads_init(void) { } #endif