mbox series

[v2,0/8] powerpc: copy_thread cleanups

Message ID 20230325122904.2375060-1-npiggin@gmail.com (mailing list archive)
Headers show
Series powerpc: copy_thread cleanups | expand

Message

Nicholas Piggin March 25, 2023, 12:28 p.m. UTC
This series cleans up copy_thread and hopefully makes the code
easier to understand. The big changes in patch 3 and 4 which use
the switch stack instead of user int stack for restoring
fn and args parameters for the new thread.

I don't think there's any bugs fixed here because in the case of
a kernel-user thread, kthread_exec would re-populate the user int
frame with regs, so that should be okay.

Since v1, I only rejiged some changes between patches and minor
cosmetic improvements but no functional change. Tested with
32e/s 64e/s BE and LE.

Thanks,
Nick

Nicholas Piggin (8):
  powerpc: copy_thread remove unused pkey code
  powerpc: copy_thread make ret_from_fork register setup consistent
  powerpc: use switch frame for ret_from_kernel_thread parameters
  powerpc/64: ret_from_fork avoid restoring regs twice
  powerpc: copy_thread differentiate kthreads and user mode threads
  powerpc: differentiate kthread from user kernel thread start
  powerpc: copy_thread don't set _TIF_RESTOREALL
  powerpc: copy_thread don't set PPR in user interrupt frame regs

 arch/powerpc/include/asm/thread_info.h |   2 +
 arch/powerpc/kernel/entry_32.S         |  23 ++++-
 arch/powerpc/kernel/interrupt_64.S     |  28 +++++-
 arch/powerpc/kernel/process.c          | 124 ++++++++++++++-----------
 4 files changed, 113 insertions(+), 64 deletions(-)

Comments

Michael Ellerman April 26, 2023, 12:01 p.m. UTC | #1
On Sat, 25 Mar 2023 22:28:56 +1000, Nicholas Piggin wrote:
> This series cleans up copy_thread and hopefully makes the code
> easier to understand. The big changes in patch 3 and 4 which use
> the switch stack instead of user int stack for restoring
> fn and args parameters for the new thread.
> 
> I don't think there's any bugs fixed here because in the case of
> a kernel-user thread, kthread_exec would re-populate the user int
> frame with regs, so that should be okay.
> 
> [...]

Applied to powerpc/next.

[1/8] powerpc: copy_thread remove unused pkey code
      https://git.kernel.org/powerpc/c/c013e9f2bbe1d2be5e1c7f4a84216cd10837f20d
[2/8] powerpc: copy_thread make ret_from_fork register setup consistent
      https://git.kernel.org/powerpc/c/959791e45fd2a580403e03611a5aefb9e7abcfc0
[3/8] powerpc: use switch frame for ret_from_kernel_thread parameters
      https://git.kernel.org/powerpc/c/af5ca9d5c8b45244b237d7a5534e1ec2d01cce8e
[4/8] powerpc/64: ret_from_fork avoid restoring regs twice
      https://git.kernel.org/powerpc/c/5088a6246bd3dcfea504376f356683f750136f7f
[5/8] powerpc: copy_thread differentiate kthreads and user mode threads
      https://git.kernel.org/powerpc/c/eed7c420aac7fde5e5915d2747c3ebbbda225835
[6/8] powerpc: differentiate kthread from user kernel thread start
      https://git.kernel.org/powerpc/c/b504b6aade0403eaffa9ce51b8207d710705beaf
[7/8] powerpc: copy_thread don't set _TIF_RESTOREALL
      https://git.kernel.org/powerpc/c/d195ce4695ca1061993424e2d6c8995e5fc81606
[8/8] powerpc: copy_thread don't set PPR in user interrupt frame regs
      https://git.kernel.org/powerpc/c/89fb39134ae3b1e1f207af44a037721d92b32f70

cheers