original_kernel/arch/x86/include/asm
Mike Christie f9010dbdce fork, vhost: Use CLONE_THREAD to fix freezer/ps regression
When switching from kthreads to vhost_tasks two bugs were added:
1. The vhost worker tasks's now show up as processes so scripts doing
ps or ps a would not incorrectly detect the vhost task as another
process.  2. kthreads disabled freeze by setting PF_NOFREEZE, but
vhost tasks's didn't disable or add support for them.

To fix both bugs, this switches the vhost task to be thread in the
process that does the VHOST_SET_OWNER ioctl, and has vhost_worker call
get_signal to support SIGKILL/SIGSTOP and freeze signals. Note that
SIGKILL/STOP support is required because CLONE_THREAD requires
CLONE_SIGHAND which requires those 2 signals to be supported.

This is a modified version of the patch written by Mike Christie
<michael.christie@oracle.com> which was a modified version of patch
originally written by Linus.

Much of what depended upon PF_IO_WORKER now depends on PF_USER_WORKER.
Including ignoring signals, setting up the register state, and having
get_signal return instead of calling do_group_exit.

Tidied up the vhost_task abstraction so that the definition of
vhost_task only needs to be visible inside of vhost_task.c.  Making
it easier to review the code and tell what needs to be done where.
As part of this the main loop has been moved from vhost_worker into
vhost_task_fn.  vhost_worker now returns true if work was done.

The main loop has been updated to call get_signal which handles
SIGSTOP, freezing, and collects the message that tells the thread to
exit as part of process exit.  This collection clears
__fatal_signal_pending.  This collection is not guaranteed to
clear signal_pending() so clear that explicitly so the schedule()
sleeps.

For now the vhost thread continues to exist and run work until the
last file descriptor is closed and the release function is called as
part of freeing struct file.  To avoid hangs in the coredump
rendezvous and when killing threads in a multi-threaded exec.  The
coredump code and de_thread have been modified to ignore vhost threads.

Remvoing the special case for exec appears to require teaching
vhost_dev_flush how to directly complete transactions in case
the vhost thread is no longer running.

Removing the special case for coredump rendezvous requires either the
above fix needed for exec or moving the coredump rendezvous into
get_signal.

Fixes: 6e890c5d50 ("vhost: use vhost_tasks for worker threads")
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Co-developed-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2023-06-01 17:15:33 -04:00
..
e820
fpu fork, vhost: Use CLONE_THREAD to fix freezer/ps regression 2023-06-01 17:15:33 -04:00
numachip
shared
trace
uv
vdso
xen
GEN-for-each-reg.h
Kbuild
acenv.h
acpi.h
acrn.h
agp.h
alternative.h x86/alternatives: Do not use integer constant suffixes in inline asm 2023-04-18 11:57:18 +02:00
amd-ibs.h
amd_hsmp.h
amd_nb.h
apic.h
apicdef.h
apm.h
arch_hweight.h
archrandom.h
asm-offsets.h
asm-prototypes.h
asm.h
atomic.h
atomic64_32.h
atomic64_64.h
audit.h
barrier.h
bios_ebda.h
bitops.h
boot.h
bootparam_utils.h docs: move x86 documentation into Documentation/arch/ 2023-03-30 12:58:51 -06:00
bug.h
bugs.h
cache.h
cacheflush.h
cacheinfo.h
ce4100.h
cfi.h
checksum.h
checksum_32.h
checksum_64.h
clocksource.h
cmdline.h
cmpxchg.h locking/x86: Define arch_try_cmpxchg_local() 2023-04-29 09:09:23 +02:00
cmpxchg_32.h
cmpxchg_64.h
coco.h x86 APIC updates: 2023-04-25 11:39:45 -07:00
compat.h
cpu.h
cpu_device_id.h
cpu_entry_area.h
cpufeature.h
cpufeatures.h s390: 2023-05-01 12:06:20 -07:00
cpuid.h
cpuidle_haltpoll.h
cpumask.h
crash.h
current.h
debugreg.h
delay.h
desc.h
desc_defs.h
device.h
disabled-features.h
div64.h
dma-mapping.h
dma.h
dmi.h
doublefault.h
dwarf2.h
edac.h
efi.h
elf.h
elfcore-compat.h
emergency-restart.h
emulate_prefix.h
enclu.h
entry-common.h
espfix.h
exec.h
extable.h
extable_fixup_types.h
fb.h
fixmap.h
floppy.h
frame.h
fsgsbase.h
ftrace.h
futex.h
gart.h
genapic.h
geode.h
gsseg.h
hardirq.h
highmem.h
hpet.h
hugetlb.h
hw_breakpoint.h
hw_irq.h
hyperv-tlfs.h x86/hyperv: Add VTL specific structs and hypercalls 2023-04-18 17:29:51 +00:00
hyperv_timer.h
hypervisor.h
i8259.h
ia32.h
ia32_unistd.h
ibt.h
idtentry.h
imr.h
inat.h
inat_types.h
init.h
insn-eval.h
insn.h
inst.h
intel-family.h x86/cpu: Add model number for Intel Arrow Lake processor 2023-04-05 13:36:26 +02:00
intel-mid.h
intel_ds.h
intel_pconfig.h
intel_pt.h
intel_punit_ipc.h
intel_scu_ipc.h
intel_telemetry.h
invpcid.h
io.h
io_apic.h
io_bitmap.h
iomap.h
iommu.h
iosf_mbi.h
irq.h
irq_remapping.h
irq_stack.h
irq_vectors.h
irq_work.h
irqdomain.h
irqflags.h
ist.h
jailhouse_para.h
jump_label.h
kasan.h
kaslr.h
kbdleds.h
kdebug.h
kexec-bzimage64.h
kexec.h x86/kexec: remove unnecessary arch_kexec_kernel_image_load() 2023-04-08 13:45:38 -07:00
kfence.h
kgdb.h
kmsan.h
kprobes.h
kvm-x86-ops.h KVM SVM changes for 6.4: 2023-04-26 15:56:27 -04:00
kvm-x86-pmu-ops.h
kvm_host.h KVM SVM changes for 6.4: 2023-04-26 15:56:27 -04:00
kvm_page_track.h
kvm_para.h
kvm_types.h
kvm_vcpu_regs.h
kvmclock.h
linkage.h x86/linkage: Fix padding for typed functions 2023-04-14 16:08:30 +02:00
local.h locking/arch: Wire up local_try_cmpxchg() 2023-04-29 09:09:16 +02:00
mach_timer.h
mach_traps.h
math_emu.h
mc146818rtc.h
mce.h
mem_encrypt.h x86/hyperv: Change vTOM handling to use standard coco mechanisms 2023-03-27 09:31:43 +02:00
memtype.h
microcode.h
microcode_amd.h
microcode_intel.h
misc.h
mmconfig.h
mmu.h
mmu_context.h Add support for new Linear Address Masking CPU feature. This is similar 2023-04-28 09:43:49 -07:00
mmzone.h
mmzone_32.h
mmzone_64.h
module.h
mpspec.h
mpspec_def.h
mshyperv.h Objtool changes for v6.4: 2023-04-28 14:02:54 -07:00
msi.h
msr-index.h x86/include/asm/msr-index.h: Add IFS Array test bits 2023-03-27 16:10:20 +02:00
msr-trace.h
msr.h
mtrr.h
mwait.h
nmi.h
nops.h
nospec-branch.h x86,objtool: Separate unret validation from unwind hints 2023-03-23 23:18:58 +01:00
numa.h
numa_32.h
olpc.h
olpc_ofw.h
orc_lookup.h
orc_types.h x86,objtool: Split UNWIND_HINT_EMPTY in two 2023-03-23 23:18:58 +01:00
page.h
page_32.h
page_32_types.h
page_64.h
page_64_types.h docs: move x86 documentation into Documentation/arch/ 2023-03-30 12:58:51 -06:00
page_types.h
paravirt.h
paravirt_api_clock.h
paravirt_types.h
parport.h
pc-conf-reg.h
pci-direct.h
pci-functions.h
pci.h
pci_x86.h
percpu.h
perf_event.h perf/x86/intel/ds: Flush PEBS DS when changing PEBS_DATA_CFG 2023-05-08 10:58:27 +02:00
perf_event_p4.h
pgalloc.h
pgtable-2level.h
pgtable-2level_types.h
pgtable-3level.h
pgtable-3level_types.h
pgtable-invert.h
pgtable.h mm: add PTE pointer parameter to flush_tlb_fix_spurious_fault() 2023-03-28 16:20:12 -07:00
pgtable_32.h
pgtable_32_areas.h
pgtable_32_types.h
pgtable_64.h
pgtable_64_types.h docs: move x86 documentation into Documentation/arch/ 2023-03-30 12:58:51 -06:00
pgtable_areas.h
pgtable_types.h
pkeys.h
pkru.h
platform_sst_audio.h
pm-trace.h
posix_types.h
preempt.h
probe_roms.h
processor-cyrix.h
processor-flags.h
processor.h
prom.h
proto.h
pti.h
ptrace.h
purgatory.h
pvclock-abi.h
pvclock.h
qrwlock.h
qspinlock.h
qspinlock_paravirt.h
realmode.h
reboot.h cpu: Mark nmi_panic_self_stop() __noreturn 2023-04-14 17:31:26 +02:00
reboot_fixups.h
required-features.h
resctrl.h
rmwcc.h
seccomp.h
sections.h
segment.h
serial.h
set_memory.h
setup.h x86/head: Mark *_start_kernel() __noreturn 2023-04-14 17:31:24 +02:00
setup_arch.h
sev-common.h
sev.h
sgx.h
shmparam.h
sigcontext.h
sigframe.h
sighandling.h
signal.h
simd.h
smap.h
smp.h SMP cross-CPU function-call updates for v6.4: 2023-04-28 15:03:43 -07:00
softirq_stack.h
sparsemem.h
spec-ctrl.h
special_insns.h
spinlock.h
spinlock_types.h
sta2x11.h
stackprotector.h
stacktrace.h
static_call.h
string.h
string_32.h
string_64.h x86: kmsan: use C versions of memset16/memset32/memset64 2023-03-28 16:20:11 -07:00
suspend.h
suspend_32.h
suspend_64.h
svm.h KVM: SVM: Remove a duplicate definition of VMCB_AVIC_APIC_BAR_MASK 2023-04-04 11:08:12 -07:00
switch_to.h
sync_bitops.h
sync_core.h
syscall.h
syscall_wrapper.h
syscalls.h
tdx.h
text-patching.h
thermal.h
thread_info.h
time.h
timer.h
timex.h
tlb.h
tlbbatch.h
tlbflush.h
topology.h
trace_clock.h
trap_pf.h
trapnr.h
traps.h
tsc.h
uaccess.h x86: uaccess: move 32-bit and 64-bit parts into proper <asm/uaccess_N.h> header 2023-05-03 10:37:22 -07:00
uaccess_32.h x86: uaccess: move 32-bit and 64-bit parts into proper <asm/uaccess_N.h> header 2023-05-03 10:37:22 -07:00
uaccess_64.h x86-64: mm: clarify the 'positive addresses' user address rules 2023-05-03 10:37:22 -07:00
umip.h
unistd.h
unwind.h
unwind_hints.h x86,objtool: Split UNWIND_HINT_EMPTY in two 2023-03-23 23:18:58 +01:00
uprobes.h
user.h
user32.h
user_32.h
user_64.h
vdso.h
vermagic.h
vga.h
vgtod.h
virtext.h
vm86.h
vmalloc.h
vmware.h
vmx.h KVM: VMX: Fix header file dependency of asm/vmx.h 2023-05-19 13:56:25 -04:00
vmxfeatures.h
vsyscall.h
vvar.h
word-at-a-time.h
x86_init.h x86/init: Make get/set_rtc_noop() public 2023-04-18 17:29:51 +00:00
xor.h
xor_32.h
xor_64.h
xor_avx.h