From: Greg Kroah-Hartman Date: Mon, 7 Oct 2024 17:50:49 +0000 (+0200) Subject: 6.10-stable patches X-Git-Tag: v6.6.55~54 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f7f8598c1326316ed6116cf48e681b22415b16e6;p=thirdparty%2Fkernel%2Fstable-queue.git 6.10-stable patches added patches: drm-amd-display-add-hdr-workaround-for-specific-edp.patch drm-amd-display-fix-system-hang-while-resume-with-tbt-monitor.patch drm-amd-display-update-dml2-policy-enhancedprefetchscheduleaccelerationfinal-dcn35.patch drm-i915-gem-fix-bitwise-and-logical-and-mixup.patch drm-panthor-don-t-add-write-fences-to-the-shared-bos.patch drm-panthor-don-t-declare-a-queue-blocked-if-deferred-operations-are-pending.patch drm-panthor-fix-access-to-uninitialized-variable-in-tick_ctx_cleanup.patch drm-sched-add-locking-to-drm_sched_entity_modify_sched.patch drm-sched-always-increment-correct-scheduler-score.patch drm-sched-always-wake-up-correct-scheduler-in-drm_sched_entity_push_job.patch drm-sched-fix-dynamic-job-flow-control-race.patch --- diff --git a/queue-6.10/drm-amd-display-add-hdr-workaround-for-specific-edp.patch b/queue-6.10/drm-amd-display-add-hdr-workaround-for-specific-edp.patch new file mode 100644 index 00000000000..ba697d68674 --- /dev/null +++ b/queue-6.10/drm-amd-display-add-hdr-workaround-for-specific-edp.patch @@ -0,0 +1,79 @@ +From 05af800704ee7187d9edd461ec90f3679b1c4aba Mon Sep 17 00:00:00 2001 +From: Alex Hung +Date: Fri, 6 Sep 2024 11:39:18 -0600 +Subject: drm/amd/display: Add HDR workaround for specific eDP + +From: Alex Hung + +commit 05af800704ee7187d9edd461ec90f3679b1c4aba upstream. + +[WHY & HOW] +Some eDP panels suffer from flicking when HDR is enabled in KDE. This +quirk works around it by skipping VSC that is incompatible with eDP +panels. + +Link: https://gitlab.freedesktop.org/drm/amd/-/issues/3151 +Cc: Mario Limonciello +Cc: Alex Deucher +Reviewed-by: Rodrigo Siqueira +Signed-off-by: Alex Hung +Signed-off-by: Aurabindo Pillai +Tested-by: Daniel Wheeler +Signed-off-by: Alex Deucher +(cherry picked from commit 4d4257280d7957727998ef90ccc7b69c7cca8376) +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 11 ++++++++++- + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 4 ++++ + drivers/gpu/drm/amd/display/dc/dc_types.h | 1 + + 3 files changed, 15 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -6389,12 +6389,21 @@ create_stream_for_sink(struct drm_connec + if (stream->signal == SIGNAL_TYPE_DISPLAY_PORT || + stream->signal == SIGNAL_TYPE_DISPLAY_PORT_MST || + stream->signal == SIGNAL_TYPE_EDP) { ++ const struct dc_edid_caps *edid_caps; ++ unsigned int disable_colorimetry = 0; ++ ++ if (aconnector->dc_sink) { ++ edid_caps = &aconnector->dc_sink->edid_caps; ++ disable_colorimetry = edid_caps->panel_patch.disable_colorimetry; ++ } ++ + // + // should decide stream support vsc sdp colorimetry capability + // before building vsc info packet + // + stream->use_vsc_sdp_for_colorimetry = stream->link->dpcd_caps.dpcd_rev.raw >= 0x14 && +- stream->link->dpcd_caps.dprx_feature.bits.VSC_SDP_COLORIMETRY_SUPPORTED; ++ stream->link->dpcd_caps.dprx_feature.bits.VSC_SDP_COLORIMETRY_SUPPORTED && ++ !disable_colorimetry; + + if (stream->out_transfer_func.tf == TRANSFER_FUNCTION_GAMMA22) + tf = TRANSFER_FUNC_GAMMA_22; +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c +@@ -72,6 +72,10 @@ static void apply_edid_quirks(struct edi + DRM_DEBUG_DRIVER("Clearing DPCD 0x317 on monitor with panel id %X\n", panel_id); + edid_caps->panel_patch.remove_sink_ext_caps = true; + break; ++ case drm_edid_encode_panel_id('S', 'D', 'C', 0x4154): ++ DRM_DEBUG_DRIVER("Disabling VSC on monitor with panel id %X\n", panel_id); ++ edid_caps->panel_patch.disable_colorimetry = true; ++ break; + default: + return; + } +--- a/drivers/gpu/drm/amd/display/dc/dc_types.h ++++ b/drivers/gpu/drm/amd/display/dc/dc_types.h +@@ -178,6 +178,7 @@ struct dc_panel_patch { + unsigned int skip_avmute; + unsigned int mst_start_top_delay; + unsigned int remove_sink_ext_caps; ++ unsigned int disable_colorimetry; + }; + + struct dc_edid_caps { diff --git a/queue-6.10/drm-amd-display-fix-system-hang-while-resume-with-tbt-monitor.patch b/queue-6.10/drm-amd-display-fix-system-hang-while-resume-with-tbt-monitor.patch new file mode 100644 index 00000000000..d23cb1b68ca --- /dev/null +++ b/queue-6.10/drm-amd-display-fix-system-hang-while-resume-with-tbt-monitor.patch @@ -0,0 +1,50 @@ +From 52d4e3fb3d340447dcdac0e14ff21a764f326907 Mon Sep 17 00:00:00 2001 +From: Tom Chung +Date: Fri, 13 Sep 2024 15:44:40 +0800 +Subject: drm/amd/display: Fix system hang while resume with TBT monitor + +From: Tom Chung + +commit 52d4e3fb3d340447dcdac0e14ff21a764f326907 upstream. + +[Why] +Connected with a Thunderbolt monitor and do the suspend and the system +may hang while resume. + +The TBT monitor HPD will be triggered during the resume procedure +and call the drm_client_modeset_probe() while +struct drm_connector connector->dev->master is NULL. + +It will mess up the pipe topology after resume. + +[How] +Skip the TBT monitor HPD during the resume procedure because we +currently will probe the connectors after resume by default. + +Reviewed-by: Wayne Lin +Signed-off-by: Tom Chung +Signed-off-by: Fangzhi Zuo +Tested-by: Daniel Wheeler +Signed-off-by: Alex Deucher +(cherry picked from commit 453f86a26945207a16b8f66aaed5962dc2b95b85) +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c ++++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +@@ -758,6 +758,12 @@ static void dmub_hpd_callback(struct amd + return; + } + ++ /* Skip DMUB HPD IRQ in suspend/resume. We will probe them later. */ ++ if (notify->type == DMUB_NOTIFICATION_HPD && adev->in_suspend) { ++ DRM_INFO("Skip DMUB HPD IRQ callback in suspend/resume\n"); ++ return; ++ } ++ + link_index = notify->link_index; + link = adev->dm.dc->links[link_index]; + dev = adev->dm.ddev; diff --git a/queue-6.10/drm-amd-display-update-dml2-policy-enhancedprefetchscheduleaccelerationfinal-dcn35.patch b/queue-6.10/drm-amd-display-update-dml2-policy-enhancedprefetchscheduleaccelerationfinal-dcn35.patch new file mode 100644 index 00000000000..6299b572374 --- /dev/null +++ b/queue-6.10/drm-amd-display-update-dml2-policy-enhancedprefetchscheduleaccelerationfinal-dcn35.patch @@ -0,0 +1,38 @@ +From 0d5e5e8a0aa49ea2163abf128da3b509a6c58286 Mon Sep 17 00:00:00 2001 +From: Yihan Zhu +Date: Sat, 7 Sep 2024 13:25:19 -0400 +Subject: drm/amd/display: update DML2 policy EnhancedPrefetchScheduleAccelerationFinal DCN35 + +From: Yihan Zhu + +commit 0d5e5e8a0aa49ea2163abf128da3b509a6c58286 upstream. + +[WHY & HOW] +Mismatch in DCN35 DML2 cause bw validation failed to acquire unexpected DPP pipe to cause +grey screen and system hang. Remove EnhancedPrefetchScheduleAccelerationFinal value override +to match HW spec. + +Cc: Mario Limonciello +Cc: Alex Deucher +Reviewed-by: Charlene Liu +Signed-off-by: Yihan Zhu +Signed-off-by: Aurabindo Pillai +Tested-by: Daniel Wheeler +Signed-off-by: Alex Deucher +(cherry picked from commit 9dad21f910fcea2bdcff4af46159101d7f9cd8ba) +Cc: stable@vger.kernel.org +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/display/dc/dml2/dml2_policy.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/gpu/drm/amd/display/dc/dml2/dml2_policy.c ++++ b/drivers/gpu/drm/amd/display/dc/dml2/dml2_policy.c +@@ -303,7 +303,6 @@ void build_unoptimized_policy_settings(e + if (project == dml_project_dcn35 || + project == dml_project_dcn351) { + policy->DCCProgrammingAssumesScanDirectionUnknownFinal = false; +- policy->EnhancedPrefetchScheduleAccelerationFinal = 0; + policy->AllowForPStateChangeOrStutterInVBlankFinal = dml_prefetch_support_uclk_fclk_and_stutter_if_possible; /*new*/ + policy->UseOnlyMaxPrefetchModes = 1; + } diff --git a/queue-6.10/drm-i915-gem-fix-bitwise-and-logical-and-mixup.patch b/queue-6.10/drm-i915-gem-fix-bitwise-and-logical-and-mixup.patch new file mode 100644 index 00000000000..d8fb1bafbd2 --- /dev/null +++ b/queue-6.10/drm-i915-gem-fix-bitwise-and-logical-and-mixup.patch @@ -0,0 +1,48 @@ +From 394b52462020b6cceff1f7f47fdebd03589574f3 Mon Sep 17 00:00:00 2001 +From: Jani Nikula +Date: Wed, 18 Sep 2024 20:35:43 +0300 +Subject: drm/i915/gem: fix bitwise and logical AND mixup + +From: Jani Nikula + +commit 394b52462020b6cceff1f7f47fdebd03589574f3 upstream. + +CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND is an int, defaulting to 250. When +the wakeref is non-zero, it's either -1 or a dynamically allocated +pointer, depending on CONFIG_DRM_I915_DEBUG_RUNTIME_PM. It's likely that +the code works by coincidence with the bitwise AND, but with +CONFIG_DRM_I915_DEBUG_RUNTIME_PM=y, there's the off chance that the +condition evaluates to false, and intel_wakeref_auto() doesn't get +called. Switch to the intended logical AND. + +v2: Use != to avoid clang -Wconstant-logical-operand (Nathan) + +Fixes: ad74457a6b5a ("drm/i915/dgfx: Release mmap on rpm suspend") +Cc: Matthew Auld +Cc: Rodrigo Vivi +Cc: Anshuman Gupta +Cc: Andi Shyti +Cc: Nathan Chancellor +Cc: stable@vger.kernel.org # v6.1+ +Reviewed-by: Matthew Auld +Reviewed-by: Andi Shyti # v1 +Link: https://patchwork.freedesktop.org/patch/msgid/643cc0a4d12f47fd8403d42581e83b1e9c4543c7.1726680898.git.jani.nikula@intel.com +Signed-off-by: Jani Nikula +(cherry picked from commit 4c1bfe259ed1d2ade826f95d437e1c41b274df04) +Signed-off-by: Joonas Lahtinen +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/i915/gem/i915_gem_ttm.c ++++ b/drivers/gpu/drm/i915/gem/i915_gem_ttm.c +@@ -1131,7 +1131,7 @@ static vm_fault_t vm_fault_ttm(struct vm + GEM_WARN_ON(!i915_ttm_cpu_maps_iomem(bo->resource)); + } + +- if (wakeref & CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND) ++ if (wakeref && CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND != 0) + intel_wakeref_auto(&to_i915(obj->base.dev)->runtime_pm.userfault_wakeref, + msecs_to_jiffies_timeout(CONFIG_DRM_I915_USERFAULT_AUTOSUSPEND)); + diff --git a/queue-6.10/drm-panthor-don-t-add-write-fences-to-the-shared-bos.patch b/queue-6.10/drm-panthor-don-t-add-write-fences-to-the-shared-bos.patch new file mode 100644 index 00000000000..333fd7d8262 --- /dev/null +++ b/queue-6.10/drm-panthor-don-t-add-write-fences-to-the-shared-bos.patch @@ -0,0 +1,47 @@ +From f9e7ac6e2e9986c2ee63224992cb5c8276e46b2a Mon Sep 17 00:00:00 2001 +From: Boris Brezillon +Date: Thu, 5 Sep 2024 09:01:54 +0200 +Subject: drm/panthor: Don't add write fences to the shared BOs + +From: Boris Brezillon + +commit f9e7ac6e2e9986c2ee63224992cb5c8276e46b2a upstream. + +The only user (the mesa gallium driver) is already assuming explicit +synchronization and doing the export/import dance on shared BOs. The +only reason we were registering ourselves as writers on external BOs +is because Xe, which was the reference back when we developed Panthor, +was doing so. Turns out Xe was wrong, and we really want bookkeep on +all registered fences, so userspace can explicitly upgrade those to +read/write when needed. + +Fixes: 4bdca1150792 ("drm/panthor: Add the driver frontend block") +Cc: Matthew Brost +Cc: Simona Vetter +Cc: +Signed-off-by: Boris Brezillon +Reviewed-by: Steven Price +Reviewed-by: Liviu Dudau +Link: https://patchwork.freedesktop.org/patch/msgid/20240905070155.3254011-1-boris.brezillon@collabora.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/panthor/panthor_sched.c | 7 +------ + 1 file changed, 1 insertion(+), 6 deletions(-) + +--- a/drivers/gpu/drm/panthor/panthor_sched.c ++++ b/drivers/gpu/drm/panthor/panthor_sched.c +@@ -3436,13 +3436,8 @@ void panthor_job_update_resvs(struct drm + { + struct panthor_job *job = container_of(sched_job, struct panthor_job, base); + +- /* Still not sure why we want USAGE_WRITE for external objects, since I +- * was assuming this would be handled through explicit syncs being imported +- * to external BOs with DMA_BUF_IOCTL_IMPORT_SYNC_FILE, but other drivers +- * seem to pass DMA_RESV_USAGE_WRITE, so there must be a good reason. +- */ + panthor_vm_update_resvs(job->group->vm, exec, &sched_job->s_fence->finished, +- DMA_RESV_USAGE_BOOKKEEP, DMA_RESV_USAGE_WRITE); ++ DMA_RESV_USAGE_BOOKKEEP, DMA_RESV_USAGE_BOOKKEEP); + } + + void panthor_sched_unplug(struct panthor_device *ptdev) diff --git a/queue-6.10/drm-panthor-don-t-declare-a-queue-blocked-if-deferred-operations-are-pending.patch b/queue-6.10/drm-panthor-don-t-declare-a-queue-blocked-if-deferred-operations-are-pending.patch new file mode 100644 index 00000000000..3ebfb1d69de --- /dev/null +++ b/queue-6.10/drm-panthor-don-t-declare-a-queue-blocked-if-deferred-operations-are-pending.patch @@ -0,0 +1,51 @@ +From 7a1f30afe97294281a2ba05977688385744f9844 Mon Sep 17 00:00:00 2001 +From: Boris Brezillon +Date: Thu, 5 Sep 2024 09:19:14 +0200 +Subject: drm/panthor: Don't declare a queue blocked if deferred operations are pending + +From: Boris Brezillon + +commit 7a1f30afe97294281a2ba05977688385744f9844 upstream. + +If deferred operations are pending, we want to wait for those to +land before declaring the queue blocked on a SYNC_WAIT. We need +this to deal with the case where the sync object is signalled through +a deferred SYNC_{ADD,SET} from the same queue. If we don't do that +and the group gets scheduled out before the deferred SYNC_{SET,ADD} +is executed, we'll end up with a timeout, because no external +SYNC_{SET,ADD} will make the scheduler reconsider the group for +execution. + +Fixes: de8548813824 ("drm/panthor: Add the scheduler logical block") +Cc: +Signed-off-by: Boris Brezillon +Reviewed-by: Steven Price +Reviewed-by: Liviu Dudau +Link: https://patchwork.freedesktop.org/patch/msgid/20240905071914.3278599-1-boris.brezillon@collabora.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/panthor/panthor_sched.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c +index 145d983bb129..2aff02ba6949 100644 +--- a/drivers/gpu/drm/panthor/panthor_sched.c ++++ b/drivers/gpu/drm/panthor/panthor_sched.c +@@ -1103,7 +1103,13 @@ cs_slot_sync_queue_state_locked(struct panthor_device *ptdev, u32 csg_id, u32 cs + list_move_tail(&group->wait_node, + &group->ptdev->scheduler->groups.waiting); + } +- group->blocked_queues |= BIT(cs_id); ++ ++ /* The queue is only blocked if there's no deferred operation ++ * pending, which can be checked through the scoreboard status. ++ */ ++ if (!cs_iface->output->status_scoreboards) ++ group->blocked_queues |= BIT(cs_id); ++ + queue->syncwait.gpu_va = cs_iface->output->status_wait_sync_ptr; + queue->syncwait.ref = cs_iface->output->status_wait_sync_value; + status_wait_cond = cs_iface->output->status_wait & CS_STATUS_WAIT_SYNC_COND_MASK; +-- +2.46.2 + diff --git a/queue-6.10/drm-panthor-fix-access-to-uninitialized-variable-in-tick_ctx_cleanup.patch b/queue-6.10/drm-panthor-fix-access-to-uninitialized-variable-in-tick_ctx_cleanup.patch new file mode 100644 index 00000000000..3db40049984 --- /dev/null +++ b/queue-6.10/drm-panthor-fix-access-to-uninitialized-variable-in-tick_ctx_cleanup.patch @@ -0,0 +1,59 @@ +From 282864cc5d3f144af0cdea1868ee2dc2c5110f0d Mon Sep 17 00:00:00 2001 +From: Boris Brezillon +Date: Mon, 30 Sep 2024 18:37:42 +0200 +Subject: drm/panthor: Fix access to uninitialized variable in tick_ctx_cleanup() + +From: Boris Brezillon + +commit 282864cc5d3f144af0cdea1868ee2dc2c5110f0d upstream. + +The group variable can't be used to retrieve ptdev in our second loop, +because it points to the previously iterated list_head, not a valid +group. Get the ptdev object from the scheduler instead. + +Cc: +Fixes: d72f049087d4 ("drm/panthor: Allow driver compilation") +Reported-by: kernel test robot +Reported-by: Julia Lawall +Closes: https://lore.kernel.org/r/202409302306.UDikqa03-lkp@intel.com/ +Signed-off-by: Boris Brezillon +Reviewed-by: Liviu Dudau +Link: https://patchwork.freedesktop.org/patch/msgid/20240930163742.87036-1-boris.brezillon@collabora.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/panthor/panthor_sched.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/panthor/panthor_sched.c b/drivers/gpu/drm/panthor/panthor_sched.c +index a8a939a9fb51..145d983bb129 100644 +--- a/drivers/gpu/drm/panthor/panthor_sched.c ++++ b/drivers/gpu/drm/panthor/panthor_sched.c +@@ -2046,6 +2046,7 @@ static void + tick_ctx_cleanup(struct panthor_scheduler *sched, + struct panthor_sched_tick_ctx *ctx) + { ++ struct panthor_device *ptdev = sched->ptdev; + struct panthor_group *group, *tmp; + u32 i; + +@@ -2054,7 +2055,7 @@ tick_ctx_cleanup(struct panthor_scheduler *sched, + /* If everything went fine, we should only have groups + * to be terminated in the old_groups lists. + */ +- drm_WARN_ON(&group->ptdev->base, !ctx->csg_upd_failed_mask && ++ drm_WARN_ON(&ptdev->base, !ctx->csg_upd_failed_mask && + group_can_run(group)); + + if (!group_can_run(group)) { +@@ -2077,7 +2078,7 @@ tick_ctx_cleanup(struct panthor_scheduler *sched, + /* If everything went fine, the groups to schedule lists should + * be empty. + */ +- drm_WARN_ON(&group->ptdev->base, ++ drm_WARN_ON(&ptdev->base, + !ctx->csg_upd_failed_mask && !list_empty(&ctx->groups[i])); + + list_for_each_entry_safe(group, tmp, &ctx->groups[i], run_node) { +-- +2.46.2 + diff --git a/queue-6.10/drm-sched-add-locking-to-drm_sched_entity_modify_sched.patch b/queue-6.10/drm-sched-add-locking-to-drm_sched_entity_modify_sched.patch new file mode 100644 index 00000000000..e4075290116 --- /dev/null +++ b/queue-6.10/drm-sched-add-locking-to-drm_sched_entity_modify_sched.patch @@ -0,0 +1,52 @@ +From 4286cc2c953983d44d248c9de1c81d3a9643345c Mon Sep 17 00:00:00 2001 +From: Tvrtko Ursulin +Date: Fri, 13 Sep 2024 17:05:52 +0100 +Subject: drm/sched: Add locking to drm_sched_entity_modify_sched +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Tvrtko Ursulin + +commit 4286cc2c953983d44d248c9de1c81d3a9643345c upstream. + +Without the locking amdgpu currently can race between +amdgpu_ctx_set_entity_priority() (via drm_sched_entity_modify_sched()) and +drm_sched_job_arm(), leading to the latter accesing potentially +inconsitent entity->sched_list and entity->num_sched_list pair. + +v2: + * Improve commit message. (Philipp) + +Signed-off-by: Tvrtko Ursulin +Fixes: b37aced31eb0 ("drm/scheduler: implement a function to modify sched list") +Cc: Christian König +Cc: Alex Deucher +Cc: Luben Tuikov +Cc: Matthew Brost +Cc: David Airlie +Cc: Daniel Vetter +Cc: dri-devel@lists.freedesktop.org +Cc: Philipp Stanner +Cc: # v5.7+ +Reviewed-by: Christian König +Link: https://patchwork.freedesktop.org/patch/msgid/20240913160559.49054-2-tursulin@igalia.com +Signed-off-by: Christian König +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/scheduler/sched_entity.c | 2 ++ + 1 file changed, 2 insertions(+) + +--- a/drivers/gpu/drm/scheduler/sched_entity.c ++++ b/drivers/gpu/drm/scheduler/sched_entity.c +@@ -133,8 +133,10 @@ void drm_sched_entity_modify_sched(struc + { + WARN_ON(!num_sched_list || !sched_list); + ++ spin_lock(&entity->rq_lock); + entity->sched_list = sched_list; + entity->num_sched_list = num_sched_list; ++ spin_unlock(&entity->rq_lock); + } + EXPORT_SYMBOL(drm_sched_entity_modify_sched); + diff --git a/queue-6.10/drm-sched-always-increment-correct-scheduler-score.patch b/queue-6.10/drm-sched-always-increment-correct-scheduler-score.patch new file mode 100644 index 00000000000..09d08a9c608 --- /dev/null +++ b/queue-6.10/drm-sched-always-increment-correct-scheduler-score.patch @@ -0,0 +1,52 @@ +From 087913e0ba2b3b9d7ccbafb2acf5dab9e35ae1d5 Mon Sep 17 00:00:00 2001 +From: Tvrtko Ursulin +Date: Tue, 24 Sep 2024 11:19:09 +0100 +Subject: drm/sched: Always increment correct scheduler score +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Tvrtko Ursulin + +commit 087913e0ba2b3b9d7ccbafb2acf5dab9e35ae1d5 upstream. + +Entities run queue can change during drm_sched_entity_push_job() so make +sure to update the score consistently. + +Signed-off-by: Tvrtko Ursulin +Fixes: d41a39dda140 ("drm/scheduler: improve job distribution with multiple queues") +Cc: Nirmoy Das +Cc: Christian König +Cc: Luben Tuikov +Cc: Matthew Brost +Cc: David Airlie +Cc: Daniel Vetter +Cc: dri-devel@lists.freedesktop.org +Cc: # v5.9+ +Reviewed-by: Christian König +Reviewed-by: Nirmoy Das +Link: https://patchwork.freedesktop.org/patch/msgid/20240924101914.2713-4-tursulin@igalia.com +Signed-off-by: Christian König +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/scheduler/sched_entity.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/gpu/drm/scheduler/sched_entity.c ++++ b/drivers/gpu/drm/scheduler/sched_entity.c +@@ -586,7 +586,6 @@ void drm_sched_entity_push_job(struct dr + ktime_t submit_ts; + + trace_drm_sched_job(sched_job, entity); +- atomic_inc(entity->rq->sched->score); + WRITE_ONCE(entity->last_user, current->group_leader); + + /* +@@ -614,6 +613,7 @@ void drm_sched_entity_push_job(struct dr + rq = entity->rq; + sched = rq->sched; + ++ atomic_inc(sched->score); + drm_sched_rq_add_entity(rq, entity); + spin_unlock(&entity->rq_lock); + diff --git a/queue-6.10/drm-sched-always-wake-up-correct-scheduler-in-drm_sched_entity_push_job.patch b/queue-6.10/drm-sched-always-wake-up-correct-scheduler-in-drm_sched_entity_push_job.patch new file mode 100644 index 00000000000..a6075fc6903 --- /dev/null +++ b/queue-6.10/drm-sched-always-wake-up-correct-scheduler-in-drm_sched_entity_push_job.patch @@ -0,0 +1,74 @@ +From cbc8764e29c2318229261a679b2aafd0f9072885 Mon Sep 17 00:00:00 2001 +From: Tvrtko Ursulin +Date: Tue, 24 Sep 2024 11:19:08 +0100 +Subject: drm/sched: Always wake up correct scheduler in drm_sched_entity_push_job +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Tvrtko Ursulin + +commit cbc8764e29c2318229261a679b2aafd0f9072885 upstream. + +Since drm_sched_entity_modify_sched() can modify the entities run queue, +lets make sure to only dereference the pointer once so both adding and +waking up are guaranteed to be consistent. + +Alternative of moving the spin_unlock to after the wake up would for now +be more problematic since the same lock is taken inside +drm_sched_rq_update_fifo(). + +v2: + * Improve commit message. (Philipp) + * Cache the scheduler pointer directly. (Christian) + +Signed-off-by: Tvrtko Ursulin +Fixes: b37aced31eb0 ("drm/scheduler: implement a function to modify sched list") +Cc: Christian König +Cc: Alex Deucher +Cc: Luben Tuikov +Cc: Matthew Brost +Cc: David Airlie +Cc: Daniel Vetter +Cc: Philipp Stanner +Cc: dri-devel@lists.freedesktop.org +Cc: # v5.7+ +Reviewed-by: Christian König +Link: https://patchwork.freedesktop.org/patch/msgid/20240924101914.2713-3-tursulin@igalia.com +Signed-off-by: Christian König +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/scheduler/sched_entity.c | 10 ++++++++-- + 1 file changed, 8 insertions(+), 2 deletions(-) + +--- a/drivers/gpu/drm/scheduler/sched_entity.c ++++ b/drivers/gpu/drm/scheduler/sched_entity.c +@@ -599,6 +599,9 @@ void drm_sched_entity_push_job(struct dr + + /* first job wakes up scheduler */ + if (first) { ++ struct drm_gpu_scheduler *sched; ++ struct drm_sched_rq *rq; ++ + /* Add the entity to the run queue */ + spin_lock(&entity->rq_lock); + if (entity->stopped) { +@@ -608,13 +611,16 @@ void drm_sched_entity_push_job(struct dr + return; + } + +- drm_sched_rq_add_entity(entity->rq, entity); ++ rq = entity->rq; ++ sched = rq->sched; ++ ++ drm_sched_rq_add_entity(rq, entity); + spin_unlock(&entity->rq_lock); + + if (drm_sched_policy == DRM_SCHED_POLICY_FIFO) + drm_sched_rq_update_fifo(entity, submit_ts); + +- drm_sched_wakeup(entity->rq->sched); ++ drm_sched_wakeup(sched); + } + } + EXPORT_SYMBOL(drm_sched_entity_push_job); diff --git a/queue-6.10/drm-sched-fix-dynamic-job-flow-control-race.patch b/queue-6.10/drm-sched-fix-dynamic-job-flow-control-race.patch new file mode 100644 index 00000000000..00036eefe28 --- /dev/null +++ b/queue-6.10/drm-sched-fix-dynamic-job-flow-control-race.patch @@ -0,0 +1,97 @@ +From 440d52b370b03b366fd26ace36bab20552116145 Mon Sep 17 00:00:00 2001 +From: Rob Clark +Date: Fri, 13 Sep 2024 13:23:01 -0700 +Subject: drm/sched: Fix dynamic job-flow control race + +From: Rob Clark + +commit 440d52b370b03b366fd26ace36bab20552116145 upstream. + +Fixes a race condition reported here: https://github.com/AsahiLinux/linux/issues/309#issuecomment-2238968609 + +The whole premise of lockless access to a single-producer-single- +consumer queue is that there is just a single producer and single +consumer. That means we can't call drm_sched_can_queue() (which is +about queueing more work to the hw, not to the spsc queue) from +anywhere other than the consumer (wq). + +This call in the producer is just an optimization to avoid scheduling +the consuming worker if it cannot yet queue more work to the hw. It +is safe to drop this optimization to avoid the race condition. + +Suggested-by: Asahi Lina +Fixes: a78422e9dff3 ("drm/sched: implement dynamic job-flow control") +Closes: https://github.com/AsahiLinux/linux/issues/309 +Cc: stable@vger.kernel.org +Signed-off-by: Rob Clark +Reviewed-by: Danilo Krummrich +Tested-by: Janne Grunau +Signed-off-by: Danilo Krummrich +Link: https://patchwork.freedesktop.org/patch/msgid/20240913202301.16772-1-robdclark@gmail.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/scheduler/sched_entity.c | 4 ++-- + drivers/gpu/drm/scheduler/sched_main.c | 7 ++----- + include/drm/gpu_scheduler.h | 2 +- + 3 files changed, 5 insertions(+), 8 deletions(-) + +diff --git a/drivers/gpu/drm/scheduler/sched_entity.c b/drivers/gpu/drm/scheduler/sched_entity.c +index 58c8161289fe..567e5ace6d0c 100644 +--- a/drivers/gpu/drm/scheduler/sched_entity.c ++++ b/drivers/gpu/drm/scheduler/sched_entity.c +@@ -380,7 +380,7 @@ static void drm_sched_entity_wakeup(struct dma_fence *f, + container_of(cb, struct drm_sched_entity, cb); + + drm_sched_entity_clear_dep(f, cb); +- drm_sched_wakeup(entity->rq->sched, entity); ++ drm_sched_wakeup(entity->rq->sched); + } + + /** +@@ -612,7 +612,7 @@ void drm_sched_entity_push_job(struct drm_sched_job *sched_job) + if (drm_sched_policy == DRM_SCHED_POLICY_FIFO) + drm_sched_rq_update_fifo(entity, submit_ts); + +- drm_sched_wakeup(entity->rq->sched, entity); ++ drm_sched_wakeup(entity->rq->sched); + } + } + EXPORT_SYMBOL(drm_sched_entity_push_job); +diff --git a/drivers/gpu/drm/scheduler/sched_main.c b/drivers/gpu/drm/scheduler/sched_main.c +index 7e90c9f95611..a124d5e77b5e 100644 +--- a/drivers/gpu/drm/scheduler/sched_main.c ++++ b/drivers/gpu/drm/scheduler/sched_main.c +@@ -1022,15 +1022,12 @@ EXPORT_SYMBOL(drm_sched_job_cleanup); + /** + * drm_sched_wakeup - Wake up the scheduler if it is ready to queue + * @sched: scheduler instance +- * @entity: the scheduler entity + * + * Wake up the scheduler if we can queue jobs. + */ +-void drm_sched_wakeup(struct drm_gpu_scheduler *sched, +- struct drm_sched_entity *entity) ++void drm_sched_wakeup(struct drm_gpu_scheduler *sched) + { +- if (drm_sched_can_queue(sched, entity)) +- drm_sched_run_job_queue(sched); ++ drm_sched_run_job_queue(sched); + } + + /** +diff --git a/include/drm/gpu_scheduler.h b/include/drm/gpu_scheduler.h +index 5acc64954a88..e28bc649b5c9 100644 +--- a/include/drm/gpu_scheduler.h ++++ b/include/drm/gpu_scheduler.h +@@ -574,7 +574,7 @@ void drm_sched_entity_modify_sched(struct drm_sched_entity *entity, + + void drm_sched_tdr_queue_imm(struct drm_gpu_scheduler *sched); + void drm_sched_job_cleanup(struct drm_sched_job *job); +-void drm_sched_wakeup(struct drm_gpu_scheduler *sched, struct drm_sched_entity *entity); ++void drm_sched_wakeup(struct drm_gpu_scheduler *sched); + bool drm_sched_wqueue_ready(struct drm_gpu_scheduler *sched); + void drm_sched_wqueue_stop(struct drm_gpu_scheduler *sched); + void drm_sched_wqueue_start(struct drm_gpu_scheduler *sched); +-- +2.46.2 + diff --git a/queue-6.10/series b/queue-6.10/series index 5d67b57d66d..6206ff0cb75 100644 --- a/queue-6.10/series +++ b/queue-6.10/series @@ -433,3 +433,14 @@ tracing-timerlat-fix-duplicated-kthread-creation-due-to-cpu-online-offline.patch rtla-fix-the-help-text-in-osnoise-and-timerlat-top-tools.patch firmware-sysfb-disable-sysfb-for-firmware-buffers-with-unknown-parent.patch close_range-fix-the-logics-in-descriptor-table-trimming.patch +drm-i915-gem-fix-bitwise-and-logical-and-mixup.patch +drm-panthor-don-t-add-write-fences-to-the-shared-bos.patch +drm-panthor-fix-access-to-uninitialized-variable-in-tick_ctx_cleanup.patch +drm-panthor-don-t-declare-a-queue-blocked-if-deferred-operations-are-pending.patch +drm-sched-fix-dynamic-job-flow-control-race.patch +drm-sched-add-locking-to-drm_sched_entity_modify_sched.patch +drm-sched-always-wake-up-correct-scheduler-in-drm_sched_entity_push_job.patch +drm-sched-always-increment-correct-scheduler-score.patch +drm-amd-display-add-hdr-workaround-for-specific-edp.patch +drm-amd-display-update-dml2-policy-enhancedprefetchscheduleaccelerationfinal-dcn35.patch +drm-amd-display-fix-system-hang-while-resume-with-tbt-monitor.patch