From: Sasha Levin Date: Sat, 21 Dec 2024 03:32:42 +0000 (-0500) Subject: Fixes for 6.6 X-Git-Tag: v6.1.122~35^2~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6a1f569518ec52fb8d6909dc17561c889058f7bb;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 6.6 Signed-off-by: Sasha Levin --- diff --git a/queue-6.6/drm-amdgpu-don-t-access-invalid-sched.patch b/queue-6.6/drm-amdgpu-don-t-access-invalid-sched.patch new file mode 100644 index 00000000000..71d624b0eef --- /dev/null +++ b/queue-6.6/drm-amdgpu-don-t-access-invalid-sched.patch @@ -0,0 +1,62 @@ +From 6129002c5bdd2cfcb61735b9486e0f5dc9d1ffc0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Fri, 6 Dec 2024 13:17:45 +0100 +Subject: drm/amdgpu: don't access invalid sched +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Pierre-Eric Pelloux-Prayer + +[ Upstream commit a93b1020eb9386d7da11608477121b10079c076a ] + +Since 2320c9e6a768 ("drm/sched: memset() 'job' in drm_sched_job_init()") +accessing job->base.sched can produce unexpected results as the initialisation +of (*job)->base.sched done in amdgpu_job_alloc is overwritten by the +memset. + +This commit fixes an issue when a CS would fail validation and would +be rejected after job->num_ibs is incremented. In this case, +amdgpu_ib_free(ring->adev, ...) will be called, which would crash the +machine because the ring value is bogus. + +To fix this, pass a NULL pointer to amdgpu_ib_free(): we can do this +because the device is actually not used in this function. + +The next commit will remove the ring argument completely. + +Fixes: 2320c9e6a768 ("drm/sched: memset() 'job' in drm_sched_job_init()") +Signed-off-by: Pierre-Eric Pelloux-Prayer +Reviewed-by: Alex Deucher +Reviewed-by: Christian König +Signed-off-by: Alex Deucher +(cherry picked from commit 2ae520cb12831d264ceb97c61f72c59d33c0dbd7) +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/amd/amdgpu/amdgpu_job.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +index 99dd86337e84..49a6b6b88843 100644 +--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c ++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_job.c +@@ -159,7 +159,6 @@ void amdgpu_job_set_resources(struct amdgpu_job *job, struct amdgpu_bo *gds, + + void amdgpu_job_free_resources(struct amdgpu_job *job) + { +- struct amdgpu_ring *ring = to_amdgpu_ring(job->base.sched); + struct dma_fence *f; + unsigned i; + +@@ -172,7 +171,7 @@ void amdgpu_job_free_resources(struct amdgpu_job *job) + f = NULL; + + for (i = 0; i < job->num_ibs; ++i) +- amdgpu_ib_free(ring->adev, &job->ibs[i], f); ++ amdgpu_ib_free(NULL, &job->ibs[i], f); + } + + static void amdgpu_job_free_cb(struct drm_sched_job *s_job) +-- +2.39.5 + diff --git a/queue-6.6/drm-panel-novatek-nt35950-fix-return-value-check-in-.patch b/queue-6.6/drm-panel-novatek-nt35950-fix-return-value-check-in-.patch new file mode 100644 index 00000000000..4a0e598c44a --- /dev/null +++ b/queue-6.6/drm-panel-novatek-nt35950-fix-return-value-check-in-.patch @@ -0,0 +1,43 @@ +From a91b1aebf7048fcb0628857f39cce95be1d8e4df Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 29 Oct 2024 20:39:57 +0800 +Subject: drm/panel: novatek-nt35950: fix return value check in nt35950_probe() + +From: Yang Yingliang + +[ Upstream commit f8fd0968eff52cf092c0d517d17507ea2f6e5ea5 ] + +mipi_dsi_device_register_full() never returns NULL pointer, it +will return ERR_PTR() when it fails, so replace the check with +IS_ERR(). + +Fixes: 623a3531e9cf ("drm/panel: Add driver for Novatek NT35950 DSI DriverIC panels") +Signed-off-by: Yang Yingliang +Reviewed-by: Neil Armstrong +Link: https://lore.kernel.org/r/20241029123957.1588-1-yangyingliang@huaweicloud.com +Signed-off-by: Neil Armstrong +Link: https://patchwork.freedesktop.org/patch/msgid/20241029123957.1588-1-yangyingliang@huaweicloud.com +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/panel/panel-novatek-nt35950.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/gpu/drm/panel/panel-novatek-nt35950.c b/drivers/gpu/drm/panel/panel-novatek-nt35950.c +index 4be5013330ec..a7e1c2db5e24 100644 +--- a/drivers/gpu/drm/panel/panel-novatek-nt35950.c ++++ b/drivers/gpu/drm/panel/panel-novatek-nt35950.c +@@ -569,9 +569,9 @@ static int nt35950_probe(struct mipi_dsi_device *dsi) + return dev_err_probe(dev, -EPROBE_DEFER, "Cannot get secondary DSI host\n"); + + nt->dsi[1] = mipi_dsi_device_register_full(dsi_r_host, info); +- if (!nt->dsi[1]) { ++ if (IS_ERR(nt->dsi[1])) { + dev_err(dev, "Cannot get secondary DSI node\n"); +- return -ENODEV; ++ return PTR_ERR(nt->dsi[1]); + } + num_dsis++; + } +-- +2.39.5 + diff --git a/queue-6.6/i915-guc-accumulate-active-runtime-on-gt-reset.patch b/queue-6.6/i915-guc-accumulate-active-runtime-on-gt-reset.patch new file mode 100644 index 00000000000..9247897bd22 --- /dev/null +++ b/queue-6.6/i915-guc-accumulate-active-runtime-on-gt-reset.patch @@ -0,0 +1,56 @@ +From 5153ede8ce30bded3e8eededd2a7985a2e10bae4 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 27 Nov 2024 09:40:06 -0800 +Subject: i915/guc: Accumulate active runtime on gt reset + +From: Umesh Nerlige Ramappa + +[ Upstream commit 1622ed27d26ab4c234476be746aa55bcd39159dd ] + +On gt reset, if a context is running, then accumulate it's active time +into the busyness counter since there will be no chance for the context +to switch out and update it's run time. + +v2: Move comment right above the if (John) + +Fixes: 77cdd054dd2c ("drm/i915/pmu: Connect engine busyness stats from GuC to pmu") +Signed-off-by: Umesh Nerlige Ramappa +Reviewed-by: John Harrison +Link: https://patchwork.freedesktop.org/patch/msgid/20241127174006.190128-4-umesh.nerlige.ramappa@intel.com +(cherry picked from commit 7ed047da59cfa1acb558b95169d347acc8d85da1) +Signed-off-by: Tvrtko Ursulin +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 15 ++++++++++++++- + 1 file changed, 14 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +index 9028160b8448..ccaf9437cd0d 100644 +--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c ++++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +@@ -1394,8 +1394,21 @@ static void __reset_guc_busyness_stats(struct intel_guc *guc) + + guc_update_pm_timestamp(guc, &unused); + for_each_engine(engine, gt, id) { ++ struct intel_engine_guc_stats *stats = &engine->stats.guc; ++ + guc_update_engine_gt_clks(engine); +- engine->stats.guc.prev_total = 0; ++ ++ /* ++ * If resetting a running context, accumulate the active ++ * time as well since there will be no context switch. ++ */ ++ if (stats->running) { ++ u64 clk = guc->timestamp.gt_stamp - stats->start_gt_clk; ++ ++ stats->total_gt_clks += clk; ++ } ++ stats->prev_total = 0; ++ stats->running = 0; + } + + spin_unlock_irqrestore(&guc->timestamp.lock, flags); +-- +2.39.5 + diff --git a/queue-6.6/i915-guc-ensure-busyness-counter-increases-motonical.patch b/queue-6.6/i915-guc-ensure-busyness-counter-increases-motonical.patch new file mode 100644 index 00000000000..94dad9874ea --- /dev/null +++ b/queue-6.6/i915-guc-ensure-busyness-counter-increases-motonical.patch @@ -0,0 +1,68 @@ +From 97494a0f7a8117faf005baa5f5f4af9be7a2c516 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 27 Nov 2024 09:40:05 -0800 +Subject: i915/guc: Ensure busyness counter increases motonically + +From: Umesh Nerlige Ramappa + +[ Upstream commit 59a0b46788d58fdcee8d2f6b4e619d264a1799bf ] + +Active busyness of an engine is calculated using gt timestamp and the +context switch in time. While capturing the gt timestamp, it's possible +that the context switches out. This race could result in an active +busyness value that is greater than the actual context runtime value by a +small amount. This leads to a negative delta and throws off busyness +calculations for the user. + +If a subsequent count is smaller than the previous one, just return the +previous one, since we expect the busyness to catch up. + +Fixes: 77cdd054dd2c ("drm/i915/pmu: Connect engine busyness stats from GuC to pmu") +Signed-off-by: Umesh Nerlige Ramappa +Reviewed-by: John Harrison +Link: https://patchwork.freedesktop.org/patch/msgid/20241127174006.190128-3-umesh.nerlige.ramappa@intel.com +(cherry picked from commit cf907f6d294217985e9dafd9985dce874e04ca37) +Signed-off-by: Tvrtko Ursulin +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/i915/gt/intel_engine_types.h | 5 +++++ + drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c | 5 ++++- + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/drivers/gpu/drm/i915/gt/intel_engine_types.h b/drivers/gpu/drm/i915/gt/intel_engine_types.h +index a7e677598004..5a7e464b4fb3 100644 +--- a/drivers/gpu/drm/i915/gt/intel_engine_types.h ++++ b/drivers/gpu/drm/i915/gt/intel_engine_types.h +@@ -343,6 +343,11 @@ struct intel_engine_guc_stats { + * @start_gt_clk: GT clock time of last idle to active transition. + */ + u64 start_gt_clk; ++ ++ /** ++ * @total: The last value of total returned ++ */ ++ u64 total; + }; + + union intel_engine_tlb_inv_reg { +diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +index 44610c739fe7..9028160b8448 100644 +--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c ++++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +@@ -1362,9 +1362,12 @@ static ktime_t guc_engine_busyness(struct intel_engine_cs *engine, ktime_t *now) + total += intel_gt_clock_interval_to_ns(gt, clk); + } + ++ if (total > stats->total) ++ stats->total = total; ++ + spin_unlock_irqrestore(&guc->timestamp.lock, flags); + +- return ns_to_ktime(total); ++ return ns_to_ktime(stats->total); + } + + static void guc_enable_busyness_worker(struct intel_guc *guc) +-- +2.39.5 + diff --git a/queue-6.6/i915-guc-reset-engine-utilization-buffer-before-regi.patch b/queue-6.6/i915-guc-reset-engine-utilization-buffer-before-regi.patch new file mode 100644 index 00000000000..cfa62071936 --- /dev/null +++ b/queue-6.6/i915-guc-reset-engine-utilization-buffer-before-regi.patch @@ -0,0 +1,77 @@ +From 783b4c0dab3d0d2d0d8a8e3788d6a2b3106e1f8a Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 27 Nov 2024 09:40:04 -0800 +Subject: i915/guc: Reset engine utilization buffer before registration + +From: Umesh Nerlige Ramappa + +[ Upstream commit abcc2ddae5f82aa6cfca162e3db643dd33f0a2e8 ] + +On GT reset, we store total busyness counts for all engines and +re-register the utilization buffer with GuC. At that time we should +reset the buffer, so that we don't get spurious busyness counts on +subsequent queries. + +To repro this issue, run igt@perf_pmu@busy-hang followed by +igt@perf_pmu@most-busy-idle-check-all for a couple iterations. + +Fixes: 77cdd054dd2c ("drm/i915/pmu: Connect engine busyness stats from GuC to pmu") +Signed-off-by: Umesh Nerlige Ramappa +Reviewed-by: John Harrison +Link: https://patchwork.freedesktop.org/patch/msgid/20241127174006.190128-2-umesh.nerlige.ramappa@intel.com +(cherry picked from commit abd318237fa6556c1e5225529af145ef15d5ff0d) +Signed-off-by: Tvrtko Ursulin +Signed-off-by: Sasha Levin +--- + .../gpu/drm/i915/gt/uc/intel_guc_submission.c | 21 +++++++++++++++++++ + 1 file changed, 21 insertions(+) + +diff --git a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +index 236dfff81fea..44610c739fe7 100644 +--- a/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c ++++ b/drivers/gpu/drm/i915/gt/uc/intel_guc_submission.c +@@ -1229,6 +1229,21 @@ static void __get_engine_usage_record(struct intel_engine_cs *engine, + } while (++i < 6); + } + ++static void __set_engine_usage_record(struct intel_engine_cs *engine, ++ u32 last_in, u32 id, u32 total) ++{ ++ struct iosys_map rec_map = intel_guc_engine_usage_record_map(engine); ++ ++#define record_write(map_, field_, val_) \ ++ iosys_map_wr_field(map_, 0, struct guc_engine_usage_record, field_, val_) ++ ++ record_write(&rec_map, last_switch_in_stamp, last_in); ++ record_write(&rec_map, current_context_index, id); ++ record_write(&rec_map, total_runtime, total); ++ ++#undef record_write ++} ++ + static void guc_update_engine_gt_clks(struct intel_engine_cs *engine) + { + struct intel_engine_guc_stats *stats = &engine->stats.guc; +@@ -1488,6 +1503,9 @@ static void guc_timestamp_ping(struct work_struct *wrk) + + static int guc_action_enable_usage_stats(struct intel_guc *guc) + { ++ struct intel_gt *gt = guc_to_gt(guc); ++ struct intel_engine_cs *engine; ++ enum intel_engine_id id; + u32 offset = intel_guc_engine_usage_offset(guc); + u32 action[] = { + INTEL_GUC_ACTION_SET_ENG_UTIL_BUFF, +@@ -1495,6 +1513,9 @@ static int guc_action_enable_usage_stats(struct intel_guc *guc) + 0, + }; + ++ for_each_engine(engine, gt, id) ++ __set_engine_usage_record(engine, 0, 0xffffffff, 0); ++ + return intel_guc_send(guc, action, ARRAY_SIZE(action)); + } + +-- +2.39.5 + diff --git a/queue-6.6/series b/queue-6.6/series index dd3a83a69fe..4ae069ec0c2 100644 --- a/queue-6.6/series +++ b/queue-6.6/series @@ -55,3 +55,8 @@ ipvs-fix-clamp-of-ip_vs_conn_tab-on-small-memory-sys.patch netfilter-ipset-fix-for-recursive-locking-warning.patch selftests-openvswitch-fix-tcpdump-execution.patch net-mdiobus-fix-an-of-node-reference-leak.patch +drm-panel-novatek-nt35950-fix-return-value-check-in-.patch +i915-guc-reset-engine-utilization-buffer-before-regi.patch +i915-guc-ensure-busyness-counter-increases-motonical.patch +i915-guc-accumulate-active-runtime-on-gt-reset.patch +drm-amdgpu-don-t-access-invalid-sched.patch