Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp459132pxb; Thu, 17 Feb 2022 07:42:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJy9AhAq1ZEL8uS1i545rrPZjxfDip1i1WQccbXUP8Jc5YwoRnulcGvi16L7eF8IkNm1/+1X X-Received: by 2002:a17:907:76ac:b0:6ce:72b5:7b7c with SMTP id jw12-20020a17090776ac00b006ce72b57b7cmr2737637ejc.735.1645112530165; Thu, 17 Feb 2022 07:42:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645112530; cv=none; d=google.com; s=arc-20160816; b=SMAUFldbPpyQUxnQ2xvyGwdmLRS6hYXaTQlzvGunkPISz6zXbMIH2v2vEN4EJKHZy5 r84o4i4KlmNJi8HlY1+fcr6dekmyR1WHHGzQD/1or4dDXzrIqLWN3pD34o3qh1DTzgCP VuL9ZNP0zotyj6kI40uNnH3FhnUm/5Tr4jhXXbYbtFoK4Eb7xAt4BuD7rGcAtB3wIngE Z3wlQAncTFfGwTqlK6/RA1TKGXX8AnkJLTHN1EYeKIUBJNk2mSUHlbto7/V/kzYCKlj9 le/QF0UM5JecWpObD21Ec1Zli27ygsTQAJyEb/KZI/ErytIeu/3MxNvlFOgKsWxgjHT4 chpw== 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:dkim-signature :dkim-signature:from; bh=0N2u0jEiOBJ6wA9k02f9xsIuHCuLjYtxcfKJUOlNMLQ=; b=ep4VISrmuR97rygnzIkGg3uZ8gchc/DRB0rzR6o7n/VN5fLin1Y1mIDYUcxxtY71Xf yiOBjaulOe5XcdXA6P45eMUjaMa5CZ46xdmCQQxtemDp3fzCL7uO3CKa7B1VSln1WWL8 6o9CroEuV2xx65T5vbXxfbmCiJhbuA0eABwUbScvGYY3uvY2JRNo2RPIH2vekawmb2aq Zsu0yRBT4kqFKEOsWc5NF50lH1wKqvrFnVS6IH2cUjFenUZbLQeZBCN48IHa7jrWsNas LGZ6NasZu8C+sisP3xCDVe1OYzLvTHMZwSGps3N782cR5oZBlglxC4Cvg3hL8fdf60dD plfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=H0EKjk7I; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp19si2045435ejc.558.2022.02.17.07.41.45; Thu, 17 Feb 2022 07:42:10 -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=@linutronix.de header.s=2020 header.b=H0EKjk7I; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239179AbiBQKYo (ORCPT + 99 others); Thu, 17 Feb 2022 05:24:44 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60726 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238991AbiBQKY0 (ORCPT ); Thu, 17 Feb 2022 05:24:26 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D267B279088; Thu, 17 Feb 2022 02:24:12 -0800 (PST) From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1645093451; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0N2u0jEiOBJ6wA9k02f9xsIuHCuLjYtxcfKJUOlNMLQ=; b=H0EKjk7I/SZP8KecVeRo8F34dE26bMiGuqMRhhNn2faGqFl9i0TwohmIh1RB/vnOmdkZKZ ROY3XT9G1a42F0mKD7iTeFlgmmMfsea3JJQBL7oM9u9hNnRCoHyXlFzA1MtOksKChenIbL sDhe0eY99uw83YGpHomRFj6nU7PjwaYS/y5x+Qi6j1wdmNDPSt+2occBZ/Ts2CW1dlgi7E 9pputWC5iMWxBiUGbygfkzzlKFCNcSbCiiSkzcep59udDEzQSWVHkoYvaaKGQbNiyiAy0l HNF6i96r9kweUnYCmKCNwqHtwtSLhGTJ3dQC52R+oGz8V0xLDrQawhHLD4cdag== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1645093451; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0N2u0jEiOBJ6wA9k02f9xsIuHCuLjYtxcfKJUOlNMLQ=; b=KBpF/ASSmzKE2Tt+Yfj+cGQipTlGHBBUnCt8T+3yweP6Vg+EhGR6tF4wC5hP41n9E1ANh0 tO+9oZNalGNGEmBg== To: linux-kernel@vger.kernel.org, linux-ia64@vger.kernel.org Cc: Andy Lutomirski , Ben Segall , Daniel Bristot de Oliveira , Dietmar Eggemann , Ingo Molnar , Juri Lelli , Peter Zijlstra , Steven Rostedt , Thomas Gleixner , Vincent Guittot , Sebastian Andrzej Siewior Subject: [PATCH v2 3/8] kernel/fork, IA64: Provide a alloc_thread_stack_node() for IA64. Date: Thu, 17 Feb 2022 11:24:01 +0100 Message-Id: <20220217102406.3697941-4-bigeasy@linutronix.de> In-Reply-To: <20220217102406.3697941-1-bigeasy@linutronix.de> References: <20220217102406.3697941-1-bigeasy@linutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Provide a generic alloc_thread_stack_node() for IA64/ CONFIG_ARCH_THREAD_STACK_ALLOCATOR which returns stack pointer and sets task_struct::stack so it behaves exactly like the other implementations. Rename IA64's alloc_thread_stack_node() and add the generic version to the fork code so it is in one place _and_ to drastically lower chances of fat fingering the IA64 code. Do the same for free_thread_stack(). Signed-off-by: Sebastian Andrzej Siewior --- arch/ia64/include/asm/thread_info.h | 6 +++--- kernel/fork.c | 17 +++++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/arch/ia64/include/asm/thread_info.h b/arch/ia64/include/asm/th= read_info.h index 51d20cb377062..1684716f08201 100644 --- a/arch/ia64/include/asm/thread_info.h +++ b/arch/ia64/include/asm/thread_info.h @@ -55,15 +55,15 @@ struct thread_info { #ifndef ASM_OFFSETS_C /* how to get the thread information struct from C */ #define current_thread_info() ((struct thread_info *) ((char *) current + = IA64_TASK_SIZE)) -#define alloc_thread_stack_node(tsk, node) \ +#define arch_alloc_thread_stack_node(tsk, node) \ ((unsigned long *) ((char *) (tsk) + IA64_TASK_SIZE)) #define task_thread_info(tsk) ((struct thread_info *) ((char *) (tsk) + IA= 64_TASK_SIZE)) #else #define current_thread_info() ((struct thread_info *) 0) -#define alloc_thread_stack_node(tsk, node) ((unsigned long *) 0) +#define arch_alloc_thread_stack_node(tsk, node) ((unsigned long *) 0) #define task_thread_info(tsk) ((struct thread_info *) 0) #endif -#define free_thread_stack(tsk) /* nothing */ +#define arch_free_thread_stack(tsk) /* nothing */ #define task_stack_page(tsk) ((void *)(tsk)) =20 #define __HAVE_THREAD_FUNCTIONS diff --git a/kernel/fork.c b/kernel/fork.c index c47dcba5d66d2..a6697215fe663 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -330,6 +330,23 @@ void thread_stack_cache_init(void) } =20 # endif /* THREAD_SIZE >=3D PAGE_SIZE || defined(CONFIG_VMAP_STACK) */ +#else /* CONFIG_ARCH_THREAD_STACK_ALLOCATOR */ + +static unsigned long *alloc_thread_stack_node(struct task_struct *tsk, int= node) +{ + unsigned long *stack; + + stack =3D arch_alloc_thread_stack_node(tsk, node); + tsk->stack =3D stack; + return stack; +} + +static void free_thread_stack(struct task_struct *tsk) +{ + arch_free_thread_stack(tsk); + tsk->stack =3D NULL; +} + #endif /* !CONFIG_ARCH_THREAD_STACK_ALLOCATOR */ =20 /* SLAB cache for signal_struct structures (tsk->signal) */ --=20 2.34.1