Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1893001pxb; Wed, 2 Feb 2022 15:12:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJw0a2/PqLM2RbR0D0r0q0HOIxISiZZjKK7Ypcb4oQtnzkBUJovHQs0Shd+nwVDCyfiu1Faa X-Received: by 2002:a05:6a00:1345:: with SMTP id k5mr32018347pfu.29.1643843558069; Wed, 02 Feb 2022 15:12:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643843558; cv=none; d=google.com; s=arc-20160816; b=obYov6DiXuo2klkmktyXs5E3AfaGc9Qwfj/OEwnMbE9HzICpXWBODHZ4c9XKXQDihY +R2nQZILK+Qb06zN9MlkrKOJfDsaL4uwL09AKkVT7LQynyGF5HzHJpP2Ua9dpfBQl/2E ldS4Jc5Cqc6ZFYh+xlplZyzCzA+7yBEzVx3zzile3j8ehvESR76YmUobBrKzkn9nshnW mMKtMr0Ps3STOog5xu1BL0cH0otLAGZtzFv5QyzaO4R5B4Y9EiulUfcUxWMkGtn6qWEF gnwJTbsWA6A925D/ZNnxNPjqwVjvLpVHAYr1H6Ep8SBHfjHRcCZAKAGXzR9yTAM3+5j7 VEuA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+m8b4MmnKaFM8Q1bbPHzHVcSGwWaH9UePP2ld8ZDDu4=; b=PMxtOT+yHY1e9TGIOjM9Nov3A9IWjuCGLoMNZ0xh/k9euaWbpu9cTXLst07oYDe+kY UaXIEOx4wM8emFSVP9F6UNPBWbUUJD54mhGfqMJKD7yL+oOLuR4RkecH6UQkrpt5JJWo DuOVx+pv/eQxoRQDgMYxX7vrFuK9S6bjOLg/drUWUl5fWG1uvT6ibTBBdlgCAp4cvOfu 0AiVKPQwAL9/C6uFr5Yj/O7D2yBCXoVSVRtmueINfsXIZkt1SMV+eDlpC5Gshu/YWA+/ 6LNscAkC2ZM5GY2sF6IMfNlynJLXQ3ohYIZOPyVn0qAy9K3MEqS2K+dwysoiabuTf46H U71g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=jumZSShV; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h125si20439872pgc.280.2022.02.02.15.12.22; Wed, 02 Feb 2022 15:12:38 -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=@infradead.org header.s=desiato.20200630 header.b=jumZSShV; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233483AbiBAUyL (ORCPT + 99 others); Tue, 1 Feb 2022 15:54:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231462AbiBAUx7 (ORCPT ); Tue, 1 Feb 2022 15:53:59 -0500 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45B05C061714; Tue, 1 Feb 2022 12:53:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=+m8b4MmnKaFM8Q1bbPHzHVcSGwWaH9UePP2ld8ZDDu4=; b=jumZSShVUETirl1tLnJB+5NYYC U4fv5mm0n3ULCb+EoTIMFKrJPrLiWC5MckRt95sOuOZ7uS4alEW5cdx3rkQEzNSn+kkOc5tjXWbPb WFWl/YWMnxgSD2sHS+7CfeDW2M1bpKyW9VQQFrplzHaTjNaYvTfOoWcY9ApGyJ3Kn+IwTu+Po4nzL 6UbXjnFonlP9sshUu8QUQ9rHfj9WCf6qE7kKfyZh8Kd2ynBLHITACtZqXwJPzxbrMAz9MNBiYTRkN Up0U6Q5TWIIwvc3xcByAl+zY2IZyzx8+EtnBKdeLKrberpZFvOi5QYvExEM4vgaPo9MZMBr5zo0+a vOTeXKhA==; Received: from [2001:8b0:10b:1:85c4:81a:fb42:714d] (helo=i7.infradead.org) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1nF09b-005yYQ-UV; Tue, 01 Feb 2022 20:53:32 +0000 Received: from dwoodhou by i7.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nF09a-001Edf-0U; Tue, 01 Feb 2022 20:53:30 +0000 From: David Woodhouse To: Thomas Gleixner Cc: Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H . Peter Anvin" , Paolo Bonzini , "Paul E . McKenney" , linux-kernel@vger.kernel.org, kvm@vger.kernel.org, rcu@vger.kernel.org, mimoja@mimoja.de, hewenliang4@huawei.com, hushiyuan@huawei.com, luolongjun@huawei.com, hejingxian@huawei.com, Tom Lendacky , Sean Christopherson , Paul Menzel Subject: [PATCH v4 2/9] cpu/hotplug: Move idle_thread_get() to Date: Tue, 1 Feb 2022 20:53:21 +0000 Message-Id: <20220201205328.123066-3-dwmw2@infradead.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220201205328.123066-1-dwmw2@infradead.org> References: <20220201205328.123066-1-dwmw2@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: David Woodhouse X-SRS-Rewrite: SMTP reverse-path rewritten from by desiato.infradead.org. See http://www.infradead.org/rpr.html Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 -- 2.33.1