From patchwork Thu Feb 2 21:56:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usama Arif X-Patchwork-Id: 52194 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp494743wrn; Thu, 2 Feb 2023 14:00:29 -0800 (PST) X-Google-Smtp-Source: AK7set83lxml3BznqblWd/H+mxC+WzoqYaFYoYD9JR8NpeGorRMDwRL/quN91HAsUlxOyoLddUAX X-Received: by 2002:a17:906:c089:b0:88f:895f:1ba4 with SMTP id f9-20020a170906c08900b0088f895f1ba4mr2556044ejz.57.1675375228852; Thu, 02 Feb 2023 14:00:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675375228; cv=none; d=google.com; s=arc-20160816; b=Kb+1HpqeWI7tUl9d5hdRPiuIr+5XDoCpyaAnjxj0BSsYKvoPwfL8l0XgtAO87yvfO2 uAuCNaiehS4WQfnFB8F3+c92CVFMA9N7hF06kp2ggfyA6k2NaO7Op3tUnFneflnIXMIN E/iKZQyzlJJ8Ua08fhBJErxNgUREJJBuCQ8fCr7sWyn4YpbCximASkmzzfSdqQMVl+4K Vlo6SJ0/vVlnOdzA4FTzPt1ykqqIXjrDlzCzsVK6WvP65+KEnBLRIsUCcCTNHCTbb5YF 1jwMGQs6+r3kzDEKWcgeF8BJv3Dsw7PZ9JddsCmkTi5FfL0hkQrvw7wpZNVlxcmR9D86 kk1g== 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=fGUMPbv5ehkWjyJkrcI0+C5Cz30zQDLH70pUeAdBLkQ=; b=ecsaq++tzABaY5vJulO/Hft6hKvHaPEsx4zrTgPRB1pRenK1bGWjY5LDzkgeII2PPZ 4Vzl11d1quX3Er0HB4bR3pivoUzF6iiUPEu11szJev4yqlHWYe6lSULUqgNmHR+f6VQJ AKdyNYjgSn1Iq+bn5hnqzI5PSZnrFpwf/bnEdRZtAk8bctg9Vksi9n3GUH2tTlZLxSJr /7yzxQTybITdUDTGx3to5CFot/glZGiElcBWoy+vwu7whhP8h7KXWT4JCldQ460e1NEo 9E7c3vE7a+ARsBonVoVrmduATGtd5a9diw1h+YneDR6Fm8FQNJJ3BjYdYgrvBHirCcee YBcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=2M4JOPBX; 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=fail (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 29-20020a170906009d00b0088767839e39si1170687ejc.72.2023.02.02.14.00.03; Thu, 02 Feb 2023 14:00:28 -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.20210112.gappssmtp.com header.s=20210112 header.b=2M4JOPBX; 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=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232836AbjBBV5b (ORCPT + 99 others); Thu, 2 Feb 2023 16:57:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54992 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233139AbjBBV5M (ORCPT ); Thu, 2 Feb 2023 16:57:12 -0500 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAC8A6B02C for ; Thu, 2 Feb 2023 13:56:33 -0800 (PST) Received: by mail-wr1-x434.google.com with SMTP id a2so2718257wrd.6 for ; Thu, 02 Feb 2023 13:56:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; 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=fGUMPbv5ehkWjyJkrcI0+C5Cz30zQDLH70pUeAdBLkQ=; b=2M4JOPBXhf4n8GQQdyrzHe3qWIJaL7f9plv5S3ltmqAiKFtsvcGXGUTC2Zuij3BMbs HhlEqG9+INFdfdUkReFlmvH2JPZMrNCztu3WfOAY+06RdcFUOlBB41XvMs68Ya736yK2 nOZn1J7hYgH42tp/gN4crt3m2pxOLEjJAusMRXcc680eWWrSJLJMCjmPufzsVttIRkCW 9QkU3r7GppcN34bu8GaPenanJDgtpVPDONSrvDRiSQXJXkEZApH8tlqbG9jFp0sxPyy2 H0xXvJvm2qthioHCwmimhIU+Q9Nh8Kc7h/9OaMxXMAdSlKwy88YLZFA1gae6hbRvVar+ bsdg== 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=fGUMPbv5ehkWjyJkrcI0+C5Cz30zQDLH70pUeAdBLkQ=; b=OnzoFneTumeAw6vXt0+npfg9as+1uKMrzdb1/2ObA2Qbz9opAG2bkfdgIo+L/DzzcS khX7tNB14dJB7Ua9/+jDfvaxQQwJb7MoOR3REK1T5awBJOdTRPV0gmtbbFhg6n0IsnWt 8QeQPwE8C4rt3J9X1lXMPvLDtC74rTI0uczHDhtdb0ftq6hzQMv7lAsJ+35KWTw/I6tj OAJlb+TsSIZS16LoglSPFKxhBX2GUU8/zOLQci1RRcx/vQixt8sdnu+uzkLBSM5NuIpZ ibRtlejtB9zR3pvlhXUdGiBLmUXCSkf8851u6maFaSfft1orF61ZnnCt3epDWsgLxe2s EtYA== X-Gm-Message-State: AO0yUKVpJTvouQJ0TNmdo2Ejdzk+kb8sGfxUi4+DZeAJzjuemFSR7GDY dy1jfWWW3+Vut7m2Mjd4L9WDtw== X-Received: by 2002:a5d:6c6d:0:b0:2bf:d6f9:23d6 with SMTP id r13-20020a5d6c6d000000b002bfd6f923d6mr7783377wrz.45.1675374992316; Thu, 02 Feb 2023 13:56:32 -0800 (PST) Received: from usaari01.cust.communityfibre.co.uk ([2a02:6b6a:b566:0:98fe:e4ee:fc7e:cd71]) by smtp.gmail.com with ESMTPSA id e8-20020a5d6d08000000b00297dcfdc90fsm506078wrq.24.2023.02.02.13.56.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Feb 2023 13:56:31 -0800 (PST) From: Usama Arif To: dwmw2@infradead.org, tglx@linutronix.de, arjan@linux.intel.com Cc: 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 Subject: [PATCH v6 02/11] cpu/hotplug: Move idle_thread_get() to Date: Thu, 2 Feb 2023 21:56:16 +0000 Message-Id: <20230202215625.3248306-3-usama.arif@bytedance.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230202215625.3248306-1-usama.arif@bytedance.com> References: <20230202215625.3248306-1-usama.arif@bytedance.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,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?1756758255656536221?= X-GMAIL-MSGID: =?utf-8?q?1756758255656536221?= 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 Signed-off-by: Paul E. McKenney Reviewed-by: Thomas Gleixner --- 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