OrangePi_CM5/arch/x86/kernel
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
..
acpi This is the 5.10.133 stable release 2022-08-02 13:26:52 -07:00
apic x86: Fix return value of __setup handlers 2022-06-09 10:21:05 +02:00
cpu x86/smpboot: Move rcu_cpu_starting() earlier 2022-12-19 12:27:30 +01:00
fpu x86/fpu: Limit xstate copy size in xstateregs_set() 2021-07-20 16:05:52 +02:00
kprobes This is the 5.10.133 stable release 2022-08-02 13:26:52 -07:00
.gitignore .gitignore: add SPDX License Identifier 2020-03-25 11:50:48 +01:00
Makefile x86/sev: Add an x86 version of cc_platform_has() 2021-11-18 14:04:32 +01:00
alternative.c This is the 5.10.147 stable release 2022-10-05 18:33:23 +02:00
amd_gart_64.c dma-mapping: split <linux/dma-mapping.h> 2020-10-06 07:07:03 +02:00
amd_nb.c x86/amd_nb: Add AMD family 17h model 60h PCI IDs 2020-05-22 18:24:40 +02:00
apb_timer.c x86/apb_timer: Drop unused TSC calibration 2020-05-27 13:05:59 +02:00
aperture_64.c
…
apm_32.c
…
asm-offsets.c x86: remove address space overrides using set_fs() 2020-09-08 22:21:36 -04:00
asm-offsets_32.c x86 entry code updates: 2020-03-30 19:14:28 -07:00
asm-offsets_64.c x86/pv: Switch SWAPGS to ALTERNATIVE 2021-12-08 09:03:27 +01:00
audit_64.c x86/audit: Fix a -Wmissing-prototypes warning for ia32_classify_syscall() 2020-05-19 18:03:07 +02:00
bootflag.c
…
cc_platform.c x86/sev: Add an x86 version of cc_platform_has() 2021-11-18 14:04:32 +01:00
check.c
…
cpuid.c
…
crash.c x86/crash: Fix crash_setup_memmap_entries() out-of-bounds access 2021-04-28 13:40:02 +02:00
crash_core_32.c mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
crash_core_64.c mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
crash_dump_32.c
…
crash_dump_64.c
…
devicetree.c x86_ioapic_Consolidate_IOAPIC_allocation 2020-09-16 16:52:32 +02:00
doublefault_32.c x86/entry: Convert double fault exception to IDTENTRY_DF 2020-06-11 15:15:03 +02:00
dumpstack.c x86/dumpstack: Do not try to access user space code of other tasks 2020-11-18 12:56:29 +01:00
dumpstack_32.c x86/32: Remove CONFIG_DOUBLEFAULT 2020-04-14 14:24:05 +02:00
dumpstack_64.c x86/dumpstack/64: Add noinstr version of get_stack_info() 2020-09-09 11:33:19 +02:00
e820.c x86/boot: Fix memremap of setup_indirect structures 2022-03-16 14:16:02 +01:00
early-quirks.c x86/gpu: Reserve stolen memory for first integrated Intel GPU 2022-01-27 10:53:41 +01:00
early_printk.c mm: reorder includes after introduction of linux/pgtable.h 2020-06-09 09:39:13 -07:00
ebda.c
…
eisa.c
…
espfix_64.c mm: introduce include/linux/pgtable.h 2020-06-09 09:39:13 -07:00
ftrace.c x86/ftrace: Use alternative RET encoding 2022-09-20 12:38:33 +02:00
ftrace_32.S x86: Prepare asm files for straight-line-speculation 2022-07-25 11:26:28 +02:00
ftrace_64.S x86/ibt,ftrace: Make function-graph play nice 2022-09-20 12:38:33 +02:00
head32.c
…
head64.c x86: Clear .brk area at early boot 2022-07-21 21:20:17 +02:00
head_32.S x86/asm/32: Fix ANNOTATE_UNRET_SAFE use on 32-bit 2022-07-25 11:26:53 +02:00
head_64.S objtool: Add entry UNRET validation 2022-07-25 11:26:45 +02:00
hpet.c rtc: Check return value from mc146818_get_time() 2022-12-14 11:31:55 +01:00
hw_breakpoint.c x86/debug: Prevent data breakpoints on cpu_dr7 2021-02-10 09:29:22 +01:00
i8237.c
…
i8253.c
…
i8259.c x86/i8259: Use printk_deferred() to prevent deadlock 2020-07-29 16:27:16 +02:00
idt.c This feature enhances the current guest memory encryption support 2020-10-14 10:21:34 -07:00
ima_arch.c ima: force signature verification when CONFIG_KEXEC_SIG is configured 2022-07-21 21:20:11 +02:00
io_delay.c
…
ioport.c x86/ioperm: Prevent a memory leak when fork fails 2020-05-28 21:36:20 +02:00
irq.c x86/irq: Ensure PI wakeup handler is unregistered before module unload 2021-11-18 14:03:41 +01:00
irq_32.c x86/irq: Rework handle_irq() for 64-bit 2020-06-11 15:15:12 +02:00
irq_64.c x86/irq: Make run_on_irqstack_cond() typesafe 2020-09-22 22:13:34 +02:00
irq_work.c x86/entry: Convert various system vectors 2020-06-11 15:15:14 +02:00
irqflags.S x86: Prepare asm files for straight-line-speculation 2022-07-25 11:26:28 +02:00
irqinit.c x86/headers: Remove APIC headers from <asm/smp.h> 2020-08-06 16:13:09 +02:00
itmt.c sysctl: pass kernel pointers to ->proc_handler 2020-04-27 02:07:40 -04:00
jailhouse.c locking/seqlock, headers: Untangle the spaghetti monster 2020-08-06 16:13:13 +02:00
jump_label.c x86/jump_label: Move 'inline' keyword placement 2020-03-27 11:05:41 +01:00
kdebugfs.c x86/boot: Fix memremap of setup_indirect structures 2022-03-16 14:16:02 +01:00
kexec-bzimage64.c x86/kexec: Use up-to-dated screen_info copy to fill boot params 2020-10-14 17:05:03 +02:00
kgdb.c x86/debug: Change thread.debugreg6 to thread.virtual_dr6 2020-09-04 15:12:58 +02:00
ksysfs.c x86/boot: Fix memremap of setup_indirect structures 2022-03-16 14:16:02 +01:00
kvm.c x86, kvm: use proper ASM macros for kvm_vcpu_is_preempted 2022-07-25 11:26:52 +02:00
kvmclock.c x86/kvmclock: Move this_cpu_pvti into kvmclock.h 2021-10-06 15:55:48 +02:00
ldt.c x86/ldt: use "pr_info_once()" instead of open-coding it badly 2020-07-05 12:50:20 -07:00
machine_kexec_32.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
machine_kexec_64.c mm: don't include asm/pgtable.h if linux/mm.h is already included 2020-06-09 09:39:13 -07:00
mmconf-fam10h_64.c
…
module.c This is the 5.10.133 stable release 2022-08-02 13:26:52 -07:00
mpparse.c Surgery of the MSI interrupt handling to prepare the support of upcoming 2020-10-12 11:40:41 -07:00
msr.c x86/MSR: Filter MSR writes through X86_IOC_WRMSR_REGS ioctl too 2021-03-04 11:37:26 +01:00
nmi.c KVM/VMX: Invoke NMI non-IST entry instead of IST entry 2021-05-19 10:12:51 +02:00
nmi_selftest.c
…
paravirt-spinlocks.c
…
paravirt.c x86: Prepare inline-asm for straight-line-speculation 2022-07-25 11:26:29 +02:00
paravirt_patch.c x86/pv: Switch SWAPGS to ALTERNATIVE 2021-12-08 09:03:27 +01:00
pci-dma.c dma-mapping: move dma-debug.h to kernel/dma/ 2020-10-06 07:07:05 +02:00
pci-iommu_table.c
…
pci-swiotlb.c
…
pcspeaker.c
…
perf_regs.c perf/arch: Remove perf_sample_data::regs_user_copy 2020-11-09 18:12:34 +01:00
platform-quirks.c
…
pmem.c x86/pmem: Fix platform-device leak in error path 2022-08-21 15:15:33 +02:00
probe_roms.c maccess: make get_kernel_nofault() check for minimal type compatibility 2020-06-18 12:10:37 -07:00
process.c UPSTREAM: x86/process: setup io_threads more like normal user space threads 2023-02-07 13:38:14 +00:00
process.h
…
process_32.c x86/fpu: Correct pkru/xstate inconsistency 2022-03-02 11:42:47 +01:00
process_64.c x86/fpu: Correct pkru/xstate inconsistency 2022-03-02 11:42:47 +01:00
ptrace.c x86/debug: Change thread.debugreg6 to thread.virtual_dr6 2020-09-04 15:12:58 +02:00
pvclock.c
…
quirks.c x86, powerpc: Rename memcpy_mcsafe() to copy_mc_to_{user, kernel}() 2020-10-06 11:18:04 +02:00
reboot.c x86/mm: Flush global TLB when switching to trampoline page-table 2022-01-27 10:54:14 +01:00
reboot_fixups_32.c
…
relocate_kernel_32.S x86/kexec: Disable RET on kexec 2022-07-25 11:26:51 +02:00
relocate_kernel_64.S x86/kexec: Disable RET on kexec 2022-07-25 11:26:51 +02:00
resource.c
…
rtc.c
…
setup.c x86/boot: Fix memremap of setup_indirect structures 2022-03-16 14:16:02 +01:00
setup_percpu.c x86/mm: remove vmalloc faulting 2020-06-02 10:59:12 -07:00
sev-es-shared.c x86/sev: Return an error on a returned non-zero SW_EXITINFO1[31:0] 2021-10-13 10:04:30 +02:00
sev-es.c x86/insn: Rename insn_decode() to insn_decode_from_regs() 2022-07-25 11:26:10 +02:00
sev_verify_cbit.S x86: Prepare asm files for straight-line-speculation 2022-07-25 11:26:28 +02:00
signal.c UPSTREAM: entry: Add support for TIF_NOTIFY_SIGNAL 2023-02-07 13:38:09 +00:00
signal_compat.c UPSTREAM: signal: clear non-uapi flag bits when passing/returning sa_flags 2021-01-22 10:05:52 -08:00
smp.c x86/entry: Convert reschedule interrupt to IDTENTRY_SYSVEC_SIMPLE 2020-06-11 15:15:16 +02:00
smpboot.c x86/smpboot: Move rcu_cpu_starting() earlier 2022-12-19 12:27:30 +01:00
stacktrace.c stacktrace: Remove reliable argument from arch_stack_walk() callback 2020-09-18 14:24:16 +01:00
static_call.c x86/static_call: Serialize __static_call_fixup() properly 2022-07-25 11:26:51 +02:00
step.c ptrace: Reimplement PTRACE_KILL by always sending SIGKILL 2022-06-09 10:20:49 +02:00
sys_ia32.c x86: switch to kernel_clone() 2020-08-20 13:12:58 +02:00
sys_x86_64.c x86/mm: Cleanup the control_va_addr_alignment() __setup handler 2022-06-09 10:21:06 +02:00
sysfb.c
…
sysfb_efi.c
…
sysfb_simplefb.c
…
tboot.c mm/gup: prevent gup_fast from racing with COW during fork 2020-12-30 11:53:54 +01:00
time.c A set of fixes and updates for x86: 2020-06-11 15:54:31 -07:00
tls.c x86: switch to ->regset_get() 2020-07-27 14:31:07 -04:00
tls.h x86: switch to ->regset_get() 2020-07-27 14:31:07 -04:00
topology.c x86/headers: Remove APIC headers from <asm/smp.h> 2020-08-06 16:13:09 +02:00
trace_clock.c
…
tracepoint.c x86/entry: Convert reschedule interrupt to IDTENTRY_SYSVEC_SIMPLE 2020-06-11 15:15:16 +02:00
traps.c x86/traps: Mark do_int3() NOKPROBE_SYMBOL 2022-03-16 14:16:03 +01:00
tsc.c Revert "clocksource: Reduce clocksource-skew threshold" 2022-02-01 10:11:25 +01:00
tsc_msr.c Misc fixes and small updates all around the place: 2020-08-15 10:38:03 -07:00
tsc_sync.c x86/tsc: Add a timer to make sure TSC_adjust is always checked 2021-12-08 09:03:28 +01:00
umip.c x86/insn: Rename insn_decode() to insn_decode_from_regs() 2022-07-25 11:26:10 +02:00
unwind_frame.c fork-v5.9 2020-08-04 14:47:45 -07:00
unwind_guess.c
…
unwind_orc.c x86/unwind/orc: Fix unreliable stack dump with gcov 2022-11-03 23:57:51 +09:00
uprobes.c x86/uprobes: Do not use prefixes.nbytes when looping over prefixes.bytes 2020-12-06 09:58:13 +01:00
verify_cpu.S x86: Prepare asm files for straight-line-speculation 2022-07-25 11:26:28 +02:00
vm86_32.c mmap locking API: use coccinelle to convert mmap_sem rwsem call sites 2020-06-09 09:39:14 -07:00
vmlinux.lds.S This is the 5.10.133 stable release 2022-08-02 13:26:52 -07:00
vsmp_64.c
…
x86_init.c x86/irq: Cleanup the arch_*_msi_irqs() leftovers 2020-09-16 16:52:38 +02:00