Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1608545ybf; Sun, 1 Mar 2020 13:39:30 -0800 (PST) X-Google-Smtp-Source: APXvYqwmjlm/mg7R6tOlRAT3K+IfICExVl9jMUCANUEtZ6vsWMjnuKeRULRL2kPce5ynv8vKOjPS X-Received: by 2002:a05:6830:22d8:: with SMTP id q24mr11495608otc.0.1583098770179; Sun, 01 Mar 2020 13:39:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583098770; cv=none; d=google.com; s=arc-20160816; b=SRTqUPfljSIWNs9cI3tMHi3zQ2WG4TZ6jU2sMA8npqzdGAhYss4spxbxaCCgeAlpLT sfv3Gn67aRUBOGPzGlZ0AXvXm1PjZVB9sCYvbhG9kNdhdCx3yPQpUuosCZ+mqg8PiGHk 3t4CzRTcfsqAfB4PaLpSs8BYT2K9oYUusOGrawk0hi/3WJeoSp9IsVrYS/Ss8j7SLxNe HshiSAqSoP6DZMwy6eoBBcpdLvjUfKz6fkRAmJMEeKY05EBaCqGkQKtBBvf6C79cwKu0 adTRzsGY1lPcxz90JDFbVuhLFWFF49eP/zoeZugT/Wm5/fgHgHvnn8+H3fhoGR8xlDfH DLLw== 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=f3Ble6iA1rj1SewO8T/W6hk1dFYEXHz8p6afe2PQVOE=; b=jaAlyciwijiTag4HtF9wnCmTNyQIp8e9bjCzTOh/zqoxQG8rErdjmwmKcnvqp/K/lm SSstSEvlj4XIMq46iDDairRForjO+5vuR+6V35MD/3xN2D5OGD9yIK/JrtWznAAfK6+K yfjLrEh+5e03JaV6qa1BRpE/PatmPpfhyC+FxszWDaIklbShDQbS/2NAll/QvUDQ77zW lMnvD8uH8BhuztxXSitu1n+GQ7n7OkpuMimXAIwmuOHB1SYsSLYW42O5yKj7W7QhoCGI M6ZovrHR7/sMy9pp9Dzh0yALOII1lLfoy5mSOKZeiwIYhxyVgx5we8G6UGVelucXwyBt +dMg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Baez6k8S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9si5725219oti.44.2020.03.01.13.39.18; Sun, 01 Mar 2020 13:39:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Baez6k8S; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726673AbgCAVjH (ORCPT + 99 others); Sun, 1 Mar 2020 16:39:07 -0500 Received: from mail-pj1-f65.google.com ([209.85.216.65]:50740 "EHLO mail-pj1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726050AbgCAVjG (ORCPT ); Sun, 1 Mar 2020 16:39:06 -0500 Received: by mail-pj1-f65.google.com with SMTP id nm14so802913pjb.0 for ; Sun, 01 Mar 2020 13:39:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f3Ble6iA1rj1SewO8T/W6hk1dFYEXHz8p6afe2PQVOE=; b=Baez6k8SMiky2op1OrkEDatdJ9BJ67VWqxNDvvyam6izr4oVEPVeweJobVzNKt9vFV NRsm2mbD0VbFq/6HHKD4HBjezKw5v2P7jeLaXvxzeKq5gilbjSNsbVieTSdaufgMKUyx 8eysv542D7sS+p0HdXc1okTh6NsxnnqWzXtD6JGokHEAOaI9skC+kq1roejWDOti7Bd6 qYJJj416nolw6ELpxw08iwZa0SVh8zyDPh2a2glGp1fn8AVgmuTfD/NEKFmPNlOzCVCW W/HHXQmQxuUNR9KcW8RYzFZgoPPFAU3jQAMji0ZcnbnLGtW/K6FBk2zHKRxNtQR9Aokm no4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=f3Ble6iA1rj1SewO8T/W6hk1dFYEXHz8p6afe2PQVOE=; b=ALrzrWNN6u9YatXOwcuSWFlE2iIqGYfgL4C2wuaxOLJlq1qZosaEo/BscANKc/1n3/ Mq0JaVSHWOUPchHknLXrnU8NJ6xN2+iM2GoMcsULarr0UbZwt1Cal4jBcHUxzCPl9VeA fpVTymy2wVkebIi5dfmr3qQ9jr0Z99nbOn7fCwypJXgAp73zp6fiGOqBvQJXKmbYzEIQ 5AT9019u14GwoZfqtwbfKz24Wbg92QXOqHZT09UjnJJTD/LSZsuWACGvXJpsNg+CAGaP AKIbBBRtkACjk97eQwbTvyK7WzIsbBo/idck0/I8M+vZ1yJf5ujN7lwOLUM+ybg+nxEq BXvw== X-Gm-Message-State: APjAAAXJguGm9SMZt8KxuBVCZER6cKuX9gJkVUOY3M5NUTDk3NRi7FHC SQfZc3DohRsiLIWinFAoWytWKtIr X-Received: by 2002:a17:902:b611:: with SMTP id b17mr14793523pls.23.1583098745201; Sun, 01 Mar 2020 13:39:05 -0800 (PST) Received: from localhost (g183.222-224-185.ppp.wakwak.ne.jp. [222.224.185.183]) by smtp.gmail.com with ESMTPSA id b18sm18628378pfd.63.2020.03.01.13.39.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 01 Mar 2020 13:39:04 -0800 (PST) From: Stafford Horne To: LKML Cc: Openrisc , Stafford Horne , Jonas Bonn , Stefan Kristiansson , Christian Brauner , Greg Kroah-Hartman , Allison Randal , Thomas Gleixner Subject: [PATCH v2 1/3] openrisc: Convert copy_thread to copy_thread_tls Date: Mon, 2 Mar 2020 06:38:49 +0900 Message-Id: <20200301213851.8096-2-shorne@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20200301213851.8096-1-shorne@gmail.com> References: <20200301213851.8096-1-shorne@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is required for clone3 which passes the TLS value through a struct rather than a register. Signed-off-by: Stafford Horne --- arch/openrisc/Kconfig | 1 + arch/openrisc/kernel/process.c | 17 ++++++----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig index 1928e061ff96..5debdbe6fc35 100644 --- a/arch/openrisc/Kconfig +++ b/arch/openrisc/Kconfig @@ -14,6 +14,7 @@ config OPENRISC select HANDLE_DOMAIN_IRQ select GPIOLIB select HAVE_ARCH_TRACEHOOK + select HAVE_COPY_THREAD_TLS select SPARSE_IRQ select GENERIC_IRQ_CHIP select GENERIC_IRQ_PROBE diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c index b06f84f6676f..5caa47f7de4f 100644 --- a/arch/openrisc/kernel/process.c +++ b/arch/openrisc/kernel/process.c @@ -117,12 +117,13 @@ void release_thread(struct task_struct *dead_task) extern asmlinkage void ret_from_fork(void); /* - * copy_thread + * copy_thread_tls * @clone_flags: flags * @usp: user stack pointer or fn for kernel thread * @arg: arg to fn for kernel thread; always NULL for userspace thread * @p: the newly created task * @regs: CPU context to copy for userspace thread; always NULL for kthread + * @tls: the Thread Local Storage pointer for the new process * * At the top of a newly initialized kernel stack are two stacked pt_reg * structures. The first (topmost) is the userspace context of the thread. @@ -148,8 +149,8 @@ extern asmlinkage void ret_from_fork(void); */ int -copy_thread(unsigned long clone_flags, unsigned long usp, - unsigned long arg, struct task_struct *p) +copy_thread_tls(unsigned long clone_flags, unsigned long usp, + unsigned long arg, struct task_struct *p, unsigned long tls) { struct pt_regs *userregs; struct pt_regs *kregs; @@ -179,16 +180,10 @@ copy_thread(unsigned long clone_flags, unsigned long usp, userregs->sp = usp; /* - * For CLONE_SETTLS set "tp" (r10) to the TLS pointer passed to sys_clone. - * - * The kernel entry is: - * int clone (long flags, void *child_stack, int *parent_tid, - * int *child_tid, struct void *tls) - * - * This makes the source r7 in the kernel registers. + * For CLONE_SETTLS set "tp" (r10) to the TLS pointer. */ if (clone_flags & CLONE_SETTLS) - userregs->gpr[10] = userregs->gpr[7]; + userregs->gpr[10] = tls; userregs->gpr[11] = 0; /* Result from fork() */ -- 2.21.0