Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp977838rdh; Fri, 27 Oct 2023 00:40:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEv5t3ubt5goGotduNrSWKC/Vn14dHgjkxW7Ypyy7zhuTL3AzKh6ID3q4PwT+7pixMyT1AP X-Received: by 2002:a05:6902:1083:b0:da0:5370:fdce with SMTP id v3-20020a056902108300b00da05370fdcemr2198422ybu.19.1698392399771; Fri, 27 Oct 2023 00:39:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698392399; cv=none; d=google.com; s=arc-20160816; b=oHebXxIJL9AzQIz+OIG1q9LhDwVFiL2CFC0PyMV6hlta4GdjIX7+58y1FfHmY5BziU 1hPVZV/ejRJ5ne5BlwfeIz23wtsmojk3xZUET83yGF0beCERGarjkgCXC6IiXLXYpaOQ HKgKq68nH0XI9VjA4uCzgVPHFS7SQP+yXDk07kDeT+zJeTllvhEko2ukVPg+yt54qCnK lnmeeptb5PY5OQzlnjoQgRMoS7l2utLDRxOP+X4J9saI58jLx0ML6JX1hTPZMkt2YHFQ mYH529Kgxfj0f+RY46VK9r7C+LvOdAXdWKw4Zak+TGrZ6EUPYcOE0eqRSJT/t7InmyVn f71Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature; bh=moZ5NNoLvVI0bSRBSbBq0BLBWiRctHEtB/Cp+3MLIQY=; fh=vrgJW1VhCPqPLEEDQsxZRhOMLzx0mp7pBNPGhI6Xs/M=; b=KEx6CCNPO06TSimbKcCfGbpRhIzUxGexlaDbTLOJ15FjZkwRxEczz+ZhRBlHmwilhs u4TZdaVIsO1ga9T+RA/Fp2yMHxZjgqDySF90TMzasxV0RFUwd2nf3OVaWAJfy2fRthdp YJEEHjQqsWtFA352wR1+UEBqf7/j3MuDBdcxhvGKDb02yfZWAheDR9lA4gGfhCcR02rh HA9NJ1OAz4m8NG4WTEEmHYi1JIuCS1d5FjsFlEhCslkl66UCFeQqnmqoktTrQ8glTF8V MLzBXWJ6qZQieC7PuhFo0nS0Y1O9EpWptO+qREHYV6oYYqiFaLSyqNWxl42KPGwXYcaq kbZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=VcHWNHOX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id 206-20020a2505d7000000b00da04074e22esi1746949ybf.374.2023.10.27.00.39.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 00:39:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=VcHWNHOX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id F34F58328AFF; Fri, 27 Oct 2023 00:39:56 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345405AbjJ0Hjv (ORCPT + 99 others); Fri, 27 Oct 2023 03:39:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234963AbjJ0Hju (ORCPT ); Fri, 27 Oct 2023 03:39:50 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e5ab]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7700194 for ; Fri, 27 Oct 2023 00:39:48 -0700 (PDT) Received: from localhost (cola.collaboradmins.com [195.201.22.229]) (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 madras.collabora.co.uk (Postfix) with ESMTPSA id 0152666071F1; Fri, 27 Oct 2023 08:39:46 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1698392387; bh=j45biqkfxRiKG00fpgi7uRwnU46+FHWSLAeTKnn0EII=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=VcHWNHOXH+xh8+ZPNn4nQ3e2lFSd1AAuIZeXgZv4WMZVx/R1JOdoAB9PsQMtESjju wxwaSWYeCYciC0jijwlw98b7551TGzfOC07JpyqfHSMoBNqi55pzBfpf8er5ge+2NJ 7PBGMRsJztf5fmUoJFFM28rNGCfOUELnLt0/3ygXbfksf2JmZF8FSQY+zGicvoYh3r DrNa5Tmz4hQDh0oCVEftINMYQwxMH2bs0SBQd2iSpJ7LSFQYMYH1GTuSx4E+W2urTX sr+qiIo6SfVvb0a/pPoYKtEW5v8OboTv4LCZKpJSkvVPj/NlvGVmdgUfWc9cGNpym8 yKeAjgAVANyQQ== Date: Fri, 27 Oct 2023 09:39:43 +0200 From: Boris Brezillon To: Christian =?UTF-8?B?S8O2bmln?= Cc: Danilo Krummrich , airlied@gmail.com, daniel@ffwll.ch, matthew.brost@intel.com, faith@gfxstrand.net, luben.tuikov@amd.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH drm-misc-next v3] drm/sched: implement dynamic job-flow control Message-ID: <20231027093943.3f0ae992@collabora.com> In-Reply-To: References: <20231026161431.5934-1-dakr@redhat.com> <0bc79ae3-04fe-4e85-9fd0-e8b281148390@amd.com> <20231027093238.2ff8172e@collabora.com> Organization: Collabora X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 27 Oct 2023 00:39:57 -0700 (PDT) On Fri, 27 Oct 2023 09:35:01 +0200 Christian K=C3=B6nig wrote: > Am 27.10.23 um 09:32 schrieb Boris Brezillon: > > On Fri, 27 Oct 2023 09:22:12 +0200 > > Christian K=C3=B6nig wrote: > > =20 > >>> + > >>> + /** > >>> + * @update_job_credits: Called once the scheduler is considering th= is > >>> + * job for execution. > >>> + * > >>> + * Drivers may use this to update the job's submission credits, whi= ch is > >>> + * useful to e.g. deduct the number of native fences which have been > >>> + * signaled meanwhile. > >>> + * > >>> + * The callback must either return the new number of submission cre= dits > >>> + * for the given job, or zero if no update is required. > >>> + * > >>> + * This callback is optional. > >>> + */ > >>> + u32 (*update_job_credits)(struct drm_sched_job *sched_job); =20 > >> Why do we need an extra callback for this? > >> > >> Just document that prepare_job() is allowed to reduce the number of > >> credits the job might need. > > ->prepare_job() is called only once if the returned fence is NULL, but = =20 > > we need this credit-update to happen every time a job is considered for > > execution by the scheduler. =20 >=20 > But the job is only considered for execution once. How do you see that=20 > this is called multiple times? Nope, it's not. If drm_sched_can_queue() returns false, the scheduler will go look for another entity that has a job ready for execution, and get back to this entity later, and test drm_sched_can_queue() again. Basically, any time drm_sched_can_queue() is called, the job credits update should happen, so we have an accurate view of how many credits this job needs.