From patchwork Thu Mar 2 11:12:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usama Arif X-Patchwork-Id: 63348 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp4174343wrd; Thu, 2 Mar 2023 03:15:54 -0800 (PST) X-Google-Smtp-Source: AK7set9/g8cReTDFkuIl7r6w/WiC/Fl0AsboQmYMkLtW/tVtvob+Y7vogMcjvGKLV+q0cRdd2Q5U X-Received: by 2002:a17:906:fa82:b0:8ea:a647:a5aa with SMTP id lt2-20020a170906fa8200b008eaa647a5aamr1675722ejb.38.1677755754316; Thu, 02 Mar 2023 03:15:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677755754; cv=none; d=google.com; s=arc-20160816; b=bQHxjCXqS2bCslTKMRoW13M3RyEDQ7hraJjPN8/OzIpaj+NnLR5dNkKH25hDOuoI8D uP5FfzYJV+3927UAAjYvL7Zl4mT2z5BIxTcuSuuet7e/N+kP9TS1W2W1GHsDYNVyFT/R LptbRSgKo/1ltzJ04PLwqOVy5cC/o2sAq9e3xrNN5YPfs3toBpDSZvhyPPiqDxPAjFJg RBAAjNY5p/zhxP2QJ93jf4EhS+2Y/fqzkxvkJhZFS9a7/wAQmgCnD41HEXMdx6l9IMsp RyzibPTzDEbaNdjQpXhH4v6cfPAvUa+/TsIqveBnUjjGPnxXh5vZk4pHR7ucBKglQPkv kl1Q== 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=yiUW1pdFu+3eaCAo8YZ8I/9Kv/T31srA3nwaiuSJpaRCptwkBRF5/XUPf+N+CN7yX+ 4HNKzLjg9TzsYy1RA/c9ykj3DWG+k3VWLs3DEPAUdLpZ1R8SOI9Wz3oPyQWdtzN4HlYy kMvGIZluHANg0oG93bfR2yPRYaScEYbKFyeTR/A5VyfdZfzM+O2xYHG9iZP+HYXX0eOg Y7UZTAz3pMlIeNd5wpoiUQSShIxruCPTen2ASMiT0p/6h+pIE7SKT7G36Rxi9ggub+YS kYG1486aff7NVyAitx0Rb8ipA6SdGc34umXGMmajKxk+Aw2/NrtF04JheNqeBwo0vtwk lMmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b="D+r/dhbu"; 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 gh12-20020a170906e08c00b008d28622c8dcsi3087745ejb.566.2023.03.02.03.15.31; Thu, 02 Mar 2023 03:15:54 -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="D+r/dhbu"; 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 S229816AbjCBLNN (ORCPT + 99 others); Thu, 2 Mar 2023 06:13:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230179AbjCBLNB (ORCPT ); Thu, 2 Mar 2023 06:13:01 -0500 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AE1A460A2 for ; Thu, 2 Mar 2023 03:12:34 -0800 (PST) Received: by mail-wm1-x333.google.com with SMTP id j19-20020a05600c191300b003eb3e1eb0caso1451909wmq.1 for ; Thu, 02 Mar 2023 03:12:34 -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=5ygAcJKnTKCTvVciunh9HcyMwipcH5PYmlVu4YEhebA=; b=D+r/dhbux9bWn3bdSKFMDOmtU+M9oGCX43ZJiTWYM8hQdBEDxb7vPAHENCcra+PfhR AnfvEJ4nQvLE4ozP9Gei1DHQHiIE/o2sTEA9uqbJRlv0bnTrwjGqSxOCIAgV7KLksPeJ UX20qqolJbRP6QeitCMEwH1zbqHixH8DeLgOiMX3O9h6yeK3nBmJm4JwM3NjQ3vJLXDP BiYlPEMUlFdczGF716HEL/Mwj2tdCaNQtr/7Bu5RBGBLNHg1+WZzV+s1yuvcEL5T02mF hR2N2U/WYR98LUG0ZYGePMLz6V/9gYx7Q3cZHeyB6H07jJmf5dFwAEZ9DX0rftaQgK72 1l9w== 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=5ygAcJKnTKCTvVciunh9HcyMwipcH5PYmlVu4YEhebA=; b=tSgIrjjyDpkh0RgqzhvB8j3p63BQtBFu8E5mcRyyVN1cfDngsQB7pMxO2AQfQXeCMw 0CokP5BoXT8nc7hMVeTNwbLsuUgPbZpuDoFMkfdmMmnJ5r1fvgPIUVKbVPm3lzllhbID j7OlvDzp7f01j9pufKah/0QmmifrOUktpZhtgxDKMlzNHFkLLacdZQIjQET/JS+QAEbt MKWxWym23XRGy2jO/jNuxm/mKTIBg27jaRDQhag1+wqr8J+y1VWd5xUQju8OjGsKD0yJ jCLE4LPgIQh1rqZW5pE/AaPQ0TD8CxIOf5l/MKmW6UVYE6NQ7kUGD8LIlYRAlfnQwAGv WY0g== X-Gm-Message-State: AO0yUKXoXKzpTr2zXETL4QlIIEJd+N3Rujjtt6sF053N3LSTcQaaPBoL 3EiTWPFofASSpWTafnhpZrQiPQ== X-Received: by 2002:a05:600c:3c9d:b0:3eb:598d:6494 with SMTP id bg29-20020a05600c3c9d00b003eb598d6494mr1197912wmb.16.1677755552821; Thu, 02 Mar 2023 03:12:32 -0800 (PST) Received: from usaari01.cust.communityfibre.co.uk ([2a02:6b6a:b566:0:11aa:3c13:d3e:eb29]) by smtp.gmail.com with ESMTPSA id a5-20020a5d4565000000b002c3f81c51b6sm14724830wrc.90.2023.03.02.03.12.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Mar 2023 03:12:32 -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 , "Guilherme G . Piccoli" Subject: [PATCH v13 02/11] cpu/hotplug: Move idle_thread_get() to Date: Thu, 2 Mar 2023 11:12:18 +0000 Message-Id: <20230302111227.2102545-3-usama.arif@bytedance.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230302111227.2102545-1-usama.arif@bytedance.com> References: <20230302111227.2102545-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?1759254417495015176?= X-GMAIL-MSGID: =?utf-8?q?1759254417495015176?= 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