OrangePi_CM5/arch/x86
Stefan Metzmacher bcb749b0b1 UPSTREAM: x86/process: setup io_threads more like normal user space threads
[ Upstream commit 50b7b6f29de3e18e9d6c09641256a0296361cfee ]

As io_threads are fully set up USER threads it's clearer to separate the
code path from the KTHREAD logic.

The only remaining difference to user space threads is that io_threads
never return to user space again. Instead they loop within the given
worker function.

The fact that they never return to user space means they don't have an
user space thread stack. In order to indicate that to tools like gdb we
reset the stack and instruction pointers to 0.

This allows gdb attach to user space processes using io-uring, which like
means that they have io_threads, without printing worrying message like
this:

  warning: Selected architecture i386:x86-64 is not compatible with reported target architecture i386

  warning: Architecture rejected target-supplied description

The output will be something like this:

  (gdb) info threads
    Id   Target Id                  Frame
  * 1    LWP 4863 "io_uring-cp-for" syscall () at ../sysdeps/unix/sysv/linux/x86_64/syscall.S:38
    2    LWP 4864 "iou-mgr-4863"    0x0000000000000000 in ?? ()
    3    LWP 4865 "iou-wrk-4863"    0x0000000000000000 in ?? ()
  (gdb) thread 3
  [Switching to thread 3 (LWP 4865)]
  #0  0x0000000000000000 in ?? ()
  (gdb) bt
  #0  0x0000000000000000 in ?? ()
  Backtrace stopped: Cannot access memory at address 0x0

Fixes: 4727dc20e042 ("arch: setup PF_IO_WORKER threads like PF_KTHREAD")
Link: https://lore.kernel.org/io-uring/044d0bad-6888-a211-e1d3-159a4aeed52d@polymtl.ca/T/#m1bbf5727e3d4e839603f6ec7ed79c7eebfba6267
Change-Id: I83793e9a4fbc5f9024c9aeace0640043c81a93b0
Signed-off-by: Stefan Metzmacher <metze@samba.org>
cc: Linus Torvalds <torvalds@linux-foundation.org>
cc: Jens Axboe <axboe@kernel.dk>
cc: Andy Lutomirski <luto@kernel.org>
cc: linux-kernel@vger.kernel.org
cc: io-uring@vger.kernel.org
cc: x86@kernel.org
Link: https://lore.kernel.org/r/20210505110310.237537-1-metze@samba.org
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit f0a5f0dc0131c6483908601f6e4907befb609c97)
Bug: 268174392
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
2023-02-07 13:38:14 +00:00
..
boot This is the 5.10.137 stable release 2022-08-29 16:53:14 +02:00
configs Merge tag 'android12-5.10.160_r00' into android12-5.10 2023-01-21 12:06:54 +00:00
crypto crypto: x86/poly1305 - Fixup SLS 2022-07-25 11:26:32 +02:00
entry This is the 5.10.137 stable release 2022-08-29 16:53:14 +02:00
events perf/x86/intel/pt: Fix sampling using single range output 2022-11-25 17:45:54 +01:00
hyperv x86/hyperv: Fix NULL deref in set_hv_tscchange_cb() if Hyper-V setup fails 2021-11-26 10:39:19 +01:00
ia32
include UPSTREAM: x86: Wire up TIF_NOTIFY_SIGNAL 2023-02-07 13:38:10 +00:00
kernel UPSTREAM: x86/process: setup io_threads more like normal user space threads 2023-02-07 13:38:14 +00:00
kvm KVM: x86: remove exit_int_info warning in svm_handle_exit 2022-12-02 17:40:04 +01:00
lib x86/retbleed: Add fine grained Kconfig knobs 2022-07-25 11:26:50 +02:00
math-emu x86: Prepare asm files for straight-line-speculation 2022-07-25 11:26:28 +02:00
mm This is the 5.10.157 stable release 2022-12-04 12:51:21 +00:00
net This is the 5.10.133 stable release 2022-08-02 13:26:52 -07:00
oprofile
pci This is the 5.10.114 stable release 2022-05-12 17:48:27 +02:00
platform x86/olpc: fix 'logical not is only applied to the left hand side' 2022-08-21 15:16:14 +02:00
power This is the 5.10.158 stable release 2022-12-08 16:39:44 +00:00
purgatory
ras
realmode x86/mm: Flush global TLB when switching to trampoline page-table 2022-01-27 10:54:14 +01:00
tools This is the 5.10.60 stable release 2021-08-27 17:14:51 +02:00
um arch: um: Mark the stack non-executable to fix a binutils warning 2022-10-15 07:55:53 +02:00
video
xen x86/entry: Work around Clang __bdos() bug 2022-10-26 13:25:45 +02:00
.gitignore
Kbuild
Kconfig This is the 5.10.152 stable release 2022-11-21 15:46:22 +00:00
Kconfig.assembler
Kconfig.cpu
Kconfig.debug
Makefile This is the 5.10.133 stable release 2022-08-02 13:26:52 -07:00
Makefile.um
Makefile_32.cpu