All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Brauner <christian.brauner@ubuntu.com>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Christian Brauner <christian.brauner@ubuntu.com>,
	Rich Felker <dalias@libc.org>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	linux-sh@vger.kernel.org
Subject: [PATCH 14/17] sh: switch to copy_thread_tls()
Date: Mon, 22 Jun 2020 23:43:23 +0000	[thread overview]
Message-ID: <20200622234326.906346-15-christian.brauner@ubuntu.com> (raw)
In-Reply-To: <20200622234326.906346-1-christian.brauner@ubuntu.com>

Use the copy_thread_tls() calling convention which passes tls through a
register. This is required so we can remove the copy_thread{_tls}() split
and remove the HAVE_COPY_THREAD_TLS macro.

Cc: Rich Felker <dalias@libc.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: linux-sh@vger.kernel.org
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
---
 arch/sh/Kconfig             | 1 +
 arch/sh/kernel/process_32.c | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 9fc2b010e938..e10118d61ce7 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -70,6 +70,7 @@ config SUPERH
 	select ARCH_HIBERNATION_POSSIBLE if MMU
 	select SPARSE_IRQ
 	select HAVE_STACKPROTECTOR
+	select HAVE_COPY_THREAD_TLS
 	help
 	  The SuperH is a RISC processor targeted for use in embedded systems
 	  and consumer electronics; it was also used in the Sega Dreamcast
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c
index 456cc8d171f7..537a82d80616 100644
--- a/arch/sh/kernel/process_32.c
+++ b/arch/sh/kernel/process_32.c
@@ -115,8 +115,8 @@ EXPORT_SYMBOL(dump_fpu);
 asmlinkage void ret_from_fork(void);
 asmlinkage void ret_from_kernel_thread(void);
 
-int copy_thread(unsigned long clone_flags, unsigned long usp,
-		unsigned long arg, struct task_struct *p)
+int copy_thread_tls(unsigned long clone_flags, unsigned long usp,
+		    unsigned long arg, struct task_struct *p, unsigned long tls)
 {
 	struct thread_info *ti = task_thread_info(p);
 	struct pt_regs *childregs;
@@ -158,7 +158,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
 	ti->addr_limit = USER_DS;
 
 	if (clone_flags & CLONE_SETTLS)
-		childregs->gbr = childregs->regs[0];
+		childregs->gbr = tls;
 
 	childregs->regs[0] = 0; /* Set return value for child */
 	p->thread.pc = (unsigned long) ret_from_fork;
-- 
2.27.0

WARNING: multiple messages have this Message-ID (diff)
From: Christian Brauner <christian.brauner@ubuntu.com>
To: linux-kernel@vger.kernel.org
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	Christian Brauner <christian.brauner@ubuntu.com>,
	Rich Felker <dalias@libc.org>,
	Yoshinori Sato <ysato@users.sourceforge.jp>,
	linux-sh@vger.kernel.org
Subject: [PATCH 14/17] sh: switch to copy_thread_tls()
Date: Tue, 23 Jun 2020 01:43:23 +0200	[thread overview]
Message-ID: <20200622234326.906346-15-christian.brauner@ubuntu.com> (raw)
In-Reply-To: <20200622234326.906346-1-christian.brauner@ubuntu.com>

Use the copy_thread_tls() calling convention which passes tls through a
register. This is required so we can remove the copy_thread{_tls}() split
and remove the HAVE_COPY_THREAD_TLS macro.

Cc: Rich Felker <dalias@libc.org>
Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
Cc: linux-sh@vger.kernel.org
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
---
 arch/sh/Kconfig             | 1 +
 arch/sh/kernel/process_32.c | 6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 9fc2b010e938..e10118d61ce7 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -70,6 +70,7 @@ config SUPERH
 	select ARCH_HIBERNATION_POSSIBLE if MMU
 	select SPARSE_IRQ
 	select HAVE_STACKPROTECTOR
+	select HAVE_COPY_THREAD_TLS
 	help
 	  The SuperH is a RISC processor targeted for use in embedded systems
 	  and consumer electronics; it was also used in the Sega Dreamcast
diff --git a/arch/sh/kernel/process_32.c b/arch/sh/kernel/process_32.c
index 456cc8d171f7..537a82d80616 100644
--- a/arch/sh/kernel/process_32.c
+++ b/arch/sh/kernel/process_32.c
@@ -115,8 +115,8 @@ EXPORT_SYMBOL(dump_fpu);
 asmlinkage void ret_from_fork(void);
 asmlinkage void ret_from_kernel_thread(void);
 
-int copy_thread(unsigned long clone_flags, unsigned long usp,
-		unsigned long arg, struct task_struct *p)
+int copy_thread_tls(unsigned long clone_flags, unsigned long usp,
+		    unsigned long arg, struct task_struct *p, unsigned long tls)
 {
 	struct thread_info *ti = task_thread_info(p);
 	struct pt_regs *childregs;
@@ -158,7 +158,7 @@ int copy_thread(unsigned long clone_flags, unsigned long usp,
 	ti->addr_limit = USER_DS;
 
 	if (clone_flags & CLONE_SETTLS)
-		childregs->gbr = childregs->regs[0];
+		childregs->gbr = tls;
 
 	childregs->regs[0] = 0; /* Set return value for child */
 	p->thread.pc = (unsigned long) ret_from_fork;
-- 
2.27.0


  parent reply	other threads:[~2020-06-22 23:43 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-22 23:43 [PATCH 00/17] arch: remove do_fork() and HAVE_COPY_THREAD_TLS Christian Brauner
2020-06-22 23:43 ` [PATCH 01/17] fork: fold legacy_clone_args_valid() into _do_fork() Christian Brauner
2020-06-27  8:27   ` [fork] 11689456e6: ltp.clone302.fail kernel test robot
2020-06-27 12:23     ` Christian Brauner
2020-06-22 23:43 ` [PATCH 02/17] sparc64: enable HAVE_COPY_THREAD_TLS Christian Brauner
2020-06-22 23:43   ` Christian Brauner
2020-06-23  3:35   ` David Miller
2020-06-23  3:35     ` David Miller
2020-06-23  8:42     ` Christian Brauner
2020-06-23  8:42       ` Christian Brauner
2020-06-22 23:43 ` [PATCH 03/17] sparc: share process creation helpers between sparc and sparc64 Christian Brauner
2020-06-22 23:43   ` Christian Brauner
2020-06-22 23:43 ` [PATCH 04/17] sparc: unconditionally enable HAVE_COPY_THREAD_TLS Christian Brauner
2020-06-22 23:43   ` Christian Brauner
2020-06-22 23:43 ` [PATCH 05/17] ia64: enable HAVE_COPY_THREAD_TLS, switch to kernel_clone_args Christian Brauner
2020-06-22 23:43   ` Christian Brauner
2020-06-22 23:43 ` [PATCH 06/17] nios2: " Christian Brauner
2020-06-22 23:43 ` [PATCH 07/17] h8300: select " Christian Brauner
2020-06-22 23:43 ` [PATCH 08/17] fork: remove do_fork() Christian Brauner
2020-06-22 23:43 ` [PATCH 09/17] alpha: switch to copy_thread_tls() Christian Brauner
2020-06-22 23:43 ` [PATCH 10/17] c6x: " Christian Brauner
2020-06-22 23:43 ` [PATCH 11/17] hexagon: " Christian Brauner
2020-06-23 16:11   ` Brian Cain
2020-06-23 16:11     ` Brian Cain
2020-06-22 23:43 ` [PATCH 12/17] microblaze: " Christian Brauner
2020-06-22 23:43 ` [PATCH 13/17] nds32: " Christian Brauner
2020-06-22 23:43 ` Christian Brauner [this message]
2020-06-22 23:43   ` [PATCH 14/17] sh: " Christian Brauner
2020-06-22 23:43 ` [PATCH 15/17] unicore: " Christian Brauner
2020-06-22 23:43 ` [PATCH 16/17] arch: remove HAVE_COPY_THREAD_TLS Christian Brauner
2020-06-22 23:43   ` Christian Brauner
2020-06-22 23:43   ` Christian Brauner
2020-06-22 23:43   ` [OpenRISC] " Christian Brauner
2020-06-23  0:44   ` Kees Cook
2020-06-23  0:44     ` Kees Cook
2020-06-23  0:44     ` Kees Cook
2020-06-23  0:44     ` [OpenRISC] " Kees Cook
2020-06-23  7:37   ` Geert Uytterhoeven
2020-06-23  7:37     ` Geert Uytterhoeven
2020-06-23  7:37     ` Geert Uytterhoeven
2020-06-23  7:37     ` [OpenRISC] " Geert Uytterhoeven
2020-06-25  8:25   ` Thomas Bogendoerfer
2020-06-25  8:25     ` Thomas Bogendoerfer
2020-06-25  8:25     ` Thomas Bogendoerfer
2020-06-25  8:25     ` [OpenRISC] " Thomas Bogendoerfer
2020-06-25  8:25     ` Thomas Bogendoerfer
2020-06-25  8:25     ` Thomas Bogendoerfer
2020-06-27  3:06   ` Greentime Hu
2020-06-27  3:06     ` Greentime Hu
2020-06-27  3:06     ` Greentime Hu
2020-06-27  3:06     ` [OpenRISC] " Greentime Hu
2020-06-27  3:06     ` Greentime Hu
2020-06-27  3:06     ` Greentime Hu
2020-06-22 23:43 ` [PATCH 17/17] arch: rename copy_thread_tls() back to copy_thread() Christian Brauner
2020-06-22 23:43   ` Christian Brauner
2020-06-22 23:43   ` Christian Brauner
2020-06-22 23:43   ` [OpenRISC] " Christian Brauner
2020-06-23  0:46   ` Kees Cook
2020-06-23  0:46     ` Kees Cook
2020-06-23  0:46     ` Kees Cook
2020-06-23  0:46     ` [OpenRISC] " Kees Cook
2020-06-23  7:38   ` Geert Uytterhoeven
2020-06-23  7:38     ` Geert Uytterhoeven
2020-06-23  7:38     ` Geert Uytterhoeven
2020-06-23  7:38     ` [OpenRISC] " Geert Uytterhoeven
2020-06-25  8:26   ` Thomas Bogendoerfer
2020-06-25  8:26     ` Thomas Bogendoerfer
2020-06-25  8:26     ` Thomas Bogendoerfer
2020-06-25  8:26     ` [OpenRISC] " Thomas Bogendoerfer
2020-06-25  8:26     ` Thomas Bogendoerfer
2020-06-25  8:26     ` Thomas Bogendoerfer
2020-06-25 21:17   ` Stafford Horne
2020-06-25 21:17     ` Stafford Horne
2020-06-25 21:17     ` Stafford Horne
2020-06-25 21:17     ` [OpenRISC] " Stafford Horne
2020-06-25 21:17     ` Stafford Horne
2020-06-25 21:17     ` Stafford Horne
2020-07-04 16:10     ` Christian Brauner
2020-07-04 16:11       ` [OpenRISC] " Christian Brauner
2020-07-04 16:10       ` Christian Brauner
2020-07-04 16:10       ` Christian Brauner
2020-07-04 16:10       ` Christian Brauner
2020-07-04 16:10       ` Christian Brauner
2020-06-27  3:10   ` Greentime Hu
2020-06-27  3:10     ` Greentime Hu
2020-06-27  3:10     ` Greentime Hu
2020-06-27  3:10     ` [OpenRISC] " Greentime Hu
2020-06-27  3:10     ` Greentime Hu
2020-06-27  3:10     ` Greentime Hu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200622234326.906346-15-christian.brauner@ubuntu.com \
    --to=christian.brauner@ubuntu.com \
    --cc=dalias@libc.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=torvalds@linux-foundation.org \
    --cc=ysato@users.sourceforge.jp \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.