From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0929921504F for ; Wed, 22 Jan 2025 16:15:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737562506; cv=none; b=FIsBkbmjQvU2e9M6i43qWfwua3pilKQprOjSaDv+SlQ70dZ1+z7ggcZoK21P9Pv1S88T5wQcnCh1rtMIUh56168mVh1IhltCeau5lxRXhsKgGJ64riz10X2d7+Ny40FT7U3lQattm6JjxSmUnAyUUdxV/dzqsmjlj4T+BG4LTkw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737562506; c=relaxed/simple; bh=XKmIdC74Rr23gvHHYjnvTOjQPg91btg6MT5in6EwDAU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=hUUkERPFjagBsGWu0g7xxI7aD4pY5JUfdZLHETihDN3VbBbufoeRuXHz1HxjaMpsiwp6DeSm3NgjwkQRR6vWZPKF30ZmNE3vXZfxAo8dJ6uING0337I/MigExnRbSDtZppVF/MzH3xkN+GMeJGpSPiWOPrPGPrSYykDQiG9je1Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ursulin.net; spf=none smtp.mailfrom=ursulin.net; dkim=pass (2048-bit key) header.d=ursulin-net.20230601.gappssmtp.com header.i=@ursulin-net.20230601.gappssmtp.com header.b=QUqDwXzt; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ursulin.net Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=ursulin.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ursulin-net.20230601.gappssmtp.com header.i=@ursulin-net.20230601.gappssmtp.com header.b="QUqDwXzt" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-43624b2d453so78621255e9.2 for ; Wed, 22 Jan 2025 08:15:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20230601.gappssmtp.com; s=20230601; t=1737562502; x=1738167302; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=k6yifiK7k1egD832rtDY2X5ShBnrSfrr32YKaeunTC8=; b=QUqDwXztEinUm5jOAMqrnzLcsj21Y5OF7IJ3blMKSysrwFwPXkXHcRi2n/Mld1bx07 v7I4dfBK6hrRZfhOXYeRD/DNktqA34NLp6F7Cdhf1WbyqXqnoN8RDt75thAONB26pBx7 SCl4GngW78fCB5b2v2LQvT9f8bJaj/g/y78iizvnulREKSSDphwCch2IPKMX5soTuk/8 M5nTW7uGc/lb7+bABXg8sKMvNR0aS5pg4LRpWmo1l/TIJLdGdFmSk2pTqDFeP2lF64un t6vkwW1ZXaEyG5uVBcREgQiZJYReXs0Ln0YDt0Y2RrktD46lTc8AuW/dVwWhxv6zTPq6 aWZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737562502; x=1738167302; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=k6yifiK7k1egD832rtDY2X5ShBnrSfrr32YKaeunTC8=; b=cCoDse60TMrwVlzk6BO9mtK4ZYzuv88929KcoEhqqZKjQq9/Vhk6uJQeBahdoew+Jz qIhPu61Ihb95r3rvTAuPDNJ5GZv3tNiCDWormZg5MAzvbNTkyuiusHHrvs1rwvR2ei6w CJcubRCH1SqgMirZz3VGCAPSYNwi4SBicJ5n7V8SvdvYRZCKl0RhPoNGUxrlJ6JuaZF6 TpJ5HFjujFlwKggffYtb+Gh8czZBsycZGxBNUq/oSY8UM/oB9l/XvBq3az39J9PXFAsE joEagsBDSkWcFIDnnNpMqlqtuPe1QkopEReAh39LWQ7PWtixfXhrLX4wfiuXw0D9t/yF 87yg== X-Forwarded-Encrypted: i=1; AJvYcCWH4ayKbnQEGh33x1BIdNmLPURxsB5S4IvHCDUWzWMsYbGzSkT80xB32AcR0dcVhyfiASaQIv+g7jr0FOQ=@vger.kernel.org X-Gm-Message-State: AOJu0Ywn3LId3OH3AlFTOIQyCaK5GWK828OX1TaZqQR0ngpgysQpfl+T Blpz1vn9a8nBDdxIL2TyoC8vHKdqaKyJnENvcrOTv3vLjvRFYYP6R+lsA8Q+nrg= X-Gm-Gg: ASbGncuGqoVnH6Vpwq7K2exJ1l0YvcDW+EBkdDSlZuUjOKOKMwZy6aCfOy81I4+1+xy BK+UkZjQ8c1WHItjUdiN3htpAvA9SoBy5Xu8nD6Rv/r341QzzgMla6DeMvARBGnUtj74WK5NlU2 6259xr6H8vupHcQzH/FdoCBnMOZ4wNpEUg9T+hEIBD8sxUHB+VxOn/hK122aSHetWv7cziLn/Fr sUpasVvd8eGVExI8HdsWVNohesmEOVJnB4itpjegsIJA81Qmfw7tRLJ2l/Ga2mgd1U6XCIVYmCw rQe+ht9fXw== X-Google-Smtp-Source: AGHT+IHjMS8YRSk6XzW0Efeh0A/XzjKRZHlKqwNXg3TUjzGuKVwVdcPgC6qrdd/tzzJ2CrO/z5EPcw== X-Received: by 2002:a05:600c:4ecb:b0:434:ff45:cbbe with SMTP id 5b1f17b1804b1-438913f5c63mr219797095e9.18.1737562501952; Wed, 22 Jan 2025 08:15:01 -0800 (PST) Received: from [192.168.0.101] ([90.241.98.187]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438b1718741sm20115825e9.0.2025.01.22.08.15.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Jan 2025 08:15:01 -0800 (PST) Message-ID: Date: Wed, 22 Jan 2025 16:14:59 +0000 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/sched: Use struct for drm_sched_init() params To: Boris Brezillon , Philipp Stanner Cc: Alex Deucher , =?UTF-8?Q?Christian_K=C3=B6nig?= , 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?Q?Ma=C3=ADra_Canal?= , Lucas De Marchi , =?UTF-8?Q?Thomas_Hellstr=C3=B6m?= , 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 References: <20250122140818.45172-3-phasta@kernel.org> <20250122165104.536c4143@collabora.com> Content-Language: en-GB From: Tvrtko Ursulin In-Reply-To: <20250122165104.536c4143@collabora.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 = { > .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;