From patchwork Fri Dec 8 20:27:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 13485832 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 473CDC10DCE for ; Fri, 8 Dec 2023 20:28:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0360810EB2F; Fri, 8 Dec 2023 20:28:05 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.20]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1F04810EB24; Fri, 8 Dec 2023 20:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702067282; x=1733603282; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=IixOSWjAJv/undmhiNikPlZXzxpZFGVYQcZ7AWEL9sI=; b=P7jivz7VZC4S8RPkKyzhclSvmTudFlTyIku6AURhi8GHgy4B+XYdjxfl k/9IfpBB3kzQXbSJEWJO6QIrhQpPLzLKyWQerkaOt76ZTnpkx7A3QWANd GE3OebClm1sseoAdJHFMj5AakKGF8tujLr7BKE+GIYNUQrRIgMF5maN4h eqJBtf4S3DZeP9Nudz/GJ4bk/kE3Ah7OKqK7CxvZpOb3ldWOWyet2f/D7 EVymY4R6gJ7/CtjW4EKm2rroeO+mS14ztIH15Q16F4zDuNsqZPsoNYACV vox/Es0IgbNZVm343a/pH4Yf6t89z2psmuSqwKbQiwl7Pr+Ea6sf6SNFH Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10918"; a="384870165" X-IronPort-AV: E=Sophos;i="6.04,261,1695711600"; d="scan'208";a="384870165" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2023 12:27:59 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10918"; a="1019466195" X-IronPort-AV: E=Sophos;i="6.04,261,1695711600"; d="scan'208";a="1019466195" Received: from orsmsx603.amr.corp.intel.com ([10.22.229.16]) by fmsmga006.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 08 Dec 2023 12:27:59 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX603.amr.corp.intel.com (10.22.229.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 8 Dec 2023 12:27:58 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Fri, 8 Dec 2023 12:27:58 -0800 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (104.47.55.169) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 8 Dec 2023 12:27:58 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IxSauHbX96YXxcJbF3aLa7tg9/iZceOm8TfBNt11r7bQzLNi+9VbGEA3ngsjUI5g1wcuMGa05vHREnrlIwO6gWCHQ3fk8TC/RvY63lf4QNUHjOgpAwJNj01z1wS4kgMNrGMRcipYfv9RUpIkh/7QY3WpdiUxQ5i7uwJRrxtAY3EYvl2OrbLy/kC07m4qismD09joncCYgKDQuZK2RfkNdGm+qf8otTKYb1IhD3giEW39uL9Hnp5X8abyjkNbMSHmii/ChQZ9aVFJ3HFrJrxrYwyTl5ggOs1XTKpiUuylWSj31qylTaHS+RYyp6PbHYitSmnBfFT8pLH8uyTaFOgtBQ== 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=cxYfbRuayPBa65eJ7NrCpnNxpfyemY/4C/O00Ii2rDc=; b=CoWQRcnnFw06YKfd+PL9f7tWldo+997wgYl9JitUFxtUZ2LI2KIcB16vwMky6tSzj+SaFryLmv1dUH/NZjtltLmKMFxgNEbNvPeSayHei/0qUQADnfrohl3+WRRmeE2VJE7JpO/J3RH6fQqLXXXeg04qPTrvZ24Zu5iIF8f80NjB0pbq8ozeOJoucK446+H3b3q68J9MFLJGFT6he/lmPuI3JOyfB7LK5WU9r7Nx2Lt4k9YF/zRnlkMmBuclWAFNhGizfbfQQ6DWnxr776wLOAp9eyI+j13lemNVjc4a3e5lgO5gThzV89fJMVpZwXoCejXKb4zY3hYbRPAOSME6Lg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) by PH7PR11MB8527.namprd11.prod.outlook.com (2603:10b6:510:2ff::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.28; Fri, 8 Dec 2023 20:27:56 +0000 Received: from MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::ada2:f954:a3a5:6179]) by MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::ada2:f954:a3a5:6179%5]) with mapi id 15.20.7068.027; Fri, 8 Dec 2023 20:27:56 +0000 From: Rodrigo Vivi To: Subject: [PATCH 10/13] drm/sched: Rename priority MIN to LOW Date: Fri, 8 Dec 2023 15:27:20 -0500 Message-ID: <20231208202723.918082-10-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231208202723.918082-1-rodrigo.vivi@intel.com> References: <20231208202723.918082-1-rodrigo.vivi@intel.com> X-ClientProxiedBy: BY5PR17CA0046.namprd17.prod.outlook.com (2603:10b6:a03:167::23) To MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN0PR11MB6059:EE_|PH7PR11MB8527:EE_ X-MS-Office365-Filtering-Correlation-Id: eb65f5f4-990e-4dc6-2275-08dbf82c298a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ljjH9oXmDWrE8I7zVGbv/8SPGsb/pr0wbCSaJ/Hf3/vTMYDSmZO5G2sxo40ZosfjX8ccmASEsax3OhoJ5HsejZHDVHExw0yHDjpAfLbL4bdEmU2y935Y5YBGCBEz/FIPQ/YzzUcmbLemJfkqvegxgrzJtc0+piFGK28X6G9LSUY0RAfcHh/JmZMCgDpxznOynQqcR7/GVKb6E8U3YznRt+3xGSzSCsVoAGPQ2gHD3RPnyoUf0tc7NMfFyeeW+8jVWmlN9mOOIxx4vw65BknuZ74ZUiH06zJMpCYIt9fYeA5vjAmARZ9v6oUdfs/fpLMrdFwI0W5+v/SFg0kisy0A8pG5Mmz84BEl5ocyEj76rmYjK8stq6PWGN4/LuXHKI9HhtAdVYfJJqApbWw6TKXR0IOh5q0pZrdBh3TryC9TvmOovx2Fjh2XBjYoBxdpMZBCY80c16NPQq3/KBvI5BiMeBEM35H9UFLyW2+JmREapUPBzgGY0PlG4DK1opqVnHXqVGLjMlPrdMy+nWHuIFfp9BlDxQeXu4zQxYt/xkgFWn4= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN0PR11MB6059.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(346002)(136003)(39860400002)(230922051799003)(186009)(451199024)(1800799012)(64100799003)(6506007)(26005)(66574015)(6512007)(2616005)(1076003)(83380400001)(41300700001)(4326008)(8676002)(8936002)(2906002)(7416002)(44832011)(5660300002)(478600001)(6666004)(66946007)(66556008)(316002)(54906003)(66476007)(6916009)(6486002)(966005)(82960400001)(38100700002)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?9AsXFu66DyGmjH4+C9y5KdFNl5sT?= =?utf-8?q?MxSje2w8iVz0xAixTKWmvVSg64riKGdndOhNc1HP3+AI52LyT/WtBZ6D/AdY2hIxn?= =?utf-8?q?7pZbdojs1Ul2Py3b3gg7KRYjZeqZCLE5eq/wDzvfcH1T53YfWlnlHIx2RV/HTOhzv?= =?utf-8?q?klDTX1ilTEEe6ya5DfoY5EBZvOvn/O712/5zSgzaWdiNnMnKK3pAyIzvcNXDlSzPd?= =?utf-8?q?AWUV52iThQQe8LIUhszbMZRAtiGPJkABpwdch3O23TZ1U7hJThfCuCURg66t0L+/H?= =?utf-8?q?skz0bEhbHFbtn5YkGZVn//k9OjNfi8F2Uld2GOfvYw/Cj1XoYivRaRU/w1GzKd7GE?= =?utf-8?q?C+PlIoSFT7cgjDYaRPzM+DyEgIn08+KcCnoKLJdMbnYMM/eS/OeEJugTZxa+AZG9V?= =?utf-8?q?ufESUv0C900BVEQROmMe5InTU3KADUqfKHig3G3DKqaAT7AG+MoRFx+wl/Bokmo63?= =?utf-8?q?jWKArJAIAoN/kfjb9iZTQJyHrFw108MQAhb9gdpusecxq25lGzYEDOc8CRAk5xgcK?= =?utf-8?q?Nt4KipJF2/OJIUp6l5I8LfXODDvuFtap7gWJaWYed/gk5wELjTeQVfquR2dG4LocZ?= =?utf-8?q?cF1nar2V3br/1mM+KNnpUGhrrMoM3DLAlO2nAyimFnKk++Ip2TpvKcvgXSTA5ba7d?= =?utf-8?q?3XsoyJJtN45zFGsB2BKqxZfpR4vQwUtvb4SDmzni5ybKemqDEJKF80vMGRHBVTPDH?= =?utf-8?q?MgRuutjYnRBtgbIy+nWojgYMQ2yrJSX2N0t7ImMgclVM0Vt+Z3shHJmuq8cO2rNyl?= =?utf-8?q?M+N1rs8lA8ZsYG6wiZuEV37p7D6xKugspt8XAoB18wP+H6D4rrZRgT4+zTP9gFd1m?= =?utf-8?q?xRNGzlMKbEovHWDxrqlCaJrI/awUGnr94tAGckAoInPVe0gSUzvpDfZ8IXUoWiV0f?= =?utf-8?q?TPqlyYFuglvnn4pkOwP+RMN53inUt+cU6lQT8SNKoRZJnaj9VJCQvivQahQkg8QCz?= =?utf-8?q?nNaw5e1idlXhJIxKWrR0S7Ey88pzBFU4KLNH9iCKNids6z26Ak5BmJr0bc9QLLZrO?= =?utf-8?q?99tHA7CK6KswxkHI5DzGlMTP5iS61G0jkB5rnrUDd8MIlbDIPojRaO/N7O68yFF6n?= =?utf-8?q?2run/FtqZeUE200/aHzHSlRREw3gFHRzF0VedEGlQvwjzmcKOVGDT+u4u6VmEKCmp?= =?utf-8?q?O7cZn4NdwoJOb6iuwi8ZWoDIVNYX9euaMixH180g+ffqLD078BoLKEW84Lzql9rWK?= =?utf-8?q?hMfhQqXHA1qp4UPP/OCRF/6x4vtm0noa4wnfBkNAMJmNE8pcrHT1I+LC4GH+2Cm/1?= =?utf-8?q?0roNGagXWKpjTb5NSG63i3s6YrHcxQo8HSq5yrOBX+W4PbaG55p7cUZmgaSx1LuGi?= =?utf-8?q?yFfKpRRAPPa6lw42sBwMO6OHRn9vnYesN7+6kperizJEBknMdLotxhvZ+6i5LY/Vt?= =?utf-8?q?6JZBYIvYGOXkV1OrQxPS6AalMkEO3yqqKVBv2jcwHmRlrge/5XZii+GXA5M2qDugi?= =?utf-8?q?0PSyVsSFCgrEerlGu7AW5zXCGPci+y5uJ5xlLF4mHrBeEshHc/EZq+tdKKbEQAwgn?= =?utf-8?q?nY4BkIYfLITG9uZdlrab/2jmBIPsRj5Cjg=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: eb65f5f4-990e-4dc6-2275-08dbf82c298a X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6059.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2023 20:27:56.4181 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: T+44CBKAbTGFJr1qwTBW60vzpHCX4FCF3MDJ29mFKxOmtrLyBF06sOB+bzM/1BrZ7r6V+rTp5EsA5i2k4DziTQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB8527 X-OriginatorOrg: intel.com 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: Luben Tuikov , linux-arm-msm@vger.kernel.org, Abhinav Kumar , dri-devel@lists.freedesktop.org, Alex Deucher , Danilo Krummrich , Dmitry Baryshkov , freedreno@lists.freedesktop.org, =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Luben Tuikov Rename DRM_SCHED_PRIORITY_MIN to DRM_SCHED_PRIORITY_LOW. This mirrors DRM_SCHED_PRIORITY_HIGH, for a list of DRM scheduler priorities in ascending order, DRM_SCHED_PRIORITY_LOW, DRM_SCHED_PRIORITY_NORMAL, DRM_SCHED_PRIORITY_HIGH, DRM_SCHED_PRIORITY_KERNEL. Cc: Rob Clark Cc: Abhinav Kumar Cc: Dmitry Baryshkov Cc: Danilo Krummrich Cc: Alex Deucher Cc: Christian König Cc: linux-arm-msm@vger.kernel.org Cc: freedreno@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Signed-off-by: Luben Tuikov Reviewed-by: Christian König Link: https://patchwork.freedesktop.org/patch/msgid/20231124052752.6915-5-ltuikov89@gmail.com (cherry picked from commit fe375c74806dbd30b00ec038a80a5b7bf4653ab7) --- drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 2 +- drivers/gpu/drm/msm/msm_gpu.h | 2 +- drivers/gpu/drm/scheduler/sched_entity.c | 2 +- drivers/gpu/drm/scheduler/sched_main.c | 10 +++++----- include/drm/gpu_scheduler.h | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c index fb050345b9f2..d46786618061 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c @@ -68,10 +68,10 @@ amdgpu_ctx_to_drm_sched_prio(int32_t ctx_prio) return DRM_SCHED_PRIORITY_NORMAL; case AMDGPU_CTX_PRIORITY_VERY_LOW: - return DRM_SCHED_PRIORITY_MIN; + return DRM_SCHED_PRIORITY_LOW; case AMDGPU_CTX_PRIORITY_LOW: - return DRM_SCHED_PRIORITY_MIN; + return DRM_SCHED_PRIORITY_LOW; case AMDGPU_CTX_PRIORITY_NORMAL: return DRM_SCHED_PRIORITY_NORMAL; diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c index 62bb7fc7448a..1a25931607c5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c @@ -325,7 +325,7 @@ void amdgpu_job_stop_all_jobs_on_sched(struct drm_gpu_scheduler *sched) int i; /* Signal all jobs not yet scheduled */ - for (i = sched->num_rqs - 1; i >= DRM_SCHED_PRIORITY_MIN; i--) { + for (i = sched->num_rqs - 1; i >= DRM_SCHED_PRIORITY_LOW; i--) { struct drm_sched_rq *rq = sched->sched_rq[i]; spin_lock(&rq->lock); list_for_each_entry(s_entity, &rq->entities, list) { diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h index 4252e3839fbc..eb0c97433e5f 100644 --- a/drivers/gpu/drm/msm/msm_gpu.h +++ b/drivers/gpu/drm/msm/msm_gpu.h @@ -347,7 +347,7 @@ struct msm_gpu_perfcntr { * DRM_SCHED_PRIORITY_KERNEL priority level is treated specially in some * cases, so we don't use it (no need for kernel generated jobs). */ -#define NR_SCHED_PRIORITIES (1 + DRM_SCHED_PRIORITY_HIGH - DRM_SCHED_PRIORITY_MIN) +#define NR_SCHED_PRIORITIES (1 + DRM_SCHED_PRIORITY_HIGH - DRM_SCHED_PRIORITY_LOW) /** * struct msm_file_private - per-drm_file context diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c index ee645d38e98d..dd2b8f777f51 100644 --- a/drivers/gpu/drm/scheduler/sched_entity.c +++ b/drivers/gpu/drm/scheduler/sched_entity.c @@ -88,7 +88,7 @@ int drm_sched_entity_init(struct drm_sched_entity *entity, drm_err(sched_list[0], "entity with out-of-bounds priority:%u num_rqs:%u\n", entity->priority, sched_list[0]->num_rqs); entity->priority = max_t(s32, (s32) sched_list[0]->num_rqs - 1, - (s32) DRM_SCHED_PRIORITY_MIN); + (s32) DRM_SCHED_PRIORITY_LOW); } entity->rq = sched_list[0]->sched_rq[entity->priority]; } diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index 044a8c4875ba..b6d7bc49ff6e 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -1052,7 +1052,7 @@ drm_sched_select_entity(struct drm_gpu_scheduler *sched) int i; /* Kernel run queue has higher priority than normal run queue*/ - for (i = sched->num_rqs - 1; i >= DRM_SCHED_PRIORITY_MIN; i--) { + for (i = sched->num_rqs - 1; i >= DRM_SCHED_PRIORITY_LOW; i--) { entity = drm_sched_policy == DRM_SCHED_POLICY_FIFO ? drm_sched_rq_select_entity_fifo(sched, sched->sched_rq[i]) : drm_sched_rq_select_entity_rr(sched, sched->sched_rq[i]); @@ -1291,7 +1291,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, if (!sched->sched_rq) goto Out_free; sched->num_rqs = num_rqs; - for (i = DRM_SCHED_PRIORITY_MIN; i < sched->num_rqs; i++) { + for (i = DRM_SCHED_PRIORITY_LOW; i < sched->num_rqs; i++) { sched->sched_rq[i] = kzalloc(sizeof(*sched->sched_rq[i]), GFP_KERNEL); if (!sched->sched_rq[i]) goto Out_unroll; @@ -1312,7 +1312,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, sched->ready = true; return 0; Out_unroll: - for (--i ; i >= DRM_SCHED_PRIORITY_MIN; i--) + for (--i ; i >= DRM_SCHED_PRIORITY_LOW; i--) kfree(sched->sched_rq[i]); Out_free: kfree(sched->sched_rq); @@ -1338,7 +1338,7 @@ void drm_sched_fini(struct drm_gpu_scheduler *sched) drm_sched_wqueue_stop(sched); - for (i = sched->num_rqs - 1; i >= DRM_SCHED_PRIORITY_MIN; i--) { + for (i = sched->num_rqs - 1; i >= DRM_SCHED_PRIORITY_LOW; i--) { struct drm_sched_rq *rq = sched->sched_rq[i]; spin_lock(&rq->lock); @@ -1390,7 +1390,7 @@ void drm_sched_increase_karma(struct drm_sched_job *bad) if (bad->s_priority != DRM_SCHED_PRIORITY_KERNEL) { atomic_inc(&bad->karma); - for (i = DRM_SCHED_PRIORITY_MIN; + for (i = DRM_SCHED_PRIORITY_LOW; i < min_t(typeof(sched->num_rqs), sched->num_rqs, DRM_SCHED_PRIORITY_KERNEL); i++) { struct drm_sched_rq *rq = sched->sched_rq[i]; diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index 9a50348bd5c0..d8e2d84d9223 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h @@ -63,7 +63,7 @@ struct drm_file; * to an array, and as such should start at 0. */ enum drm_sched_priority { - DRM_SCHED_PRIORITY_MIN, + DRM_SCHED_PRIORITY_LOW, DRM_SCHED_PRIORITY_NORMAL, DRM_SCHED_PRIORITY_HIGH, DRM_SCHED_PRIORITY_KERNEL, From patchwork Fri Dec 8 20:27:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Rodrigo Vivi X-Patchwork-Id: 13485833 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 AA33BC4167B for ; Fri, 8 Dec 2023 20:28:14 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D5D2510EB39; Fri, 8 Dec 2023 20:28:06 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9B36310EB24; Fri, 8 Dec 2023 20:28:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702067283; x=1733603283; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=xPE88XMR18cBAWwksVzY4av2NPZOQ8vhfqBb4/paogQ=; b=gtXBG0/Opnjcn4jCrjD5euoUyenqpgxCZ1ZKJkmYzo6FdEeLT7jYhXII l97o+MZ5l+n+x5t29dvoy/4jY3ZA6ejAEtiw5n1Jv+TyXGW1ksRj535l8 XB8Q3rmPTISTnIDjsSq6v79V2WeY2YD+fh/49YpNtHsY+XZOlQoKuwNaW cdL8vCcanC7Hh0xNK2/BYzMFvMQmZibrnGLYkM2SpOj57N6H9fkUBWTyZ WRctToG56DhtTMsTOUi0zfZ6W5kEFeFsCNXTLGiKA7VmjRjisCM5ThMzk S2B/XmhpHAw1dowNPjyr+mRXPgAHw2gJWGjn9CPfdP3YQ7P1YaarKxfEL w==; X-IronPort-AV: E=McAfee;i="6600,9927,10918"; a="398324720" X-IronPort-AV: E=Sophos;i="6.04,261,1695711600"; d="scan'208";a="398324720" Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 08 Dec 2023 12:28:03 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10918"; a="895657496" X-IronPort-AV: E=Sophos;i="6.04,261,1695711600"; d="scan'208";a="895657496" Received: from orsmsx601.amr.corp.intel.com ([10.22.229.14]) by orsmga004.jf.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 08 Dec 2023 12:28:03 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 8 Dec 2023 12:28:02 -0800 Received: from orsmsx610.amr.corp.intel.com (10.22.229.23) by ORSMSX610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Fri, 8 Dec 2023 12:28:02 -0800 Received: from ORSEDG601.ED.cps.intel.com (10.7.248.6) by orsmsx610.amr.corp.intel.com (10.22.229.23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35 via Frontend Transport; Fri, 8 Dec 2023 12:28:02 -0800 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.169) by edgegateway.intel.com (134.134.137.102) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Fri, 8 Dec 2023 12:28:02 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jFbAQvd4Y/mx+tLPQsbrBlLyunmvzfQZS+bxjHC+oMjn2M8AJQX4AXymflD4tSv4rqRnjdXFc5I1TzME+C8bzjg6j6lEBTeOJ5gDCAbdzrPtwsNp9onA8l9lOMzXfhCuR+vk6PwccJqUO9ARdQiMfilG9YI+sbn3Txmjlo0hD48vJq1ceYbMDDTqT6grQbPidF0KyAOBsnTN9fgzkmgk41hZq1jUCJ9zsFVgR9ycAJKxdhMHD93WFli/WlFu5cJ7yGEJ+xKEQMA8s/juHK7bhSI9Yu1H/D5gDEgMV5TZRGI5JUJhqSllvd0apasA7xV55CmsvZmUO7ZDIq6rnZjQdw== 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=uSiPIcHQzio4p+2WeTEfmN0qPCRIK2kt4LTYj2qxBKw=; b=IgUhm+KH8cEsnq44b3F4cU785d2bsPAGkxAM1VR7a7f0iNOVjbHA1xc1dbuKNKC2Oi8Kqm2iEHG4vvPr/AoTvERzT/7y+UVpgPTdUCP2n2WJI9mtGhNFOxOT7mm6fyrtiSj/7CbGfCVaEUzdu6qw2sZKydIMIqFbss3zZEQ5UkVDq1XdyWGpS3WlxGp7JXjlOcdzo9c3xEvApWsabL7B+jo+iLJ8vTNHrsCyb8khHdMOw9itxnObJBCMo7I5nv0STuyhYPcyKFqFtja52wwAJKrEfTkg4JyRZmdi9th6XwV5KXqkibyXOGM2h7p6M6tsntXicMlbD+GUh5U+M4ap0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) by PH7PR11MB8527.namprd11.prod.outlook.com (2603:10b6:510:2ff::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7068.28; Fri, 8 Dec 2023 20:28:00 +0000 Received: from MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::ada2:f954:a3a5:6179]) by MN0PR11MB6059.namprd11.prod.outlook.com ([fe80::ada2:f954:a3a5:6179%5]) with mapi id 15.20.7068.027; Fri, 8 Dec 2023 20:28:00 +0000 From: Rodrigo Vivi To: Subject: [PATCH 11/13] drm/sched: Reverse run-queue priority enumeration Date: Fri, 8 Dec 2023 15:27:21 -0500 Message-ID: <20231208202723.918082-11-rodrigo.vivi@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231208202723.918082-1-rodrigo.vivi@intel.com> References: <20231208202723.918082-1-rodrigo.vivi@intel.com> X-ClientProxiedBy: SJ0PR05CA0108.namprd05.prod.outlook.com (2603:10b6:a03:334::23) To MN0PR11MB6059.namprd11.prod.outlook.com (2603:10b6:208:377::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN0PR11MB6059:EE_|PH7PR11MB8527:EE_ X-MS-Office365-Filtering-Correlation-Id: 30728e30-bf1c-45f9-f916-08dbf82c2ba4 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 18VLjUZGsXi7gVwLENe1IzL1VQ2EDd6ENKG+OOIiMRR7doesUSz+VE//O0pDjYbFqgBzOE1KB9eQifabdvjmGcSwCeG8rAWFEAyZd8VNt6DoAaaQvxEL6hlz/9XbA3iNrdJ0xcMdOMLSWmw49SfpLrTYF9FnyVyN0kADQq8frUAAasp0Gvo2nwL2FZAvTywSz+Cnf9imQb4jQ7AwMgy/IpcuXzKZRWKR5oDRk9gBuYWS+CpwXfDoLrb0VkDf0izgoZiTBpQs4l7Ubzd8NHOvnktG2BOpvgQXm9RP19Z8VMTQbcMUap5F3t3Z9tJJuB8lode2Nd17ZSLoNLXji9feDk3KeHILfxc3tVzKm+SWnnkOgNLhr7ZP1KP3aLFMvog94mFpCSCg1PQlRRnXoza39mwp/w8sgKe4JyYX2FQASOZ5Hf/E0IDgzi+5jXd7t54/XCNIxWZOrER2QJPRMyqnF2kQ8Qgz70Ty6AjZrbHHI1qlCflqtYB/dDv/z1bDwVkTMbcOLwdvKg350eVKJbfebNukgiYR2aljwuJcFxWKvDmVZQpYvGpFJ21L1npGTZER40OXsGzgpVq8ckmL6xEb/XisOHv5ckWefC7cNWg+ee0= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:MN0PR11MB6059.namprd11.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(396003)(366004)(376002)(346002)(136003)(39860400002)(230273577357003)(230173577357003)(230922051799003)(186009)(451199024)(1800799012)(64100799003)(6506007)(26005)(66574015)(6512007)(2616005)(1076003)(83380400001)(41300700001)(4326008)(8676002)(8936002)(2906002)(7416002)(44832011)(5660300002)(478600001)(6666004)(66946007)(66556008)(316002)(54906003)(66476007)(6916009)(6486002)(966005)(82960400001)(38100700002)(86362001)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?laEVuNS0rRdA5rThIWz/Brn4Bjo7?= =?utf-8?q?OlJr93BVl/En+TwimHE8KSKPoAfJ3a+CYoVMkxBe1DTIEawIsc8gZOWNg7sgiUcP3?= =?utf-8?q?fTA3SbjSkLYS3IRyXjDmJ9L8x6NISvwAoxikaKjR+ZojyTHvXvybXHLkBJXejQmqA?= =?utf-8?q?ZNLerRMobtcLLrHcnk06sHwHIh9ztOha6OpqIoIfkFsZRt5mPSaI7qzfQu5IyaiCF?= =?utf-8?q?mgCpdxXEJUqL9/FbWjjTGzrMYKM8gvPQtRzZXrdswAkvTYuBJbsKaQdlhy51rkbTy?= =?utf-8?q?rlbQi+IZkD6ssej5aq+K27i+QBPqXsyRTmzwGDZiNJrGjnR6GYjMfi5HqU/MMhBLT?= =?utf-8?q?tgxv/CC8aJrSkM5WgOeM4joLqUlc+9MdNJe+RDZRMQJnvFpJRR7GQVXTAAsSpnZw2?= =?utf-8?q?3tabnSEjrvk1svDQLzKdw6LoP3CGeCrAbDneWs5sMBuGtG7jxeb9NJlLhhBwu66tL?= =?utf-8?q?0f3KIFrIXl3K8nE60iSlhxETV8ssO0QDVN1OE0/HX30Z/l2cBx6FxZz8TyH4AOrAu?= =?utf-8?q?wiDH3DrD+zY6VUAUoNjmlGTTEtaSCD5PDZOlcxRkjo1SRdnRFgZijhm/SNer73x22?= =?utf-8?q?wgwH4EGcMah2C7uzjjzDRKB8hLE60ZhhWR4zD0H04XVdFyUuUNlVmR2H+ip0nh0ov?= =?utf-8?q?S8ZQQ+dfciunIF3L9Ur17pfpYDSVSp+0m3RL0kZRaarXquKhe/711k1FP7h+xt9hf?= =?utf-8?q?xVbzbwW9LOmNG58gFLlwsqCfBLWzzrtDuaX7QafPPLhk09JdcZvYBuY6kHZA2uB4y?= =?utf-8?q?FW8qr1aukQ1xeugC/+2f5f4Pte9EBUBHgxOXBDWzuy6zWaQvkYop1EXRnItNnbLc2?= =?utf-8?q?0AYvPU28sjWf2T3NgVwq0ccJsJQzOAvUUHeXbDH4EWfoH6o/y3Iw/YDsof5UpKHff?= =?utf-8?q?r6a1fpuy18hBbWvmx6cXnIrJhw/fP141mE86uYX5+Fy772Imy+HBS5t5Kmd1my/Y8?= =?utf-8?q?jvZmxCVKxwjB3uO9XnGwG1NLAdzo1BbRBxJt/bWcCQO2cmT7EFqHtmf2OewsKwGrd?= =?utf-8?q?0IiafszkKPI9GSjfvS8ZNwc/clI0Ti3sz3s00P1YDCXJBVqJZ8F+EVutn8JcSI0y9?= =?utf-8?q?0lYuTRw9O8j+HAuVGD65zhBz4BKeSGgcJj5qK0WSWn+aB+SBB6R4k7kaORMVcqQLe?= =?utf-8?q?QRe4TwpJyDfEdNrJQ+w4rkdIEWjWAVyBSewXXOKtVpntZ/njxyJMPP7OJBOK6J+F2?= =?utf-8?q?Ane5oW9RETk6QczSExG7Lzum47djQq8PQ5+gTrGa7ySLaNMV8MeLD7l+O4bftdiy1?= =?utf-8?q?bBRrW2Wf3KZXzvVEEo5qYuOfWXxyMmJoNLLXHT4eUPsl4gcOKo48RY1HbFZAmW1JZ?= =?utf-8?q?b3G2uxCcg5nvkVKxS7vfrx9lk627pU5IQU17X8snDxLIKlFXU62lrk+fN8US9XGON?= =?utf-8?q?CPhSYpOHToAuZ4dAdUnI3+pB9VaIhYM+5dKYfG9xKcve9bZ84uBVspoRpgIDD0bDJ?= =?utf-8?q?eJRta4UQw3SR6chGq6qF4ByAR5qBo4XvnhF33aPwmuGOK/cLbAWRBKoaq/BK4uFU/?= =?utf-8?q?rnaQWUHEh3dgPGgy0hEcIXg8nJuDYyqzzg=3D=3D?= X-MS-Exchange-CrossTenant-Network-Message-Id: 30728e30-bf1c-45f9-f916-08dbf82c2ba4 X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6059.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Dec 2023 20:28:00.0358 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: SshOPqQ6U2l60saHg/cGM3Ri8el6x9boBPsGF3RbOwIZRTzZd5PbIRi2XfRjWioZq1IEiLVa8DfAqRRjfR1IJQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR11MB8527 X-OriginatorOrg: intel.com 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: Luben Tuikov , linux-arm-msm@vger.kernel.org, Abhinav Kumar , dri-devel@lists.freedesktop.org, Alex Deucher , Danilo Krummrich , Dmitry Baryshkov , freedreno@lists.freedesktop.org, =?utf-8?q?Christian_K=C3=B6nig?= Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Luben Tuikov Reverse run-queue priority enumeration such that the higest priority is now 0, and for each consecutive integer the prioirty diminishes. Run-queues correspond to priorities. To an external observer a scheduler created with a single run-queue, and another created with DRM_SCHED_PRIORITY_COUNT number of run-queues, should always schedule sched->sched_rq[0] with the same "priority", as that index run-queue exists in both schedulers, i.e. a scheduler with one run-queue or many. This patch makes it so. In other words, the "priority" of sched->sched_rq[n], n >= 0, is the same for any scheduler created with any allowable number of run-queues (priorities), 0 to DRM_SCHED_PRIORITY_COUNT. Cc: Rob Clark Cc: Abhinav Kumar Cc: Dmitry Baryshkov Cc: Danilo Krummrich Cc: Alex Deucher Cc: Christian König Cc: linux-arm-msm@vger.kernel.org Cc: freedreno@lists.freedesktop.org Cc: dri-devel@lists.freedesktop.org Signed-off-by: Luben Tuikov Reviewed-by: Christian König Link: https://patchwork.freedesktop.org/patch/msgid/20231124052752.6915-6-ltuikov89@gmail.com (cherry picked from commit 38f922a563aac3148ac73e73689805917f034cb5) --- drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 2 +- drivers/gpu/drm/msm/msm_gpu.h | 2 +- drivers/gpu/drm/scheduler/sched_entity.c | 5 +++-- drivers/gpu/drm/scheduler/sched_main.c | 15 +++++++-------- include/drm/gpu_scheduler.h | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c index 1a25931607c5..71a5cf37b472 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c @@ -325,7 +325,7 @@ void amdgpu_job_stop_all_jobs_on_sched(struct drm_gpu_scheduler *sched) int i; /* Signal all jobs not yet scheduled */ - for (i = sched->num_rqs - 1; i >= DRM_SCHED_PRIORITY_LOW; i--) { + for (i = DRM_SCHED_PRIORITY_KERNEL; i < sched->num_rqs; i++) { struct drm_sched_rq *rq = sched->sched_rq[i]; spin_lock(&rq->lock); list_for_each_entry(s_entity, &rq->entities, list) { diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h index eb0c97433e5f..2bfcb222e353 100644 --- a/drivers/gpu/drm/msm/msm_gpu.h +++ b/drivers/gpu/drm/msm/msm_gpu.h @@ -347,7 +347,7 @@ struct msm_gpu_perfcntr { * DRM_SCHED_PRIORITY_KERNEL priority level is treated specially in some * cases, so we don't use it (no need for kernel generated jobs). */ -#define NR_SCHED_PRIORITIES (1 + DRM_SCHED_PRIORITY_HIGH - DRM_SCHED_PRIORITY_LOW) +#define NR_SCHED_PRIORITIES (1 + DRM_SCHED_PRIORITY_LOW - DRM_SCHED_PRIORITY_HIGH) /** * struct msm_file_private - per-drm_file context diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c index dd2b8f777f51..3c4f5a392b06 100644 --- a/drivers/gpu/drm/scheduler/sched_entity.c +++ b/drivers/gpu/drm/scheduler/sched_entity.c @@ -82,13 +82,14 @@ int drm_sched_entity_init(struct drm_sched_entity *entity, pr_warn("%s: called with uninitialized scheduler\n", __func__); } else if (num_sched_list) { /* The "priority" of an entity cannot exceed the number of run-queues of a - * scheduler. Protect against num_rqs being 0, by converting to signed. + * scheduler. Protect against num_rqs being 0, by converting to signed. Choose + * the lowest priority available. */ if (entity->priority >= sched_list[0]->num_rqs) { drm_err(sched_list[0], "entity with out-of-bounds priority:%u num_rqs:%u\n", entity->priority, sched_list[0]->num_rqs); entity->priority = max_t(s32, (s32) sched_list[0]->num_rqs - 1, - (s32) DRM_SCHED_PRIORITY_LOW); + (s32) DRM_SCHED_PRIORITY_KERNEL); } entity->rq = sched_list[0]->sched_rq[entity->priority]; } diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c index b6d7bc49ff6e..682aebe96db7 100644 --- a/drivers/gpu/drm/scheduler/sched_main.c +++ b/drivers/gpu/drm/scheduler/sched_main.c @@ -1051,8 +1051,9 @@ drm_sched_select_entity(struct drm_gpu_scheduler *sched) struct drm_sched_entity *entity; int i; - /* Kernel run queue has higher priority than normal run queue*/ - for (i = sched->num_rqs - 1; i >= DRM_SCHED_PRIORITY_LOW; i--) { + /* Start with the highest priority. + */ + for (i = DRM_SCHED_PRIORITY_KERNEL; i < sched->num_rqs; i++) { entity = drm_sched_policy == DRM_SCHED_POLICY_FIFO ? drm_sched_rq_select_entity_fifo(sched, sched->sched_rq[i]) : drm_sched_rq_select_entity_rr(sched, sched->sched_rq[i]); @@ -1291,7 +1292,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, if (!sched->sched_rq) goto Out_free; sched->num_rqs = num_rqs; - for (i = DRM_SCHED_PRIORITY_LOW; i < sched->num_rqs; i++) { + for (i = DRM_SCHED_PRIORITY_KERNEL; i < sched->num_rqs; i++) { sched->sched_rq[i] = kzalloc(sizeof(*sched->sched_rq[i]), GFP_KERNEL); if (!sched->sched_rq[i]) goto Out_unroll; @@ -1312,7 +1313,7 @@ int drm_sched_init(struct drm_gpu_scheduler *sched, sched->ready = true; return 0; Out_unroll: - for (--i ; i >= DRM_SCHED_PRIORITY_LOW; i--) + for (--i ; i >= DRM_SCHED_PRIORITY_KERNEL; i--) kfree(sched->sched_rq[i]); Out_free: kfree(sched->sched_rq); @@ -1338,7 +1339,7 @@ void drm_sched_fini(struct drm_gpu_scheduler *sched) drm_sched_wqueue_stop(sched); - for (i = sched->num_rqs - 1; i >= DRM_SCHED_PRIORITY_LOW; i--) { + for (i = DRM_SCHED_PRIORITY_KERNEL; i < sched->num_rqs; i++) { struct drm_sched_rq *rq = sched->sched_rq[i]; spin_lock(&rq->lock); @@ -1390,9 +1391,7 @@ void drm_sched_increase_karma(struct drm_sched_job *bad) if (bad->s_priority != DRM_SCHED_PRIORITY_KERNEL) { atomic_inc(&bad->karma); - for (i = DRM_SCHED_PRIORITY_LOW; - i < min_t(typeof(sched->num_rqs), sched->num_rqs, DRM_SCHED_PRIORITY_KERNEL); - i++) { + for (i = DRM_SCHED_PRIORITY_HIGH; i < sched->num_rqs; i++) { struct drm_sched_rq *rq = sched->sched_rq[i]; spin_lock(&rq->lock); diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h index d8e2d84d9223..5acc64954a88 100644 --- a/include/drm/gpu_scheduler.h +++ b/include/drm/gpu_scheduler.h @@ -63,10 +63,10 @@ struct drm_file; * to an array, and as such should start at 0. */ enum drm_sched_priority { - DRM_SCHED_PRIORITY_LOW, - DRM_SCHED_PRIORITY_NORMAL, - DRM_SCHED_PRIORITY_HIGH, DRM_SCHED_PRIORITY_KERNEL, + DRM_SCHED_PRIORITY_HIGH, + DRM_SCHED_PRIORITY_NORMAL, + DRM_SCHED_PRIORITY_LOW, DRM_SCHED_PRIORITY_COUNT };