linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@redhat.com>
To: "Christian König" <christian.koenig@amd.com>
Cc: "Todd Kjos" <tkjos@android.com>,
	"Martijn Coenen" <maco@android.com>,
	"Joel Fernandes" <joelagnelf@nvidia.com>,
	"Christian Brauner" <brauner@kernel.org>,
	"Carlos Llamas" <cmllamas@google.com>,
	"Suren Baghdasaryan" <surenb@google.com>,
	"Felix Kuehling" <Felix.Kuehling@amd.com>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Boris Brezillon" <boris.brezillon@collabora.com>,
	"Rob Herring" <robh@kernel.org>,
	"Steven Price" <steven.price@arm.com>,
	"Adrián Larumbe" <adrian.larumbe@collabora.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Liviu Dudau" <liviu.dudau@arm.com>,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	"Leon Romanovsky" <leon@kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@google.com>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	linux-kernel@vger.kernel.org, amd-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org,
	netdev@vger.kernel.org
Subject: Re: [PATCH 4/7] drm/amd: kill the outdated "Only the pthreads threading model is supported" checks
Date: Mon, 8 Dec 2025 11:05:09 +0100	[thread overview]
Message-ID: <aTai1a2sFqTh7wv9@redhat.com> (raw)
In-Reply-To: <e8846bef-2a6b-4552-8fb6-a33a00273aab@amd.com>

On 12/08, Christian König wrote:
>
> On 12/7/25 13:39, Oleg Nesterov wrote:
> > Nowaday task->group_leader->mm != task->mm is only possible if
> > a) task is not a group leader and b) task->group_leader->mm == NULL
> > because task->group_leader has already exited using sys_exit().
>
> Just for my understanding: That is because CLONE_THREAD can only be
> specified together with CLONE_SIGHAND and CLONE_VM, correct?

Yes, copy copy_process() does

	if ((clone_flags & CLONE_THREAD) && !(clone_flags & CLONE_SIGHAND))
		return ERR_PTR(-EINVAL);

	if ((clone_flags & CLONE_SIGHAND) && !(clone_flags & CLONE_VM))
		return ERR_PTR(-EINVAL);

	...

	if (clone_flags & CLONE_THREAD) {
		p->group_leader = current->group_leader;
		p->tgid = current->tgid;
	} else {
		p->group_leader = p;
		p->tgid = p->pid;
	}
> Reviewed-by: Christian König <christian.koenig@amd.com>

Thanks!

> Should we pick that one up or do you want to merge it upstream somehow?

If you don't object, I would like to route this series via -mm tree.

See 0/7, I am going to send more (simple) tree-wide changes which depend
on this series.

Oleg.

> Regards,
> Christian.
>
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c   |  3 ---
> >  drivers/gpu/drm/amd/amdkfd/kfd_process.c | 10 ----------
> >  2 files changed, 13 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> > index a0f8ba382b9e..e44f158a11f0 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c
> > @@ -2551,9 +2551,6 @@ void amdgpu_vm_set_task_info(struct amdgpu_vm *vm)
> >  	vm->task_info->task.pid = current->pid;
> >  	get_task_comm(vm->task_info->task.comm, current);
> >
> > -	if (current->group_leader->mm != current->mm)
> > -		return;
> > -
> >  	vm->task_info->tgid = current->tgid;
> >  	get_task_comm(vm->task_info->process_name, current->group_leader);
> >  }
> > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> > index a085faac9fe1..f8ef18a3aa71 100644
> > --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> > @@ -833,12 +833,6 @@ struct kfd_process *kfd_create_process(struct task_struct *thread)
> >  	if (!(thread->mm && mmget_not_zero(thread->mm)))
> >  		return ERR_PTR(-EINVAL);
> >
> > -	/* Only the pthreads threading model is supported. */
> > -	if (thread->group_leader->mm != thread->mm) {
> > -		mmput(thread->mm);
> > -		return ERR_PTR(-EINVAL);
> > -	}
> > -
> >  	/* If the process just called exec(3), it is possible that the
> >  	 * cleanup of the kfd_process (following the release of the mm
> >  	 * of the old process image) is still in the cleanup work queue.
> > @@ -918,10 +912,6 @@ struct kfd_process *kfd_get_process(const struct task_struct *thread)
> >  	if (!thread->mm)
> >  		return ERR_PTR(-EINVAL);
> >
> > -	/* Only the pthreads threading model is supported. */
> > -	if (thread->group_leader->mm != thread->mm)
> > -		return ERR_PTR(-EINVAL);
> > -
> >  	process = find_process(thread, false);
> >  	if (!process)
> >  		return ERR_PTR(-EINVAL);
>


  reply	other threads:[~2025-12-08 10:05 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-07 12:38 [PATCH 0/7] don't abuse task_struct.group_leader Oleg Nesterov
2025-12-07 12:39 ` [PATCH 1/7] android/binder: don't abuse current->group_leader Oleg Nesterov
2025-12-18 11:06   ` Alice Ryhl
2025-12-07 12:39 ` [PATCH 2/7] android/binder: use same_thread_group(proc->tsk, current) in binder_mmap() Oleg Nesterov
2025-12-18 11:05   ` Alice Ryhl
2025-12-07 12:39 ` [PATCH 3/7] drm/amdgpu: don't abuse current->group_leader Oleg Nesterov
2025-12-09 19:22   ` Felix Kuehling
2025-12-07 12:39 ` [PATCH 4/7] drm/amd: kill the outdated "Only the pthreads threading model is supported" checks Oleg Nesterov
2025-12-08  8:28   ` Christian König
2025-12-08 10:05     ` Oleg Nesterov [this message]
2025-12-09 19:23   ` Felix Kuehling
2025-12-07 12:39 ` [PATCH 5/7] drm/pan*: don't abuse current->group_leader Oleg Nesterov
2025-12-08  8:23   ` Boris Brezillon
2025-12-10 11:49   ` Steven Price
2025-12-07 12:40 ` [PATCH 6/7] RDMA/umem: " Oleg Nesterov
2025-12-21  8:03   ` Leon Romanovsky
2025-12-07 12:40 ` [PATCH 7/7] netclassid: use thread_group_leader(p) in update_classid_task() Oleg Nesterov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aTai1a2sFqTh7wv9@redhat.com \
    --to=oleg@redhat.com \
    --cc=Felix.Kuehling@amd.com \
    --cc=adrian.larumbe@collabora.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=boris.brezillon@collabora.com \
    --cc=brauner@kernel.org \
    --cc=christian.koenig@amd.com \
    --cc=cmllamas@google.com \
    --cc=davem@davemloft.net \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=edumazet@google.com \
    --cc=jgg@ziepe.ca \
    --cc=joelagnelf@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=maco@android.com \
    --cc=mripard@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=robh@kernel.org \
    --cc=simona@ffwll.ch \
    --cc=steven.price@arm.com \
    --cc=surenb@google.com \
    --cc=tkjos@android.com \
    --cc=tzimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).