OpenCloudOS-Kernel/arch
Stefan Metzmacher 50b7b6f29d x86/process: setup io_threads more like normal user space threads
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: 4727dc20e0 ("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
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>
2021-05-05 17:47:41 -06:00
..
alpha quota: wire up quotactl_path 2021-03-17 15:51:17 +01:00
arc ARC: treewide: avoid the pointer addition with NULL pointer 2021-03-22 10:05:43 -07:00
arm \n 2021-04-29 10:51:29 -07:00
arm64 \n 2021-04-29 10:51:29 -07:00
csky csky: change a Kconfig symbol name to fix e1000 build error 2021-04-16 16:10:36 -07:00
h8300
hexagon io_uring-worker.v3-2021-02-25 2021-02-27 08:29:02 -08:00
ia64 \n 2021-04-29 10:51:29 -07:00
m68k \n 2021-04-29 10:51:29 -07:00
microblaze Microblaze patches for 5.13-rc1 2021-04-29 11:36:47 -07:00
mips - removed get_fs/set_fs 2021-04-29 11:28:08 -07:00
nds32 nds32: flush_dcache_page: use page_mapping_file to avoid races with swapoff 2021-04-09 14:54:23 -07:00
nios2 io_uring-worker.v3-2021-02-25 2021-02-27 08:29:02 -08:00
openrisc io_uring-worker.v3-2021-02-25 2021-02-27 08:29:02 -08:00
parisc \n 2021-04-29 10:51:29 -07:00
powerpc \n 2021-04-29 10:51:29 -07:00
riscv riscv: keep interrupts disabled for BREAKPOINT exception 2021-04-15 21:32:40 -07:00
s390 \n 2021-04-29 10:51:29 -07:00
sh quota: wire up quotactl_path 2021-03-17 15:51:17 +01:00
sparc \n 2021-04-29 10:51:29 -07:00
um printk changes for 5.13 2021-04-27 18:09:44 -07:00
x86 x86/process: setup io_threads more like normal user space threads 2021-05-05 17:47:41 -06:00
xtensa \n 2021-04-29 10:51:29 -07:00
.gitignore
Kconfig CFI on arm64 series for v5.13-rc1 2021-04-27 10:16:46 -07:00