From patchwork Tue Feb 7 23:04:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Usama Arif X-Patchwork-Id: 54108 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp3127948wrn; Tue, 7 Feb 2023 15:07:35 -0800 (PST) X-Google-Smtp-Source: AK7set/741K/F42h+Uu+1LBcbd+/l8fcqvRsDqRwttwiTYfRegnS0MXsu0041JzDVf6BuLCRCj4V X-Received: by 2002:a17:907:6da6:b0:878:4497:380e with SMTP id sb38-20020a1709076da600b008784497380emr7305288ejc.4.1675811255769; Tue, 07 Feb 2023 15:07:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675811255; cv=none; d=google.com; s=arc-20160816; b=qYp6FIQcAXdiMZauHqCS49O8rYwRKgvhw+Zde3qvY1UrcQEMVN8anfIYdjZyQ8g/FP nQhIT6DkrzZCpaMNIsaGUbW0isLxdvmKvTE6bztm8AuKRjTlzvMSQZ+101q/fnDROPfy T2Xf5Oxkhxc9Tw5Ypkhzj0tt7ZpECfqs0MRM96ebQ3UXa/Z00n0q5scOREOOkkGGhnRo VhaH1ek7Ri4RUpxEf8xqK1vs8AFoYSdNwu0xKyXDTmeyBlFiaFKS3og7l397VF5ZSVgy cyyifODIfbrk75kL0y33+2gGSiyqDg9zCvRA5wJfG4d3vpWdz/rUVu4uj8hG2feTQ3xP yN1g== 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=XKydoXD7DOLwoETiq1rVpdNfhGCr3/VFLGt4p4rSeXA=; b=dZmFwVHBQNbAk4UZy19BzFmN7d/WJyZmxgylZkSOzNvTdmtbnv1w++PgGTThrp20VZ 4aadiQ6EF4lxfIL4GVlLIw/Ma5IbTtfV0NaZlgOEbVAB1Xav9LMTzCtpNLGy1UtOVf5M vgjBL8ArNFPyOpeHfjMzQSZg1PtoW5JYv0S4QTHEgeqRG9avz2Ml6Sw2EYt9H5WBpXuP hBxYG0Hwg61JUZAvmuZdLZG+evZkcLGaz+vZKpam6htagn7CkN3qs+Yp3tyjulXFZbGg 4a9rH7TA34UiFLxPb0wuD5Ld2c8XE/5KAkM24Ereu2wZZ3Fqxq3+kCFXeUvowI+wc1ki g/xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b="Hzld0/Jk"; 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 l6-20020a170907914600b0088adcfbd9basi14482584ejs.988.2023.02.07.15.07.12; Tue, 07 Feb 2023 15:07:35 -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="Hzld0/Jk"; 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 S230232AbjBGXFb (ORCPT + 99 others); Tue, 7 Feb 2023 18:05:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230094AbjBGXFJ (ORCPT ); Tue, 7 Feb 2023 18:05:09 -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 B28383EC53 for ; Tue, 7 Feb 2023 15:04:43 -0800 (PST) Received: by mail-wm1-x329.google.com with SMTP id l37-20020a05600c1d2500b003dfe46a9801so221564wms.0 for ; Tue, 07 Feb 2023 15:04:43 -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=XKydoXD7DOLwoETiq1rVpdNfhGCr3/VFLGt4p4rSeXA=; b=Hzld0/JklLKS5ElmGesXwglnkEAxlghpu5u+RXXd8eLsmOBqmKGgmg/qpnGfZqokHq xUsE3XHUe3Wb5Gb04q1hiJbGh7DRco334Cn/d4qz0EKEFguht/H01YPLaE854A+cMzQc 1ScdgN27hmzjlVkkipBYathx6d0cXlkCEVlowZvJ45FYP7K7RKFDR1CZh3oiqnt2Lbmo XwDNLs+HdrccUIMu2IPnOs7QW6S/uDGFi+dhru1+sk9ik7jGDE/wwEcNfVVxnes8Ss/5 qjNvJ4ZvZqZ3z1vzSsH3pSwX5od8kU5TKKyoIXJqigf0F0ci353HD5n6dEL1bbiOyOHx wK2w== 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=XKydoXD7DOLwoETiq1rVpdNfhGCr3/VFLGt4p4rSeXA=; b=j82Ha1OS4v7/xGtoTKMhFwxuGI/aLNbpNGyQxjQs9+D802K/PVFhY+fHe9wfZofDVR lkEFAKcGjtDrKl+BOFle9lj7q/JYGa5ZjxkpSznatzPLxvf7817FkEdHvA1iNpIk12NN k21hbUdIiy8651URtyp2ZCi4SHWM18Z4A4kra4/odcpb0yxdG33SgxBom96YoKXB3XJ1 BJC5No1NdW1qzKruwa8SO1q8Royy2yFdvF/13w5Uve+pnnmRgxWYvZttG0XS8q94zMb3 UsNGa1qMrz0OwSS6XpxPysj9r5k83ycgjcOpBMKJSdxuGDi8DG1b+LnOCmYgW2ptRj8q 1p8A== X-Gm-Message-State: AO0yUKXrW4+odtFmW2cOTFAmnc5gLOu+WTBhGWuTsSkvjkYFYGsAK72R q+m5Ryfn0dOoM/L5JTjjyAY0Wg== X-Received: by 2002:a05:600c:319d:b0:3df:e1cc:94ff with SMTP id s29-20020a05600c319d00b003dfe1cc94ffmr4565048wmp.28.1675811082324; Tue, 07 Feb 2023 15:04:42 -0800 (PST) Received: from usaari01.cust.communityfibre.co.uk ([2a02:6b6a:b566:0:c04f:2463:c151:8b87]) by smtp.gmail.com with ESMTPSA id j14-20020a05600c190e00b003dcc82ce53fsm146485wmq.38.2023.02.07.15.04.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Feb 2023 15:04:41 -0800 (PST) From: Usama Arif To: dwmw2@infradead.org, tglx@linutronix.de, kim.phillips@amd.com Cc: 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 v7 2/9] cpu/hotplug: Move idle_thread_get() to Date: Tue, 7 Feb 2023 23:04:29 +0000 Message-Id: <20230207230436.2690891-3-usama.arif@bytedance.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230207230436.2690891-1-usama.arif@bytedance.com> References: <20230207230436.2690891-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?1757215463356214794?= X-GMAIL-MSGID: =?utf-8?q?1757215463356214794?= 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 --- 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