Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp1205499rdh; Fri, 27 Oct 2023 07:36:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH68ir6qnzrMpPLoLwdlDIZS8Q/glw5Z+Nzo/e0vStjOoHiMVwJcB3bCYq9VDck19l/HV/L X-Received: by 2002:a81:4143:0:b0:5a7:d86c:988 with SMTP id f3-20020a814143000000b005a7d86c0988mr2691808ywk.28.1698417369348; Fri, 27 Oct 2023 07:36:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698417369; cv=none; d=google.com; s=arc-20160816; b=0P4pUssSTKfB1MDX9CBUmFUxGP3CN43u2FHeNutXK5IxUSHMJcID8rcXNhtGFF+xpr lZC1foirvB/NK5P99VUCUaCE5JFQ6fOwJRMH/N+b4VTrrh19fGhOrJ4pFjyU75bkcpHb yHe9BUrSqaQgFd05MxZv8kCklqJM4K7OpNR3JceCTOkwAd8K8bNQHwsoHEAyv1ndhj3G ZrNPN6iCdbd/L9d3y879HdBdXhjxyTmE6E3/10HnZjagNBMVIAkktSFbduSCPsBLAYj1 eUQzC2dnt2nGrMxiiWJCa9Vh7G6NFHs2LTg1hfJchGnFqk/alLauo+Mm6NzlNzjUHEV1 Y56w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=K5sokQZCAq452GDyZ2Dqlvt2GWiPurBujB1LiUqRJs0=; fh=Z2l6gwglC13g4tgMLpTTxxi8yNv90/sFIvYvQD2+NvE=; b=IZ1MTcZqg9iICVbS7NWuuqiAkWcbKvtNdNui96ZI9dMqGanSjoIFjUvvpsjiY2n2dw LdKQtYBLRCNhU8gIkzyb8nJxrmabyz1OCwn+wPNpvgDvBnaXUiLQK3zjGRrxeE5/r3TY 69Za3FjgfcL2oy5fS3hqjWnEm6HUiI0uW572LqlVgLr2PZkEj/RyL7TQeKs+oEKWS7JN igdpagL1Znn/l/mx1KMFbdaeZx6WQcX6FMLbV3K1Aj200KfBwFJbOfmpnbHB7DveUyZk n18sCC9+Jthip+OWTVyuDNaPoUcxs5k+kD63G89bwlBu7apr0xCWapQJ1MxgDaW1cUFo N+xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QVJUdEDd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id f68-20020a0ddc47000000b005a7b4f9ba80si2695640ywe.170.2023.10.27.07.36.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 07:36:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QVJUdEDd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 00F5F82F7BBF; Fri, 27 Oct 2023 07:35:40 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346118AbjJ0Of2 (ORCPT + 99 others); Fri, 27 Oct 2023 10:35:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1346103AbjJ0OfZ (ORCPT ); Fri, 27 Oct 2023 10:35:25 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D505B128 for ; Fri, 27 Oct 2023 07:34:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1698417275; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=K5sokQZCAq452GDyZ2Dqlvt2GWiPurBujB1LiUqRJs0=; b=QVJUdEDd3JiJrOoDDqgECyRyBdOJZqliJYm39KjZws7iscRowU6YG4NjCyRNNBy1MYXrcQ cz2dchhwQcdsD8OVYcFp9+kTxE6cxQC757W5mT37EkcIfwIoU8SB5hCbtHlUtSsx8a8HtE DYJuyDIIa4pUkTRlsTPk90v3AJ+Fl/g= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-450-4A29D8LTND6ATl80FSXkKw-1; Fri, 27 Oct 2023 10:34:29 -0400 X-MC-Unique: 4A29D8LTND6ATl80FSXkKw-1 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-32df2fc01e8so2216103f8f.0 for ; Fri, 27 Oct 2023 07:34:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698417268; x=1699022068; h=content-transfer-encoding:in-reply-to:organization:from:references :cc:to:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=K5sokQZCAq452GDyZ2Dqlvt2GWiPurBujB1LiUqRJs0=; b=pAcPyFM4h4cT9JD5oH0Qc0fMUNf87yT8ttNSmRRfKbafb+orUqFypI/ol+qkUTFjIZ FaO1cJR2G9v+TxMtjb5U4JukSUrOBzY+ktWDA0nApfMUM0lyaWmOweSln7lrTTv9mX9Q c8UHjKzErU2GqvQkiCmWKGH4KjERDnTgFp7Zt+1NRgmv7HYEzNVl3CoPjbTL7ryDb2yR ZwYvD0vNHGFVikf4HBKEOS6jqAHdFPbfDauEWw1ZmMiRANvdcg9FBL6bvtsPVwjhoBWg v4gz372PkXiGAcUwU0PDBmnyqVDmZobkvaShikG+iniAyUGK465Vc0SJuEa0SgPiTEg0 fMOg== X-Gm-Message-State: AOJu0YxniX2VV8qMhHZ9Ti9E7+DEQQkWRDLisnN0KMFKHGFWamCXUTW9 4mISgDKxOitg1S66/yar5QkfB/dLTtj8IwTV0uu7EAis/L+W5d7W25dEEOGuwoAdS87zMxyeP+3 GgZmH4FjyK4zxEbGigPppObIH X-Received: by 2002:a5d:588f:0:b0:32f:7159:c5a with SMTP id n15-20020a5d588f000000b0032f71590c5amr2390253wrf.3.1698417267848; Fri, 27 Oct 2023 07:34:27 -0700 (PDT) X-Received: by 2002:a5d:588f:0:b0:32f:7159:c5a with SMTP id n15-20020a5d588f000000b0032f71590c5amr2390205wrf.3.1698417267417; Fri, 27 Oct 2023 07:34:27 -0700 (PDT) Received: from ?IPV6:2a02:810d:4b3f:de9c:abf:b8ff:feee:998b? ([2a02:810d:4b3f:de9c:abf:b8ff:feee:998b]) by smtp.gmail.com with ESMTPSA id i21-20020a05600c355500b00405959469afsm1799979wmq.3.2023.10.27.07.34.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 Oct 2023 07:34:27 -0700 (PDT) Message-ID: <794f9b45-db0d-4261-aefe-7da2ad0ed3b7@redhat.com> Date: Fri, 27 Oct 2023 16:34:26 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH drm-misc-next v3] drm/sched: implement dynamic job-flow control Content-Language: en-US To: Boris Brezillon 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 References: <20231026161431.5934-1-dakr@redhat.com> <20231027091755.3635be36@collabora.com> From: Danilo Krummrich Organization: RedHat In-Reply-To: <20231027091755.3635be36@collabora.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,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 fry.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 (fry.vger.email [0.0.0.0]); Fri, 27 Oct 2023 07:35:40 -0700 (PDT) On 10/27/23 09:17, Boris Brezillon wrote: > 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. If we can avoid letting drivers change fields of generic structures directly without any drawbacks I think we should avoid it. Currently, drivers shouldn't have the need to mess with job->credits directly. The initial value is set through drm_sched_job_init() and is updated through the return value of update_job_credits(). I'm fine getting rid of the 0 => no-change semantics though. Instead we can just WARN() on 0. However, if we do that I'd also want to change it for drm_sched_job_init() (where 0 currently defaults to 1) such that we accept 0, but WARN() accordingly. I think it's consequent to either consistently give 0 a different meaning or just accept it but WARN() on it. > > Regards, > > Boris >