From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 86F3025DD0B for ; Thu, 25 Sep 2025 08:56:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758790575; cv=none; b=uQVUF+hXNQ+rxobbf1AgVttvWIohyXuCJ3sYpPf8asSIuwMzMJ31CP/W1B6ZzdH8Ddb7jENIIWFkeWGwcl77qH6Fpx5klXfVPM553XqGs2/0c4OtjKC7Tksz7T3xiaGZyObqRC1fVxzKOVESUwPEYGd8MZ2bOFwHhRRjmwJOdSA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758790575; c=relaxed/simple; bh=bBlJL6HjbK4m0bzEU6AVUm0dAhcLJduOQCTtnLYd7Fg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=UgwTic7XVQKdQsrqU0+7VLufe6kXJfiMXLOHgWdB/Za6pWsn05PJDBGw6gViKZxV8Mj8ajHe5aRdxF1jmkVecq+IahBGQsLhyG5MKSWbd9Jm5ff3qWr8csr26LEOR3oh2I1BjMq8oiE8j/ilS6rLsoxQapsPdg2aX5t3auLebIo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CC2FC1692; Thu, 25 Sep 2025 01:56:04 -0700 (PDT) Received: from [10.57.1.102] (unknown [10.57.1.102]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 490DB3F5A1; Thu, 25 Sep 2025 01:56:10 -0700 (PDT) Message-ID: Date: Thu, 25 Sep 2025 09:56:08 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drm/panthor: Defer scheduler entitiy destruction to queue release To: =?UTF-8?Q?Adri=C3=A1n_Larumbe?= , linux-kernel@vger.kernel.org Cc: dri-devel@lists.freedesktop.org, Boris Brezillon , kernel@collabora.com, Liviu Dudau , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Heiko Stuebner References: <20250919164436.531930-1-adrian.larumbe@collabora.com> From: Steven Price Content-Language: en-GB In-Reply-To: <20250919164436.531930-1-adrian.larumbe@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On 19/09/2025 17:43, Adrián Larumbe wrote: > Commit de8548813824 ("drm/panthor: Add the scheduler logical block") > handled destruction of a group's queues' drm scheduler entities early > into the group destruction procedure. > > However, that races with the group submit ioctl, because by the time > entities are destroyed (through the group destroy ioctl), the submission > procedure might've already obtained a group handle, and therefore the > ability to push jobs into entities. This is met with a DRM error message > within the drm scheduler core as a situation that should never occur. > > Fix by deferring drm scheduler entity destruction to queue release time. > > Fixes: de8548813824 ("drm/panthor: Add the scheduler logical block") > Signed-off-by: Adrián Larumbe Applied to drm-misc-fixes. Thanks, Steve > --- > drivers/gpu/drm/panthor/panthor_sched.c | 8 +------- > 1 file changed, 1 insertion(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c > index 0cc9055f4ee5..f5e01cb16cfc 100644 > --- a/drivers/gpu/drm/panthor/panthor_sched.c > +++ b/drivers/gpu/drm/panthor/panthor_sched.c > @@ -898,8 +898,7 @@ static void group_free_queue(struct panthor_group *group, struct panthor_queue * > if (IS_ERR_OR_NULL(queue)) > return; > > - if (queue->entity.fence_context) > - drm_sched_entity_destroy(&queue->entity); > + drm_sched_entity_destroy(&queue->entity); > > if (queue->scheduler.ops) > drm_sched_fini(&queue->scheduler); > @@ -3609,11 +3608,6 @@ int panthor_group_destroy(struct panthor_file *pfile, u32 group_handle) > if (!group) > return -EINVAL; > > - for (u32 i = 0; i < group->queue_count; i++) { > - if (group->queues[i]) > - drm_sched_entity_destroy(&group->queues[i]->entity); > - } > - > mutex_lock(&sched->reset.lock); > mutex_lock(&sched->lock); > group->destroyed = true;