Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp969586rdh; Fri, 27 Oct 2023 00:18:21 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFcvxEsXbYjrAPgbmwniyqkKZUsV0w1SXJUXmuVfz2Zx+k7Tkjwdj+/R/Tt5d25fpLfy/Qu X-Received: by 2002:a25:b11f:0:b0:d9b:4b94:adf5 with SMTP id g31-20020a25b11f000000b00d9b4b94adf5mr1849287ybj.14.1698391100874; Fri, 27 Oct 2023 00:18:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698391100; cv=none; d=google.com; s=arc-20160816; b=c2RjeVgAKcOtv27AeSdVlWF44SkT7Oe6MQ3QVkPhkX2rr96+ExnWBaLwXPSELl9HdF NdjPGw70IGbaswNiwiGZj7z8UpdBx0C/9835wMrFqzKF6TlG0PZ/eGldHiI8rzlWCfdu lqpLpYKJrB/HgS+CDi3N5ZvjNl0GGpN3Tmg5Uws2p1kEExb6jJJHJ0AjXKksy46Ag5Ri oj229XRHLjot5toxyc1pR/RYiDY9NB2S+c5YpbHEVsLkDTeG3K3lFgK+8HE4SVN1dq+8 sdeCMVFOOktPNtNp2zrZUrNfkhUHoCxCwEtVaj8WNrty3RCprFOiUSWZfdFqqdiXUw7g qglA== 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=Yt8uOeA2D3p2UCBu1akBpiqRKewDStkIuTKjJ0D36do=; fh=98Zn0Qam1Yt/Xf5Mbs6eB9yFj0PpyoXLvb00ayxBwNw=; b=H+KfyL27HuONMXd6OW9/f0PNC+Va4xfLwo50LcC8ElLflug8JTXP3VXM1+vkj/Wwzz J8Gcsl9MjfFGYVoxjBHxGG9djrpci1plPsw12NMDSfirXHPBtkhoPUhm80fhFgIv3Wje Z6NjP9ohPVudoLRPTCHwrfk8YNFv7w+Cy9zexS92vEcsWrUNsjl/30GPEMjezcFItjFU e8b/bGxhkT6d6jtqGP/J8w7dqOYde6s/67nVyyvERFtVau+JgWFyTmBC0I9kfl07AkaK BSs6grNAY4e20PmvkUBZGeqlCPjbkzKKqgXr2uR9V09w/sFkE2/2CVMhKizep1uuExVm uyXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=iYXmJ00v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id t24-20020a252d18000000b00d71bf89f0fasi1942676ybt.491.2023.10.27.00.18.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 00:18:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=iYXmJ00v; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 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 agentk.vger.email (Postfix) with ESMTP id 6B70281F7081; Fri, 27 Oct 2023 00:18:18 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235017AbjJ0HSM (ORCPT + 99 others); Fri, 27 Oct 2023 03:18:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235010AbjJ0HSI (ORCPT ); Fri, 27 Oct 2023 03:18:08 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C59F61BD for ; Fri, 27 Oct 2023 00:18:00 -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 B1EB066072FC; Fri, 27 Oct 2023 08:17:58 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1698391079; bh=w/e9oob7hOM84wZctGqMXlvAjyoXB4ZayuMpg1DFtoo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=iYXmJ00v795Yr+zDHJDGbHzhx2cS3to1OcLA4ajP8OjGJia2t36WLicmzsOY9p5Ki c4FwassYWQTyjXskC82OSEDK8xt6l4/fAbJX/6K8klh8vvSQ0+fV8sLD8tJpbuo8Wu JmXD4xnw/9ZOJmgrUyow6JTLDWwTcd+aOSSPmSUSUB87xm9CZrwfRVwUTrazg9TXkc MxGXHnG3mobJzWqN4nUd68XGJlMOM+Ty5rI9YBol5/BQC5UhYTj/PYoV2rOpFFKLZa Ef0ROodFZJb4+CC35AvtD2cL+0B8R5W3gbKd1h0aYO/VpxTcsHGEGEAwLcZLBH2m2D tS7n10mQNpzmw== Date: Fri, 27 Oct 2023 09:17:55 +0200 From: Boris Brezillon To: Danilo Krummrich Cc: airlied@gmail.com, daniel@ffwll.ch, matthew.brost@intel.com, christian.koenig@amd.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: <20231027091755.3635be36@collabora.com> In-Reply-To: <20231026161431.5934-1-dakr@redhat.com> References: <20231026161431.5934-1-dakr@redhat.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=US-ASCII Content-Transfer-Encoding: 7bit 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 agentk.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 (agentk.vger.email [0.0.0.0]); Fri, 27 Oct 2023 00:18:18 -0700 (PDT) Hi Danilo, On Thu, 26 Oct 2023 18:13:00 +0200 Danilo Krummrich wrote: > + > + /** > + * @update_job_credits: Called once the scheduler is considering this > + * job for execution. > + * > + * Drivers may use this to update the job's submission credits, which 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 credits > + * 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); I'm copying my late reply to v2 here so it doesn't get lost: I keep thinking it'd be simpler to make this a void function that updates s_job->submission_credits directly. I also don't see the problem with doing a sanity check on job->submission_credits. I mean, if the driver is doing something silly, you can't do much to prevent it anyway, except warn the user that something wrong has happened. If you want to WARN_ON(job->submission_credits == 0 || job->submission_credits > job_old_submission_credits); that's fine. But none of this sanity checking has to do with the function prototype/semantics, and I'm still not comfortable with this 0 => no-change. If there's no change, we should just leave job->submission_credits unchanged (or return job->submission_credits) instead of inventing a new special case. Regards, Boris