search for: pf_kthread

Displaying 20 results from an estimated 53 matches for "pf_kthread".

2023 Jun 01
4
[PATCH 1/1] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression
...7 100644 --- a/arch/x86/include/asm/fpu/sched.h +++ b/arch/x86/include/asm/fpu/sched.h @@ -39,7 +39,7 @@ extern void fpu_flush_thread(void); static inline void switch_fpu_prepare(struct fpu *old_fpu, int cpu) { if (cpu_feature_enabled(X86_FEATURE_FPU) && - !(current->flags & (PF_KTHREAD | PF_IO_WORKER))) { + !(current->flags & (PF_KTHREAD | PF_USER_WORKER))) { save_fpregs_to_fpstate(old_fpu); /* * The save operation preserved register state, so the diff --git a/arch/x86/kernel/fpu/context.h b/arch/x86/kernel/fpu/context.h index 9fcfa5c4dad7..af5cbdd9bd29 10064...
2023 Jun 02
2
[PATCH 1/1] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression
Hi Mike, sorry, but somehow I can't understand this patch... I'll try to read it with a fresh head on Weekend, but for example, On 06/01, Mike Christie wrote: > > static int vhost_task_fn(void *data) > { > struct vhost_task *vtsk = data; > - int ret; > + bool dead = false; > + > + for (;;) { > + bool did_work; > + > + /* mb paired w/
2020 Apr 04
0
[PATCH 5/6] kernel: better document the use_mm/unuse_mm API contract
...m/amd/amdgpu/amdgpu_amdkfd.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.h @@ -192,9 +192,9 @@ uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct kgd_dev *dst, struct kgd_dev *s if ((mmptr) == current->mm) { \ valid = !get_user((dst), (wptr)); \ } else if (current->flags & PF_KTHREAD) { \ - use_mm(mmptr); \ + kthread_use_mm(mmptr); \ valid = !get_user((dst), (wptr)); \ - unuse_mm(mmptr); \ + kthread_unuse_mm(mmptr); \ } \ pagefault_enable(); \ } \ diff --git a/drivers/gpu/drm/i915/gvt/kvmgt.c b/drivers/gpu/drm/i915/gvt/kvmgt.c i...
2020 Apr 04
14
improve use_mm / unuse_mm
Hi all, this series improves the use_mm / unuse_mm interface by better documenting the assumptions, and my taking the set_fs manipulations spread over the callers into the core API.
2020 Apr 04
14
improve use_mm / unuse_mm
Hi all, this series improves the use_mm / unuse_mm interface by better documenting the assumptions, and my taking the set_fs manipulations spread over the callers into the core API.
2020 Apr 16
0
[PATCH 2/3] kernel: better document the use_mm/unuse_mm API contract
...kthread_use_mm - make the calling kthread operate on an address space + * @mm: address space to operate on */ -void use_mm(struct mm_struct *mm) +void kthread_use_mm(struct mm_struct *mm) { struct mm_struct *active_mm; struct task_struct *tsk = current; + WARN_ON_ONCE(!(tsk->flags & PF_KTHREAD)); + WARN_ON_ONCE(tsk->mm); + task_lock(tsk); active_mm = tsk->active_mm; if (active_mm != mm) { @@ -1236,20 +1236,19 @@ void use_mm(struct mm_struct *mm) if (active_mm != mm) mmdrop(active_mm); } -EXPORT_SYMBOL_GPL(use_mm); +EXPORT_SYMBOL_GPL(kthread_use_mm); -/* - * unuse_mm -...
2020 Apr 04
0
[PATCH 2/6] i915/gvt/kvm: a NULL ->mm does not mean a thread is a kthread
...u/drm/i915/gvt/kvmgt.c +++ b/drivers/gpu/drm/i915/gvt/kvmgt.c @@ -2037,7 +2037,7 @@ static int kvmgt_rw_gpa(unsigned long handle, unsigned long gpa, struct kvmgt_guest_info *info; struct kvm *kvm; int idx, ret; - bool kthread = current->mm == NULL; + bool kthread = (current->flags & PF_KTHREAD); if (!handle_valid(handle)) return -ESRCH; -- 2.25.1
2020 Apr 04
0
[PATCH 1/6] amdgpu: a NULL ->mm does not mean a thread is a kthread
...d.h @@ -190,7 +190,7 @@ uint8_t amdgpu_amdkfd_get_xgmi_hops_count(struct kgd_dev *dst, struct kgd_dev *s pagefault_disable(); \ if ((mmptr) == current->mm) { \ valid = !get_user((dst), (wptr)); \ - } else if (current->mm == NULL) { \ + } else if (current->flags & PF_KTHREAD) { \ use_mm(mmptr); \ valid = !get_user((dst), (wptr)); \ unuse_mm(mmptr); \ -- 2.25.1
2020 Apr 13
0
[PATCH 2/6] i915/gvt/kvm: a NULL ->mm does not mean a thread is a kthread
....com/awilliam/linux-vfio/commit/8d46c0cca5f4dc0538173d62cd36b1119b5105bc This made 5.7-rc1, so I'll update the series to take it into account. T > in vfio_dma_rw(), we still use > bool kthread = current->mm == NULL. > because if current->mm != NULL and current->flags & PF_KTHREAD, instead > of calling use_mm(), we first check if (current->mm == mm) and allow copy_to_user() if it's true. > > Do you think it's all right? I can't think of another way for a kernel thread to have a mm indeed.
2020 Apr 14
0
[PATCH 2/6] i915/gvt/kvm: a NULL ->mm does not mean a thread is a kthread
...n Mon, Apr 13, 2020 at 08:04:10PM -0400, Yan Zhao wrote: > > I can't think of another way for a kernel thread to have a mm indeed. > for example, before calling to vfio_dma_rw(), a kernel thread has already > called use_mm(), then its current->mm is not null, and it has flag > PF_KTHREAD. > in this case, we just want to allow the copy_to_user() directly if > current->mm == mm, rather than call another use_mm() again. > > do you think it makes sense? I mean no other way than using use_mm. That being said nesting potentional use_mm callers sounds like a rather bad i...
2020 Apr 16
8
improve use_mm / unuse_mm v2
Hi all, this series improves the use_mm / unuse_mm interface by better documenting the assumptions, and my taking the set_fs manipulations spread over the callers into the core API. Changes since v1: - drop a few patches - fix a comment typo - cover the newly merged use_mm/unuse_mm caller in vfio
2020 Apr 16
8
improve use_mm / unuse_mm v2
Hi all, this series improves the use_mm / unuse_mm interface by better documenting the assumptions, and my taking the set_fs manipulations spread over the callers into the core API. Changes since v1: - drop a few patches - fix a comment typo - cover the newly merged use_mm/unuse_mm caller in vfio
2020 Apr 04
0
[PATCH 6/6] kernel: set USER_DS in kthread_use_mm
...,9 @@ void kthread_use_mm(struct mm_struct *mm) if (active_mm != mm) mmdrop(active_mm); + + to_kthread(tsk)->oldfs = get_fs(); + set_fs(USER_DS); } EXPORT_SYMBOL_GPL(kthread_use_mm); @@ -1249,6 +1253,8 @@ void kthread_unuse_mm(struct mm_struct *mm) WARN_ON_ONCE(!(tsk->flags & PF_KTHREAD)); WARN_ON_ONCE(!tsk->mm); + set_fs(to_kthread(tsk)->oldfs); + task_lock(tsk); sync_mm_rss(mm); tsk->mm = NULL; -- 2.25.1
2020 Apr 16
0
[PATCH 3/3] kernel: set USER_DS in kthread_use_mm
...,9 @@ void kthread_use_mm(struct mm_struct *mm) if (active_mm != mm) mmdrop(active_mm); + + to_kthread(tsk)->oldfs = get_fs(); + set_fs(USER_DS); } EXPORT_SYMBOL_GPL(kthread_use_mm); @@ -1249,6 +1253,8 @@ void kthread_unuse_mm(struct mm_struct *mm) WARN_ON_ONCE(!(tsk->flags & PF_KTHREAD)); WARN_ON_ONCE(!tsk->mm); + set_fs(to_kthread(tsk)->oldfs); + task_lock(tsk); sync_mm_rss(mm); tsk->mm = NULL; -- 2.25.1
2023 May 22
3
[PATCH 0/3] vhost: Fix freezer/ps regressions
The following patches made over Linus's tree fix the 2 bugs: 1. vhost worker task shows up as a process forked from the parent that did VHOST_SET_OWNER ioctl instead of a process under root/kthreadd. This was causing breaking scripts. 2. vhost_tasks didn't disable or add support for freeze requests. The following patches fix these issues by making the vhost_task task a thread under the
2023 May 22
2
[PATCH 3/3] fork, vhost: Use CLONE_THREAD to fix freezer/ps regression
...unsigned long stack_size; > unsigned long tls; > diff --git a/kernel/fork.c b/kernel/fork.c > index ed4e01daccaa..9e04ab5c3946 100644 > --- a/kernel/fork.c > +++ b/kernel/fork.c > @@ -2338,14 +2338,10 @@ __latent_entropy struct task_struct *copy_process( > p->flags |= PF_KTHREAD; > if (args->user_worker) > p->flags |= PF_USER_WORKER; > - if (args->io_thread) { > - /* > - * Mark us an IO worker, and block any signal that isn't > - * fatal or STOP > - */ > + if (args->io_thread) > p->flags |= PF_IO_WORKER; > + i...
2010 Jan 29
0
[PATCH 3/3] ocfs2:freeze-thaw: make it work -v2
...pseudo constants for clustersize bits */ osb->s_clustersize_bits = le32_to_cpu(di->id2.i_super.s_clustersize_bits); @@ -2529,5 +2551,110 @@ void __ocfs2_abort(struct super_block* sb, ocfs2_handle_error(sb); } +static inline int is_kernel_thread() +{ + return (current->flags & PF_KTHREAD); +} + +/* ocfs2_freeze_fs()/ocfs2_unfreeze_fs() are always called by freeze_bdev()/ + * thaw_bdev(). bdev->bd_fsfreeze_mutex is used for synchronization. an extra + * ocfs2 mutex is not needed. + */ +static int ocfs2_freeze_fs(struct super_block *sb) +{ + int ret = 0; + struct ocfs2_super *osb...
2008 Jul 04
1
[PATCH 0/2] dm-ioband: I/O bandwidth controller v1.2.0: Introduction
Hi everyone, This is the dm-ioband version 1.2.0 release. Dm-ioband is an I/O bandwidth controller implemented as a device-mapper driver, which gives specified bandwidth to each job running on the same physical device. - Can be applied to the kernel 2.6.26-rc5-mm3. - Changes from 1.1.0 (posted on June 2, 2008): - Dynamic policy switching A user can change the bandwidth control policy
2008 Jul 04
1
[PATCH 0/2] dm-ioband: I/O bandwidth controller v1.2.0: Introduction
Hi everyone, This is the dm-ioband version 1.2.0 release. Dm-ioband is an I/O bandwidth controller implemented as a device-mapper driver, which gives specified bandwidth to each job running on the same physical device. - Can be applied to the kernel 2.6.26-rc5-mm3. - Changes from 1.1.0 (posted on June 2, 2008): - Dynamic policy switching A user can change the bandwidth control policy
2008 Jul 04
1
[PATCH 0/2] dm-ioband: I/O bandwidth controller v1.2.0: Introduction
Hi everyone, This is the dm-ioband version 1.2.0 release. Dm-ioband is an I/O bandwidth controller implemented as a device-mapper driver, which gives specified bandwidth to each job running on the same physical device. - Can be applied to the kernel 2.6.26-rc5-mm3. - Changes from 1.1.0 (posted on June 2, 2008): - Dynamic policy switching A user can change the bandwidth control policy