From patchwork Tue Mar 21 19:40:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usama Arif X-Patchwork-Id: 73029 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp1975877wrt; Tue, 21 Mar 2023 12:48:09 -0700 (PDT) X-Google-Smtp-Source: AK7set/I5gxz7Kr2L1o3TiYvLvZbgRo5QLevZrAlb9t0QxpS5rFfa5Fe/VmO9Scyfuagn8sVMDp9 X-Received: by 2002:a17:90b:1b12:b0:23f:7625:49b6 with SMTP id nu18-20020a17090b1b1200b0023f762549b6mr853276pjb.37.1679428089268; Tue, 21 Mar 2023 12:48:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679428089; cv=none; d=google.com; s=arc-20160816; b=c3bFTcjr049lFoinzgiD+Ue3kxiCDJygIDAVc2rrhmbuAA5lWtUW/f8sWPwWZbw9lA KctBzyrXZX7FGU/DJDCQhatRxzYciY8sbVSGETtQwVMljnMexSeXlTrQnFdCrqhc+s18 hncPE+rqMWLk4DmXAg8nzdaTOQ7SzNMa63uzemD5yHI5UdaM+Qc9FTJQ6pI59WykMcRW rVzzRwOn7PS2/7pIwPEnh6J9SMMqkwjCml2akHhbuyYOhpAD6k3QPpNGw49GysFH5+7g Nlq8rN/3kKxDbRcUO7p/S5jbXh7WEgs+TpSiMMoIBHhYWmPX2UezY5LM1osSfC4MVpV8 T4wg== 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=5ygAcJKnTKCTvVciunh9HcyMwipcH5PYmlVu4YEhebA=; b=HhQS4xSCvp8BIwU3iAXpx7mY9e05Y5iY3DRtbxbePnJMLbWc1mU9rOKFBFkIOOhZ8p NGaPzSkytlFOs+BICM+sDkcq2Osxhe8pgk1GIUfrQZAD8wyqw+YEKo71C2ltXLPocNk4 QDKhN8zWGgXEtpvyIyZIJuWU/aeGfq4tb6R19Y5L/OYMITZHuSYaDF8MebPcatlSNHiz o5w9FSrMemJeBzOC/vsm0rexFmHw8fMen1pVW51RRBQxRRvxc2KQ+DJ1AufNd+tuynTy gZg97GxEO/lwm6mqFvgEXVlw+qaTidhVRPw0zwon0j3dhJempnw+3W7Zu9Hbn2f5cuwa UDUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=Iexkp6x3; 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=QUARANTINE sp=QUARANTINE 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 t14-20020a635f0e000000b0050300a5cf3csi14491805pgb.469.2023.03.21.12.47.56; Tue, 21 Mar 2023 12:48:09 -0700 (PDT) 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=Iexkp6x3; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230181AbjCUTmC (ORCPT + 99 others); Tue, 21 Mar 2023 15:42:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33788 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230231AbjCUTlx (ORCPT ); Tue, 21 Mar 2023 15:41:53 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 061EA3BC7B for ; Tue, 21 Mar 2023 12:40:47 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id t15so14874599wrz.7 for ; Tue, 21 Mar 2023 12:40:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1679427635; 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=5ygAcJKnTKCTvVciunh9HcyMwipcH5PYmlVu4YEhebA=; b=Iexkp6x3yyHqDDL6OaZInLzZ93bK+l7wJcqEc9pszCs17KfJta9MRhbYNehOvs8q6D XKUaQuZ2obQke50TshqprcQQZw3dKHyHYgWrm/pzzQPvWpEcQSNPXDZHWw0agky2U+ps ogF9bsf4QHdfeveEvlewrX/zdZYyqcFn8X9/RYcrS0ujc35Kmtm0vgw9+o+KtBZvusTh +rf69A/3woBAMVVa67Agt4vUljhc6SgDCXli6nYiJPzMFpu8uKbrQoUXSg+t94/iROyb Bshdjqa2hgalSv9JjLbbPTgXk8fBP+fK4thtjwGtYVs/MJhLRADue+B62bdcQ1MLig72 6IbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679427635; 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=5ygAcJKnTKCTvVciunh9HcyMwipcH5PYmlVu4YEhebA=; b=UbUK9obk2Bfu9HPLrHD1pHpgpZ9BabFlg0vNlIFw6XcC1132lMTQvFOORVsz87XHRM V9ycQi6gbeiPASGDMAVkXcYojZJWkSdvYkunzb84kiKlxkvC6uVPFnqgfPX7VLQiK2wQ gN0AyMXCHvSV7dNDh5fOGIc/I95QhvjB29nVND5MqSGIlD7ArEPtxnDLHi8BHcOxYmuz TBKLBBNAfcExCoLji+IX1IEk3gDIZV3EZGXSdC5lSOQkIzpwJL+KqDXFk/nmNfCqTOwJ +sIUpaZZBRR1cftT9a/Rj0wReDBn/6UE0wrRQ6MFWnZ9HRnqb091aMjw3j3H30/j4Xbm XLxQ== X-Gm-Message-State: AO0yUKWhaX8rXqLy+gk9uNIs/nwQPiKIeZWO9eX+F/QgAgmqy4IWaR4K ip5wo4vR02K7Hpwh7C0oGkhgxA== X-Received: by 2002:a5d:474d:0:b0:2d4:62ed:e7cf with SMTP id o13-20020a5d474d000000b002d462ede7cfmr3301491wrs.43.1679427635199; Tue, 21 Mar 2023 12:40:35 -0700 (PDT) Received: from usaari01.cust.communityfibre.co.uk ([2a02:6b6a:b566:0:7a8a:d679:ba4e:61cf]) by smtp.gmail.com with ESMTPSA id a3-20020adffb83000000b002c561805a4csm12005026wrr.45.2023.03.21.12.40.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Mar 2023 12:40:34 -0700 (PDT) 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, gpiccoli@igalia.com, David Woodhouse , Usama Arif Subject: [PATCH v16 1/8] cpu/hotplug: Move idle_thread_get() to Date: Tue, 21 Mar 2023 19:40:01 +0000 Message-Id: <20230321194008.785922-2-usama.arif@bytedance.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230321194008.785922-1-usama.arif@bytedance.com> References: <20230321194008.785922-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,URIBL_BLOCKED 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?1761007988204879552?= X-GMAIL-MSGID: =?utf-8?q?1761007988204879552?= 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 Tested-by: Guilherme G. Piccoli --- 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