Intel-XE Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Philipp Stanner <pstanner@redhat.com>
To: Matthew Brost <matthew.brost@intel.com>,
	Boris Brezillon <boris.brezillon@collabora.com>
Cc: "Tvrtko Ursulin" <tursulin@ursulin.net>,
	"Philipp Stanner" <phasta@kernel.org>,
	"Alex Deucher" <alexander.deucher@amd.com>,
	"Christian König" <christian.koenig@amd.com>,
	"Xinhui Pan" <Xinhui.Pan@amd.com>,
	"David Airlie" <airlied@gmail.com>,
	"Simona Vetter" <simona@ffwll.ch>,
	"Lucas Stach" <l.stach@pengutronix.de>,
	"Russell King" <linux+etnaviv@armlinux.org.uk>,
	"Christian Gmeiner" <christian.gmeiner@gmail.com>,
	"Frank Binns" <frank.binns@imgtec.com>,
	"Matt Coster" <matt.coster@imgtec.com>,
	"Maarten Lankhorst" <maarten.lankhorst@linux.intel.com>,
	"Maxime Ripard" <mripard@kernel.org>,
	"Thomas Zimmermann" <tzimmermann@suse.de>,
	"Qiang Yu" <yuq825@gmail.com>, "Rob Clark" <robdclark@gmail.com>,
	"Sean Paul" <sean@poorly.run>,
	"Konrad Dybcio" <konradybcio@kernel.org>,
	"Abhinav Kumar" <quic_abhinavk@quicinc.com>,
	"Dmitry Baryshkov" <dmitry.baryshkov@linaro.org>,
	"Marijn Suijten" <marijn.suijten@somainline.org>,
	"Karol Herbst" <kherbst@redhat.com>,
	"Lyude Paul" <lyude@redhat.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Steven Price" <steven.price@arm.com>,
	"Liviu Dudau" <liviu.dudau@arm.com>,
	"Luben Tuikov" <ltuikov89@gmail.com>,
	"Melissa Wen" <mwen@igalia.com>,
	"Maíra Canal" <mcanal@igalia.com>,
	"Lucas De Marchi" <lucas.demarchi@intel.com>,
	"Thomas Hellström" <thomas.hellstrom@linux.intel.com>,
	"Rodrigo Vivi" <rodrigo.vivi@intel.com>,
	"Sunil Khatri" <sunil.khatri@amd.com>,
	"Lijo Lazar" <lijo.lazar@amd.com>,
	"Mario Limonciello" <mario.limonciello@amd.com>,
	"Ma Jun" <Jun.Ma2@amd.com>, "Yunxiang Li" <Yunxiang.Li@amd.com>,
	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
Date: Thu, 23 Jan 2025 08:34:30 +0100	[thread overview]
Message-ID: <e6aea551ec14bcece31c3cbb861afee361547f84.camel@redhat.com> (raw)
In-Reply-To: <Z5HHjnTzhNX9j05U@lstrano-desk.jf.intel.com>

On Wed, 2025-01-22 at 20:37 -0800, Matthew Brost wrote:
> On Wed, Jan 22, 2025 at 06:04:58PM +0100, Boris Brezillon wrote:
> > On Wed, 22 Jan 2025 16:14:59 +0000
> > Tvrtko Ursulin <tursulin@ursulin.net> wrote:
> > 
> > > On 22/01/2025 15:51, Boris Brezillon wrote:
> > > > On Wed, 22 Jan 2025 15:08:20 +0100
> > > > Philipp Stanner <phasta@kernel.org> 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,
> > > >          };  
> > > 
> 
> +2

Yup, getting rid of memset() similar to Danilo's suggestion is surely a
good idea.

I personally don't like mixing initialization and declaration when
possible (readability), but having it const is probably a good
argument.

P.

> 
> Matt
> 
> > > +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;  
> > 


  reply	other threads:[~2025-01-23  7:35 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-22 14:08 [PATCH] drm/sched: Use struct for drm_sched_init() params Philipp Stanner
2025-01-22 14:30 ` Danilo Krummrich
2025-01-22 14:34 ` Christian König
2025-01-22 14:48   ` Philipp Stanner
2025-01-22 15:02     ` Matthew Brost
2025-01-22 15:06     ` Christian König
2025-01-22 15:23       ` Philipp Stanner
2025-01-22 15:37         ` Christian König
2025-01-22 15:29       ` Matthew Brost
2025-01-22 15:51 ` Boris Brezillon
2025-01-22 16:14   ` Tvrtko Ursulin
2025-01-22 17:04     ` Boris Brezillon
2025-01-23  4:37       ` Matthew Brost
2025-01-23  7:34         ` Philipp Stanner [this message]
2025-01-22 17:16 ` Boris Brezillon
2025-01-23  7:33   ` Philipp Stanner
2025-01-23  8:23     ` Boris Brezillon
2025-01-23  9:29     ` Danilo Krummrich
2025-01-23  9:35       ` Philipp Stanner
2025-01-23  9:55         ` Danilo Krummrich
2025-01-23 10:57         ` Tvrtko Ursulin
2025-01-22 22:07 ` Maíra Canal
2025-01-23  8:10   ` Philipp Stanner
2025-01-23  8:39     ` Philipp Stanner
2025-01-23 11:10     ` Maíra Canal
2025-01-23 12:13       ` Philipp Stanner
2025-01-23 12:29         ` Maíra Canal
2025-01-23 10:55 ` ✓ CI.Patch_applied: success for " Patchwork
2025-01-23 10:55 ` ✗ CI.checkpatch: warning " Patchwork
2025-01-23 10:56 ` ✓ CI.KUnit: success " Patchwork
2025-01-23 11:13 ` ✓ CI.Build: " Patchwork
2025-01-23 11:15 ` ✓ CI.Hooks: " Patchwork
2025-01-23 11:17 ` ✓ CI.checksparse: " Patchwork
2025-01-23 11:45 ` ✓ Xe.CI.BAT: " Patchwork
2025-01-24  0:02 ` ✗ Xe.CI.Full: failure " Patchwork

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=e6aea551ec14bcece31c3cbb861afee361547f84.camel@redhat.com \
    --to=pstanner@redhat.com \
    --cc=Jun.Ma2@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=Yunxiang.Li@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=boris.brezillon@collabora.com \
    --cc=christian.gmeiner@gmail.com \
    --cc=christian.koenig@amd.com \
    --cc=dakr@kernel.org \
    --cc=dmitry.baryshkov@linaro.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=etnaviv@lists.freedesktop.org \
    --cc=frank.binns@imgtec.com \
    --cc=freedreno@lists.freedesktop.org \
    --cc=intel-xe@lists.freedesktop.org \
    --cc=kherbst@redhat.com \
    --cc=konradybcio@kernel.org \
    --cc=l.stach@pengutronix.de \
    --cc=lijo.lazar@amd.com \
    --cc=lima@lists.freedesktop.org \
    --cc=linux+etnaviv@armlinux.org.uk \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liviu.dudau@arm.com \
    --cc=ltuikov89@gmail.com \
    --cc=lucas.demarchi@intel.com \
    --cc=lyude@redhat.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=marijn.suijten@somainline.org \
    --cc=mario.limonciello@amd.com \
    --cc=matt.coster@imgtec.com \
    --cc=matthew.brost@intel.com \
    --cc=mcanal@igalia.com \
    --cc=mripard@kernel.org \
    --cc=mwen@igalia.com \
    --cc=nouveau@lists.freedesktop.org \
    --cc=phasta@kernel.org \
    --cc=quic_abhinavk@quicinc.com \
    --cc=robdclark@gmail.com \
    --cc=robh@kernel.org \
    --cc=rodrigo.vivi@intel.com \
    --cc=sean@poorly.run \
    --cc=simona@ffwll.ch \
    --cc=steven.price@arm.com \
    --cc=sunil.khatri@amd.com \
    --cc=thomas.hellstrom@linux.intel.com \
    --cc=tursulin@ursulin.net \
    --cc=tzimmermann@suse.de \
    --cc=yuq825@gmail.com \
    /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