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 26EF03C1094 for ; Mon, 29 Jun 2026 14:55:15 +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=1782744918; cv=none; b=kBplfL3otlXUWjKDX9H0iErph4EZzIsGzdw7oDBcZewJPYlyrPliOIDSPUCPINkp1ktv5KxHC6NBFtD+zaUCVBY4fs6CZr7Ja08hwPTiVwL7kmZEfqhoOXnl016LWwkzfp5SS1sILKTO8+My7fMyCA4SjjxvU3t9rpaTLgBrysw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1782744918; c=relaxed/simple; bh=NWejcmIO/DoW6BO9c6i/19FrFck8ORAYhgTY8TIvHl0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KcQY9ADrrt12Uc7dkM/oPRZuQcJkwvUUWCPXD4C0xA+HYjkAaTs46ikmP1B8Iex7Ge1yOwsEtKswr2RchiNQLA8LzQZt5PvxxslKWOivEedlawBK/iKtj7G1kun6oNx72e19VPOY13NJhq619P/qikHymQnvJNpm2fU+b53NO3I= 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; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=jCtjJZ50; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="jCtjJZ50" 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 0369625DE for ; Mon, 29 Jun 2026 07:55:11 -0700 (PDT) Received: from [192.168.0.1] (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 33C1C3F905 for ; Mon, 29 Jun 2026 07:55:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1782744915; bh=NWejcmIO/DoW6BO9c6i/19FrFck8ORAYhgTY8TIvHl0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jCtjJZ50ENxltoMZ6dext2UJba3XaOGImvOfFJYZ29HSYGvJXw5dFsJUoYOmKCa3h PQbQ7dsNkTBNlSTeMUfW4MfaNP5ETqhNYvqDPyPE8DZ+kry//UhXh1T85UVsR0CKO1 ed+9DyeBX9ryqM4UyPVDzRaNHtDhS8ORLLlAdsD4= Date: Mon, 29 Jun 2026 15:55:03 +0100 From: Liviu Dudau To: Boris Brezillon Cc: Steven Price , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Nicolas Frattaroli , Chia-I Wu , Karunika Choo , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, sashiko-bot@kernel.org Subject: Re: [PATCH 06/11] drm/panthor: Don't overrule pending immediate ticks in sched_resume_tick() Message-ID: References: <20260625-panthor-misc-fixes-v1-0-b67ed973fea6@collabora.com> <20260625-panthor-misc-fixes-v1-6-b67ed973fea6@collabora.com> <20260626151906.7b32fc29@fedora-2.home> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260626151906.7b32fc29@fedora-2.home> On Fri, Jun 26, 2026 at 03:19:06PM +0200, Boris Brezillon wrote: > On Fri, 26 Jun 2026 13:45:38 +0100 > Liviu Dudau wrote: > > > On Thu, Jun 25, 2026 at 02:40:32PM +0200, Boris Brezillon wrote: > > > We schedule immediate ticks when we need to process events on CSGs, > > > but those immediate ticks don't change the resched_target because we > > > want the other groups to stay scheduled for the remaining of the GPU > > > timeslot they were given. Make sure these immediate ticks don't get > > > overruled by a sched_queue_delayed_work() that would delay the tick > > > execution. > > > > > > Fixes: 99820b4b7e50 ("drm/panthor: Make sure we resume the tick when new jobs are submitted") > > > Reported-by: sashiko-bot@kernel.org > > > Closes: https://sashiko.dev/#/patchset/20260625-panthor-signal-from-irq-v4-0-3d2908912afa@collabora.com?part=9 > > > Signed-off-by: Boris Brezillon > > > --- > > > drivers/gpu/drm/panthor/panthor_sched.c | 9 ++++++++- > > > 1 file changed, 8 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c > > > index 8fd4d97b062e..ab3e13e44a26 100644 > > > --- a/drivers/gpu/drm/panthor/panthor_sched.c > > > +++ b/drivers/gpu/drm/panthor/panthor_sched.c > > > @@ -2667,7 +2667,14 @@ static void sched_resume_tick(struct panthor_device *ptdev) > > > else > > > delay_jiffies = 0; > > > > > > - sched_queue_delayed_work(sched, tick, delay_jiffies); > > > + /* We schedule immediate ticks when we need to process events on CSGs, > > > + * but those don't change the resched_target because we want the other > > > + * groups to stay scheduled for the remaining of the GPU timeslot they > > > + * were given. Make sure those immediate ticks don't get overruled by > > > + * a sched_queue_delayed_work() that would delay the tick execution. > > > + */ > > > + if (!delayed_work_pending(&sched->tick_work)) > > > + sched_queue_delayed_work(sched, tick, delay_jiffies); > > > > Maybe I'm having a Friday heat brain freeze, but it feels like the comment and the code > > are going in a different direction. It doesn't help that the commit message copies the > > comment so I can't tell if I'm misreading the comment or there was a different intent. > > There's basically two kind of ticks: > > 1. The periodic ones that serve as a way to rotate groups on the slots > and give everyone a chance to get a GPU slice > 2. The immediate ones which are there to process events coming from an > interrupt, or to re-evaluate groups to schedule because a new group > became active > > To detect the kind of tick, we use ::resched_target. If current time is > before this target, this is an event, and resident groups shouldn't be > evicted (I'm intentionally eluding RT groups to keep things simple). > > The problem we have with sched_resume_tick() is that it's > unconditionally calling sched_queue_delayed_work() > (mod_delayed_work() internally). So, if we have an immediate tick > pending (one that didn't adjust ::resched_target), we end up > rescheduling the work to a later point thus delaying the processing of > this asynchronous event for no good reason. What this commit does is > skip the sched_queue_delayed_work() if the tick_work is pending. Yeah, my confusion was from not understanding that immediate work is still considered "delayed work" but one that does not adjust ::resched_target. > > I'd be happy to change the wording if you have something to propose. I don't think I have better wording to offer. Best regards, Liviu -- ==================== | I would like to | | fix the world, | | but they're not | | giving me the | \ source code! / --------------- ¯\_(ツ)_/¯