From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EEB3B214814; Wed, 22 Jan 2025 17:05:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737565513; cv=none; b=YlBaZ3E45ERq4qzX+OfnWRaYLSzq9fadHmeIA0pSVLpIL6CsXmKpgV2Wwhz7iMXaZvjSGK8Uv0+T7w7hBTRGICBA4hvhP7/ydCDJld31FIh+d8WTouFNvhfT5SPrP6QKHC+1ABd7DK4PU0gAOPrGVeEBoIngKxTyJ/+hPCbutmo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737565513; c=relaxed/simple; bh=fZrP9wlezpCcDGh+K7hUa20Mn2C7VNWVYRQKGznyqL8=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=YSqT9NzEcS3WU6c0G2I0hrr9DdOHb7LLijVuIp+iBZeiwbBgAunbgs79AqRE7qFWYyiytDhWi2B4Rao5q5PvhdaBlwWgrxAh81eaJhKGh0KRQHW2rDhiP4K8XcNm/ZIhj/ftuo/prLRolgP6K1k7RdMpm/mHMIMzsl8Xml9rjtg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=Lf3o9d98; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="Lf3o9d98" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1737565508; bh=fZrP9wlezpCcDGh+K7hUa20Mn2C7VNWVYRQKGznyqL8=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Lf3o9d98NReFn6B4qxLKQm9NKR6AOBaxiWzd5x0GKz+RUoMxWHc20PBCHBsG1q7xf JjlBC7jzTyMCErvgEDn4sepzUjGxEc+Y3FwtKROENau+svubwlcP3tXqXG7BtjDxIS M+GuPOj6cGCOfHqTBtyOlC553f/9CMmGV4iMB36t2NtL0aJvvT+e68qeoKcjeZ9edz p/ZTJG+WbOmhFL+z0keRcRIYno673jx+0yeEksTdoKzYe3QX8gJCKlQlVVWaSM5JN5 vW3jctIheK80L0maGwOyEW62m0JwdDjG7msdrUxA5DN3g07W+tpyl+JvjWmJHvn/cj CrKh9OKm+2zmA== Received: from localhost (unknown [IPv6:2a01:e0a:2c:6930:5cf4:84a1:2763:fe0d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bbrezillon) by bali.collaboradmins.com (Postfix) with ESMTPSA id 10AAC17E0D72; Wed, 22 Jan 2025 18:05:07 +0100 (CET) Date: Wed, 22 Jan 2025 18:04:58 +0100 From: Boris Brezillon To: Tvrtko Ursulin Cc: Philipp Stanner , Alex Deucher , Christian =?UTF-8?B?S8O2bmln?= , Xinhui Pan , David Airlie , Simona Vetter , Lucas Stach , Russell King , Christian Gmeiner , Frank Binns , Matt Coster , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Qiang Yu , Rob Clark , Sean Paul , Konrad Dybcio , Abhinav Kumar , Dmitry Baryshkov , Marijn Suijten , Karol Herbst , Lyude Paul , Danilo Krummrich , Rob Herring , Steven Price , Liviu Dudau , Luben Tuikov , Matthew Brost , Philipp Stanner , Melissa Wen , =?UTF-8?B?TWHDrXJh?= Canal , Lucas De Marchi , Thomas =?UTF-8?B?SGVsbHN0csO2?= =?UTF-8?B?bQ==?= , Rodrigo Vivi , Sunil Khatri , Lijo Lazar , Mario Limonciello , Ma Jun , Yunxiang Li , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, etnaviv@lists.freedesktop.org, lima@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, nouveau@lists.freedesktop.org, intel-xe@lists.freedesktop.org Subject: Re: [PATCH] drm/sched: Use struct for drm_sched_init() params Message-ID: <20250122180353.7ef8fbc1@collabora.com> In-Reply-To: References: <20250122140818.45172-3-phasta@kernel.org> <20250122165104.536c4143@collabora.com> Organization: Collabora X-Mailer: Claws Mail 4.3.0 (GTK 3.24.43; x86_64-redhat-linux-gnu) 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=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 22 Jan 2025 16:14:59 +0000 Tvrtko Ursulin wrote: > On 22/01/2025 15:51, Boris Brezillon wrote: > > On Wed, 22 Jan 2025 15:08:20 +0100 > > Philipp Stanner wrote: > > > >> --- a/drivers/gpu/drm/panthor/panthor_sched.c > >> +++ b/drivers/gpu/drm/panthor/panthor_sched.c > >> @@ -3272,6 +3272,7 @@ group_create_queue(struct panthor_group *group, > >> const struct drm_panthor_queue_create *args) > >> { > >> struct drm_gpu_scheduler *drm_sched; > >> + struct drm_sched_init_params sched_params; > > > > nit: Could we use a struct initializer instead of a > > memset(0)+field-assignment? > > > > struct drm_sched_init_params sched_params = { Actually, you can even make it const if it's not modified after the declaration. > > .ops = &panthor_queue_sched_ops, > > .submit_wq = group->ptdev->scheduler->wq, > > .num_rqs = 1, > > .credit_limit = args->ringbuf_size / sizeof(u64), > > .hang_limit = 0, > > .timeout = msecs_to_jiffies(JOB_TIMEOUT_MS), > > .timeout_wq = group->ptdev->reset.wq, > > .name = "panthor-queue", > > .dev = group->ptdev->base.dev, > > }; > > +1 on this as a general approach for the whole series. And I'd drop the > explicit zeros and NULLs. Memsets could then go too. > > Regards, > > Tvrtko > > > > > The same comment applies the panfrost changes BTW. > > > >> struct panthor_queue *queue; > >> int ret; > >> > >> @@ -3289,6 +3290,8 @@ group_create_queue(struct panthor_group *group, > >> if (!queue) > >> return ERR_PTR(-ENOMEM); > >> > >> + memset(&sched_params, 0, sizeof(struct drm_sched_init_params)); > >> + > >> queue->fence_ctx.id = dma_fence_context_alloc(1); > >> spin_lock_init(&queue->fence_ctx.lock); > >> INIT_LIST_HEAD(&queue->fence_ctx.in_flight_jobs); > >> @@ -3341,17 +3344,23 @@ group_create_queue(struct panthor_group *group, > >> if (ret) > >> goto err_free_queue; > >> > >> + sched_params.ops = &panthor_queue_sched_ops; > >> + sched_params.submit_wq = group->ptdev->scheduler->wq; > >> + sched_params.num_rqs = 1; > >> /* > >> - * Credit limit argument tells us the total number of instructions > >> + * The credit limit argument tells us the total number of instructions > >> * across all CS slots in the ringbuffer, with some jobs requiring > >> * twice as many as others, depending on their profiling status. > >> */ > >> - ret = drm_sched_init(&queue->scheduler, &panthor_queue_sched_ops, > >> - group->ptdev->scheduler->wq, 1, > >> - args->ringbuf_size / sizeof(u64), > >> - 0, msecs_to_jiffies(JOB_TIMEOUT_MS), > >> - group->ptdev->reset.wq, > >> - NULL, "panthor-queue", group->ptdev->base.dev); > >> + sched_params.credit_limit = args->ringbuf_size / sizeof(u64); > >> + sched_params.hang_limit = 0; > >> + sched_params.timeout = msecs_to_jiffies(JOB_TIMEOUT_MS); > >> + sched_params.timeout_wq = group->ptdev->reset.wq; > >> + sched_params.score = NULL; > >> + sched_params.name = "panthor-queue"; > >> + sched_params.dev = group->ptdev->base.dev; > >> + > >> + ret = drm_sched_init(&queue->scheduler, &sched_params); > >> if (ret) > >> goto err_free_queue;