Received: by 2002:a05:7412:a9a2:b0:e2:908c:2ebd with SMTP id o34csp997255rdh; Fri, 27 Oct 2023 01:25:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGIEZWOtcs5RUCFHtPLx9BMLBueo8lAYfXMTHoSp6vtfp/CDdFmr28EjplDguLxApgGtATd X-Received: by 2002:a81:9901:0:b0:5a7:b516:6eab with SMTP id q1-20020a819901000000b005a7b5166eabmr1859302ywg.15.1698395144113; Fri, 27 Oct 2023 01:25:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698395144; cv=none; d=google.com; s=arc-20160816; b=qOaX7BD3tA8hvJOETHHhlyZX34ncaWv365777zVRZlXAN+VHr4au+GiaSC9itiyO0q C0/mFFgo4MoALNicIm50WxgawNWiYVPkBmHUmXYnvn4/PJVxXQYd3Wz67NVoWMUasEaJ dHlMTVPL6YM+fnbchur3JNU4Oiblz3yashVDZYHG5NRgF1xh7DUkJTdMY5kTxa/Ye7Me Lw2Y42zeaoWVa4yyUe9zyv2TNctPAXTalO3G/EDmn6d2oDC6f8/YUGjA3Pi5FJFyHWYa CGzTqOl0/ZTcqdvH4JmkKJUkO2j8TvRZ/q9M/8UZcF5HNs3yX/pcbjrZ+/7JB8FaKON1 VlSQ== 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=HEC2cO8zZAMI83rYBE2ne65Oaa2nSqRSHlDtMtVBVmg=; fh=98Zn0Qam1Yt/Xf5Mbs6eB9yFj0PpyoXLvb00ayxBwNw=; b=pQfIEl3Sl8bhWk4poTpf8OwwHJK+MgVGQzIEp1hLBuhGXlSbS0rFRNBa6oqVcmEe1W MF9tvGqlgAfuLFM2pASCm9+11HN0gsjzqN6veHEeYYvBU62wpBa8VlQEngLJSYKyuICn G4ifQ7hvT1nvtgLvIG8AmafNbVJYSq1Iwi0gYfQVN0ky70J2HePOJDeEpkzkNUGtRC0z xXcNOBAQoOBAwEFUmj3aFX/IJkW9PzfO1JrS0jBNTJu4wvdL6VrKWsRTLJDUhlCyMeo9 0h43AixrFLANvKpbZHUNfPUSBDoOwLUDi1LuQSI2d6BkbOnxyn6jBRovTrjGcc4rdrXw A4DQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=IWAlPYFe; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id m6-20020a817106000000b005706a4e6a61si1916784ywc.150.2023.10.27.01.25.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Oct 2023 01:25:44 -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=@collabora.com header.s=mail header.b=IWAlPYFe; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 4E2D682ACADC; Fri, 27 Oct 2023 01:25: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 S235012AbjJ0IZZ (ORCPT + 99 others); Fri, 27 Oct 2023 04:25:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230101AbjJ0IZY (ORCPT ); Fri, 27 Oct 2023 04:25:24 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5C652186 for ; Fri, 27 Oct 2023 01:25:22 -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 83E6166072FC; Fri, 27 Oct 2023 09:25:20 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1698395121; bh=pwSE8EySk274RE11EYBjl8fVybeDlHkijimBPoX3cjA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=IWAlPYFeBQ7DoPJeMmsiL1pjhb2Lgk7i5Q/XZ13JyZhfayXGrnrvNveK4Pr6Ab3gT aSGTs6JoGHIEn6cC31nST/oVcKdK+q09LeY+3blChLsUn7QBtPlVA63z8ud7M8cm3N uLuIxuD9L71GCnXhXrX8k8HIVpbujOzTCqV5/Y9G5KjcC/5MCh1w4no1ipgYDak4Sz U6ImevqRFMao63ITp4MP8Zy5a4Kth8xWzMerfOmug9SXBUbzpUuKKaA62nwwZO6fg9 f8+Q/av2Kf+/BuKnV3LqAMH6L8zDpaLE+bEcy9GzkT5uyuO7auNMY+upOxidOCKunE 40yemLwyFNK5A== Date: Fri, 27 Oct 2023 10:25:16 +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: <20231027102516.0e4b00ef@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 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 01:25:40 -0700 (PDT) Hi Danilo, On Thu, 26 Oct 2023 18:13:00 +0200 Danilo Krummrich wrote: > Currently, job flow control is implemented simply by limiting the number > of jobs in flight. Therefore, a scheduler is initialized with a credit > limit that corresponds to the number of jobs which can be sent to the > hardware. > > This implies that for each job, drivers need to account for the maximum > job size possible in order to not overflow the ring buffer. > > However, there are drivers, such as Nouveau, where the job size has a > rather large range. For such drivers it can easily happen that job > submissions not even filling the ring by 1% can block subsequent > submissions, which, in the worst case, can lead to the ring run dry. > > In order to overcome this issue, allow for tracking the actual job size > instead of the number of jobs. Therefore, add a field to track a job's > credit count, which represents the number of credits a job contributes > to the scheduler's credit limit. > > Signed-off-by: Danilo Krummrich > --- > Changes in V2: > ============== > - fixed up influence on scheduling fairness due to consideration of a job's > size > - If we reach a ready entity in drm_sched_select_entity() but can't actually > queue a job from it due to size limitations, just give up and go to sleep > until woken up due to a pending job finishing, rather than continue to try > other entities. > - added a callback to dynamically update a job's credits (Boris) This callback seems controversial. I'd suggest dropping it, so the patch can be merged. Regards, Boris > - renamed 'units' to 'credits' > - fixed commit message and comments as requested by Luben > > Changes in V3: > ============== > - rebased onto V7 of the "DRM scheduler changes for Xe" series by Matt > - move up drm_sched_can_queue() instead of adding a forward declaration > (Boris) > - add a drm_sched_available_credits() helper (Boris) > - adjust control flow in drm_sched_rq_select_entity_fifo() to Luben's proposal > - re-phrase a few comments and fix a typo (Luben) > - change naming of all structures credit fields and function parameters to the > following scheme > - drm_sched_job::credits > - drm_gpu_scheduler::credit_limit > - drm_gpu_scheduler::credit_count > - drm_sched_init(..., u32 credit_limit, ...) > - drm_sched_job_init(..., u32 credits, ...) > - add proper documentation for the scheduler's job-flow control mechanism