From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B5358C25B67 for ; Fri, 27 Oct 2023 07:44:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BB3EB10E94A; Fri, 27 Oct 2023 07:44:23 +0000 (UTC) Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam02on2077.outbound.protection.outlook.com [40.107.212.77]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4751D10E94A for ; Fri, 27 Oct 2023 07:44:21 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FNAw099E5KypmeQYJSSgIGnAoqs5zuBOe3nCch3k7i/bdfI/3mOdU+itEq3beorecHN31MqKygAjR6yuhSGDmlZlfQczl1j+03XbpZE4tDN5FD5C41BNsFMD8ClfP7w/oIOjAJrXXCpqCRJcc4EAogpuXHYNKl7xmt9dYSJjizGL0lCEXKlEy+K/WWrabT9oqCVD+K7yfXMhsBQ54cNU0YdV/H9BtDCJqkUtxIQyEyMZVIyNFDNhWyEzPELoxZ8Zq7K4Gs72bl1i2wI5w8h/qgRo4h3HLXJGSrfl4x+DrzgiKbIoDTwP+Szg5aHut3Z7R9JLSMN3TCrEIfCjN0rDdQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qqdDz20LA5Vo1wghUfJ8+siLsyDgUfosHmZrfvEvnHU=; b=G7I2hvjMGL9JDpdtDsV2cE/PyJ49lDBSCqcs4wWHK7KQ/+vCIc1c4ExZ/TP0TxVymkySSsy3L42eK05doJ1CM+RyDAGgOfrulGeOV/J1JKBZLp7YN4ST1swBn0Gt+Hgoa6dbYlH7zuusOu7S2gQonBm/s//wUSWlu1+/mKL66LSnIiQLUuEYfwsBUy2rAnq8lzdvnqBIrpHKUBKvxuO6bGgFtB/R3jFe2C+9vDWquPl8PQtzomeiGZlHL4vzsycr854RQPPUvArM0HaldiS+dGhNIvn0gKskmWJRvIfLS7iead053HpEZTC09QsRUvz2iNhItNLRagYXjLW7luS4JQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qqdDz20LA5Vo1wghUfJ8+siLsyDgUfosHmZrfvEvnHU=; b=abk5V33+96UEdf/MJ6jnVvDNMKGbKtce0hkUy6VO5A8m+0Os3trZIH0ECGnx4y1JY4Wvvre+Nm3AXPycr7HCrsjCU7NWYeWJkb/zZfESB2n5AO9Gh7huLpu+Pf4YO5n/G1bvoBoGkN5SCCSCEO1DyYxANo9paKRXeYC/2sPFEX4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BN8PR12MB3587.namprd12.prod.outlook.com (2603:10b6:408:43::13) by CH2PR12MB4183.namprd12.prod.outlook.com (2603:10b6:610:7a::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6933.24; Fri, 27 Oct 2023 07:44:18 +0000 Received: from BN8PR12MB3587.namprd12.prod.outlook.com ([fe80::af19:f731:8846:68ba]) by BN8PR12MB3587.namprd12.prod.outlook.com ([fe80::af19:f731:8846:68ba%6]) with mapi id 15.20.6907.032; Fri, 27 Oct 2023 07:44:18 +0000 Content-Type: multipart/alternative; boundary="------------dMnlhcUZQ6ouYZQNeoYlc0nF" Message-ID: <98988459-25a8-4ee0-89d4-cb816cbc5bef@amd.com> Date: Fri, 27 Oct 2023 09:44:13 +0200 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 References: <20231026161431.5934-1-dakr@redhat.com> <0bc79ae3-04fe-4e85-9fd0-e8b281148390@amd.com> <20231027093238.2ff8172e@collabora.com> <20231027093943.3f0ae992@collabora.com> From: =?UTF-8?Q?Christian_K=C3=B6nig?= In-Reply-To: <20231027093943.3f0ae992@collabora.com> X-ClientProxiedBy: FR2P281CA0109.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:9c::8) To BN8PR12MB3587.namprd12.prod.outlook.com (2603:10b6:408:43::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8PR12MB3587:EE_|CH2PR12MB4183:EE_ X-MS-Office365-Filtering-Correlation-Id: 797d155b-cb13-4fba-7c0b-08dbd6c0866a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bw7uKT//MDReOtfdz1yj8jI6YIDpGlxi2p+EbszNd+J+Y3qx/yZ1JzoinUviQEAxAjNxPSnl47VUFyiHHDbQSQSB3JbMuzDEztXCKfp2yDENEsVWYeMXow51BLw7MB1XrinX5+m+jqPfXXtM47b6vATk3Rz+ehh8xlxs341H7/DEwCaPF4G4XD0/TqJdQQilghBEjeCJH+t7lN/GAmKbcYqkQdoiNRMamxSnQ6MUCcAx+aB1cNXObA3qQIk3eytvUhR9nhXf/MItfv6ER9RatNbaUkovemkZTEiiotZfqlglp/DFayOD87CeqcgLPypCKLtNOiX32jiTm/guUsbL6biTMPTMfoed6a3W57TxREq4PS8w3hYRl02WAiFJXQR3pU8EOG7LfbH0ST5nEEsjleivqIQUoknqlX1gNXqPEdQLUJ/LazgF4PnDK6Agj6l/cqUL69ttspFhl27Z2k9OwF7mrXgINYlJm+NASoXU+OAEEdcZtHNAEAPY+i2bPVHe15G63pWjKlIwWoVStKoL7pHPWyU4NZJfAmY9kKllQfCM0kQ4RMAN0r51VXaLq7qABrwrd+kTaPOB59nl6IMHdRMHCxfYsYj9AOyvuRlu8XvONiMqZJwzgTt9n/u7kRcVcLNl/lKcZud0OscsAVC/4w== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:BN8PR12MB3587.namprd12.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(136003)(39860400002)(396003)(346002)(376002)(366004)(230922051799003)(186009)(1800799009)(64100799003)(451199024)(66574015)(6486002)(83380400001)(26005)(478600001)(6506007)(6666004)(33964004)(2616005)(6512007)(66556008)(66946007)(66476007)(6916009)(316002)(38100700002)(31686004)(86362001)(41300700001)(31696002)(5660300002)(36756003)(8676002)(8936002)(4326008)(2906002)(43740500002)(45980500001); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?SnNCeWN2MTVrQjF2ZS9WeG9BMExUTDlyckxwZ3YxSnBaWHo0UWl5KzJzbmli?= =?utf-8?B?eU8vUDhIL1pCTmtWZnVobVBJM3U1dDZtdFhVdjZwczdZaXk0RitzU29ZdVdI?= =?utf-8?B?UzY1RE9TT1RhRzdZN1dQVDhYcHphNytCK2NKS2plaEMzOVF5SnMwTVRrZHNi?= =?utf-8?B?YkZJTnFma2JSeFlWaGU0SGJUSlhFajdjc0RRZ01oQmNUeEpQUWJZS1lEMkQr?= =?utf-8?B?bFRUVTlhcHZFZkdxWWZISFpJcVZKMnFZ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WkwYzB1M3ZjbnFGY0xKc1BpMERCWDlKczhhZHRzeXV3MHJrUitEYThaL013?= =?utf-8?Q?3uxop0drS4bluiBJldzJdPr25?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 797d155b-cb13-4fba-7c0b-08dbd6c0866a X-MS-Exchange-CrossTenant-AuthSource: BN8PR12MB3587.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Oct 2023 07:44:18.2210 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 2gyL6rbTjxJ+Z1XQc7SYKpQyeRRuac4SaagyGcRnqN8UpJDglkKnLb4axY+U+0HT X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4183 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: matthew.brost@intel.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, faith@gfxstrand.net, luben.tuikov@amd.com, Danilo Krummrich Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" --------------dMnlhcUZQ6ouYZQNeoYlc0nF Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Am 27.10.23 um 09:39 schrieb Boris Brezillon: > On Fri, 27 Oct 2023 09:35:01 +0200 > Christian König wrote: > >> Am 27.10.23 um 09:32 schrieb Boris Brezillon: >>> On Fri, 27 Oct 2023 09:22:12 +0200 >>> Christian König 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); >>>> 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 >>> we need this credit-update to happen every time a job is considered for >>> execution by the scheduler. >> But the job is only considered for execution once. How do you see that >> 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. Well, that is the handling which I already rejected because it creates unfairness between processes. When you consider the credits needed *before* scheduling jobs with a lower credit count are always preferred over jobs with a higher credit count. What you can do is to look at the credits of a job *after* it was picked up for scheduling so that you can scheduler more jobs. Regards, Christian. --------------dMnlhcUZQ6ouYZQNeoYlc0nF Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit Am 27.10.23 um 09:39 schrieb Boris Brezillon:
On Fri, 27 Oct 2023 09:35:01 +0200
Christian König <christian.koenig@amd.com> wrote:

Am 27.10.23 um 09:32 schrieb Boris Brezillon:
On Fri, 27 Oct 2023 09:22:12 +0200
Christian König <christian.koenig@amd.com> 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);  
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  
we need this credit-update to happen every time a job is considered for
execution by the scheduler.  
But the job is only considered for execution once. How do you see that 
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.

Well, that is the handling which I already rejected because it creates unfairness between processes. When you consider the credits needed *before* scheduling jobs with a lower credit count are always preferred over jobs with a higher credit count.
What you can do is to look at the credits of a job *after* it was picked up for scheduling so that you can scheduler more jobs.

Regards,
Christian.
--------------dMnlhcUZQ6ouYZQNeoYlc0nF--