From: Greg Kroah-Hartman Date: Wed, 19 Jun 2024 07:05:05 +0000 (+0200) Subject: 6.9-stable patches X-Git-Tag: v6.1.95~64 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=575e63e529506ae71b71c69e9811380626daf34e;p=thirdparty%2Fkernel%2Fstable-queue.git 6.9-stable patches added patches: drm-i915-dpt-make-dpt-object-unshrinkable.patch drm-i915-fix-audio-component-initialization.patch drm-i915-gt-disarm-breadcrumbs-if-engines-are-already-idle.patch drm-shmem-helper-fix-bug_on-on-mmap-prot_write-map_private.patch drm-xe-properly-handle-alloc_guc_id-failure.patch intel_th-pci-add-granite-rapids-soc-support.patch intel_th-pci-add-granite-rapids-support.patch intel_th-pci-add-lunar-lake-support.patch intel_th-pci-add-meteor-lake-s-support.patch intel_th-pci-add-sapphire-rapids-soc-support.patch pmdomain-ti-sci-fix-duplicate-pd-referrals.patch riscv-force-page_size-linear-mapping-if-debug_pagealloc-is-enabled.patch riscv-rewrite-__kernel_map_pages-to-fix-sleeping-in-invalid-context.patch rtla-auto-analysis-replace-t-with-spaces.patch rtla-timerlat-simplify-no-value-printing-on-top.patch --- diff --git a/queue-6.9/drm-i915-dpt-make-dpt-object-unshrinkable.patch b/queue-6.9/drm-i915-dpt-make-dpt-object-unshrinkable.patch new file mode 100644 index 00000000000..524d0ef5616 --- /dev/null +++ b/queue-6.9/drm-i915-dpt-make-dpt-object-unshrinkable.patch @@ -0,0 +1,44 @@ +From 43e2b37e2ab660c3565d4cff27922bc70e79c3f1 Mon Sep 17 00:00:00 2001 +From: Vidya Srinivas +Date: Mon, 20 May 2024 22:26:34 +0530 +Subject: drm/i915/dpt: Make DPT object unshrinkable +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Vidya Srinivas + +commit 43e2b37e2ab660c3565d4cff27922bc70e79c3f1 upstream. + +In some scenarios, the DPT object gets shrunk but +the actual framebuffer did not and thus its still +there on the DPT's vm->bound_list. Then it tries to +rewrite the PTEs via a stale CPU mapping. This causes panic. + +Cc: stable@vger.kernel.org +Reported-by: Shawn Lee +Fixes: 0dc987b699ce ("drm/i915/display: Add smem fallback allocation for dpt") +Signed-off-by: Vidya Srinivas +[vsyrjala: Add TODO comment] +Signed-off-by: Ville Syrjälä +Link: https://patchwork.freedesktop.org/patch/msgid/20240520165634.1162470-1-vidya.srinivas@intel.com +(cherry picked from commit 51064d471c53dcc8eddd2333c3f1c1d9131ba36c) +Signed-off-by: Jani Nikula +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/i915/gem/i915_gem_object.h | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +--- a/drivers/gpu/drm/i915/gem/i915_gem_object.h ++++ b/drivers/gpu/drm/i915/gem/i915_gem_object.h +@@ -284,7 +284,9 @@ bool i915_gem_object_has_iomem(const str + static inline bool + i915_gem_object_is_shrinkable(const struct drm_i915_gem_object *obj) + { +- return i915_gem_object_type_has(obj, I915_GEM_OBJECT_IS_SHRINKABLE); ++ /* TODO: make DPT shrinkable when it has no bound vmas */ ++ return i915_gem_object_type_has(obj, I915_GEM_OBJECT_IS_SHRINKABLE) && ++ !obj->is_dpt; + } + + static inline bool diff --git a/queue-6.9/drm-i915-fix-audio-component-initialization.patch b/queue-6.9/drm-i915-fix-audio-component-initialization.patch new file mode 100644 index 00000000000..27644c08611 --- /dev/null +++ b/queue-6.9/drm-i915-fix-audio-component-initialization.patch @@ -0,0 +1,115 @@ +From 75800e2e4203ea83bbc9d4f63ad97ea582244a08 Mon Sep 17 00:00:00 2001 +From: Imre Deak +Date: Tue, 21 May 2024 17:30:22 +0300 +Subject: drm/i915: Fix audio component initialization + +From: Imre Deak + +commit 75800e2e4203ea83bbc9d4f63ad97ea582244a08 upstream. + +After registering the audio component in i915_audio_component_init() +the audio driver may call i915_audio_component_get_power() via the +component ops. This could program AUD_FREQ_CNTRL with an uninitialized +value if the latter function is called before display.audio.freq_cntrl +gets initialized. The get_power() function also does a modeset which in +the above case happens too early before the initialization step and +triggers the + +"Reject display access from task" + +error message added by the Fixes: commit below. + +Fix the above issue by registering the audio component only after the +initialization step. + +Fixes: 87c1694533c9 ("drm/i915: save AUD_FREQ_CNTRL state at audio domain suspend") +Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/10291 +Cc: stable@vger.kernel.org # v5.5+ +Signed-off-by: Imre Deak +Reviewed-by: Jani Nikula +Link: https://patchwork.freedesktop.org/patch/msgid/20240521143022.3784539-1-imre.deak@intel.com +(cherry picked from commit fdd0b80172758ce284f19fa8a26d90c61e4371d2) +Signed-off-by: Jani Nikula +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/i915/display/intel_audio.c | 32 +++++++++++++------- + drivers/gpu/drm/i915/display/intel_audio.h | 1 + drivers/gpu/drm/i915/display/intel_display_driver.c | 2 + + 3 files changed, 24 insertions(+), 11 deletions(-) + +--- a/drivers/gpu/drm/i915/display/intel_audio.c ++++ b/drivers/gpu/drm/i915/display/intel_audio.c +@@ -1252,17 +1252,6 @@ static const struct component_ops i915_a + static void i915_audio_component_init(struct drm_i915_private *i915) + { + u32 aud_freq, aud_freq_init; +- int ret; +- +- ret = component_add_typed(i915->drm.dev, +- &i915_audio_component_bind_ops, +- I915_COMPONENT_AUDIO); +- if (ret < 0) { +- drm_err(&i915->drm, +- "failed to add audio component (%d)\n", ret); +- /* continue with reduced functionality */ +- return; +- } + + if (DISPLAY_VER(i915) >= 9) { + aud_freq_init = intel_de_read(i915, AUD_FREQ_CNTRL); +@@ -1285,6 +1274,21 @@ static void i915_audio_component_init(st + + /* init with current cdclk */ + intel_audio_cdclk_change_post(i915); ++} ++ ++static void i915_audio_component_register(struct drm_i915_private *i915) ++{ ++ int ret; ++ ++ ret = component_add_typed(i915->drm.dev, ++ &i915_audio_component_bind_ops, ++ I915_COMPONENT_AUDIO); ++ if (ret < 0) { ++ drm_err(&i915->drm, ++ "failed to add audio component (%d)\n", ret); ++ /* continue with reduced functionality */ ++ return; ++ } + + i915->display.audio.component_registered = true; + } +@@ -1317,6 +1321,12 @@ void intel_audio_init(struct drm_i915_pr + i915_audio_component_init(i915); + } + ++void intel_audio_register(struct drm_i915_private *i915) ++{ ++ if (!i915->display.audio.lpe.platdev) ++ i915_audio_component_register(i915); ++} ++ + /** + * intel_audio_deinit() - deinitialize the audio driver + * @i915: the i915 drm device private data +--- a/drivers/gpu/drm/i915/display/intel_audio.h ++++ b/drivers/gpu/drm/i915/display/intel_audio.h +@@ -28,6 +28,7 @@ void intel_audio_codec_get_config(struct + void intel_audio_cdclk_change_pre(struct drm_i915_private *dev_priv); + void intel_audio_cdclk_change_post(struct drm_i915_private *dev_priv); + void intel_audio_init(struct drm_i915_private *dev_priv); ++void intel_audio_register(struct drm_i915_private *i915); + void intel_audio_deinit(struct drm_i915_private *dev_priv); + void intel_audio_sdp_split_update(const struct intel_crtc_state *crtc_state); + +--- a/drivers/gpu/drm/i915/display/intel_display_driver.c ++++ b/drivers/gpu/drm/i915/display/intel_display_driver.c +@@ -542,6 +542,8 @@ void intel_display_driver_register(struc + + intel_display_driver_enable_user_access(i915); + ++ intel_audio_register(i915); ++ + intel_display_debugfs_register(i915); + + /* diff --git a/queue-6.9/drm-i915-gt-disarm-breadcrumbs-if-engines-are-already-idle.patch b/queue-6.9/drm-i915-gt-disarm-breadcrumbs-if-engines-are-already-idle.patch new file mode 100644 index 00000000000..f8d00e1668f --- /dev/null +++ b/queue-6.9/drm-i915-gt-disarm-breadcrumbs-if-engines-are-already-idle.patch @@ -0,0 +1,107 @@ +From 70cb9188ffc75e643debf292fcddff36c9dbd4ae Mon Sep 17 00:00:00 2001 +From: Chris Wilson +Date: Tue, 23 Apr 2024 18:23:10 +0200 +Subject: drm/i915/gt: Disarm breadcrumbs if engines are already idle + +From: Chris Wilson + +commit 70cb9188ffc75e643debf292fcddff36c9dbd4ae upstream. + +The breadcrumbs use a GT wakeref for guarding the interrupt, but are +disarmed during release of the engine wakeref. This leaves a hole where +we may attach a breadcrumb just as the engine is parking (after it has +parked its breadcrumbs), execute the irq worker with some signalers still +attached, but never be woken again. + +That issue manifests itself in CI with IGT runner timeouts while tests +are waiting indefinitely for release of all GT wakerefs. + +<6> [209.151778] i915: Running live_engine_pm_selftests/live_engine_busy_stats +<7> [209.231628] i915 0000:00:02.0: [drm:intel_power_well_disable [i915]] disabling PW_5 +<7> [209.231816] i915 0000:00:02.0: [drm:intel_power_well_disable [i915]] disabling PW_4 +<7> [209.231944] i915 0000:00:02.0: [drm:intel_power_well_disable [i915]] disabling PW_3 +<7> [209.232056] i915 0000:00:02.0: [drm:intel_power_well_disable [i915]] disabling PW_2 +<7> [209.232166] i915 0000:00:02.0: [drm:intel_power_well_disable [i915]] disabling DC_off +<7> [209.232270] i915 0000:00:02.0: [drm:skl_enable_dc6 [i915]] Enabling DC6 +<7> [209.232368] i915 0000:00:02.0: [drm:gen9_set_dc_state.part.0 [i915]] Setting DC state from 00 to 02 +<4> [299.356116] [IGT] Inactivity timeout exceeded. Killing the current test with SIGQUIT. +... +<6> [299.356526] sysrq: Show State +... +<6> [299.373964] task:i915_selftest state:D stack:11784 pid:5578 tgid:5578 ppid:873 flags:0x00004002 +<6> [299.373967] Call Trace: +<6> [299.373968] +<6> [299.373970] __schedule+0x3bb/0xda0 +<6> [299.373974] schedule+0x41/0x110 +<6> [299.373976] intel_wakeref_wait_for_idle+0x82/0x100 [i915] +<6> [299.374083] ? __pfx_var_wake_function+0x10/0x10 +<6> [299.374087] live_engine_busy_stats+0x9b/0x500 [i915] +<6> [299.374173] __i915_subtests+0xbe/0x240 [i915] +<6> [299.374277] ? __pfx___intel_gt_live_setup+0x10/0x10 [i915] +<6> [299.374369] ? __pfx___intel_gt_live_teardown+0x10/0x10 [i915] +<6> [299.374456] intel_engine_live_selftests+0x1c/0x30 [i915] +<6> [299.374547] __run_selftests+0xbb/0x190 [i915] +<6> [299.374635] i915_live_selftests+0x4b/0x90 [i915] +<6> [299.374717] i915_pci_probe+0x10d/0x210 [i915] + +At the end of the interrupt worker, if there are no more engines awake, +disarm the breadcrumb and go to sleep. + +Fixes: 9d5612ca165a ("drm/i915/gt: Defer enabling the breadcrumb interrupt to after submission") +Closes: https://gitlab.freedesktop.org/drm/intel/issues/10026 +Signed-off-by: Chris Wilson +Cc: Andrzej Hajda +Cc: # v5.12+ +Signed-off-by: Janusz Krzysztofik +Acked-by: Nirmoy Das +Reviewed-by: Andrzej Hajda +Reviewed-by: Andi Shyti +Signed-off-by: Andi Shyti +Link: https://patchwork.freedesktop.org/patch/msgid/20240423165505.465734-2-janusz.krzysztofik@linux.intel.com +(cherry picked from commit fbad43eccae5cb14594195c20113369aabaa22b5) +Signed-off-by: Jani Nikula +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/i915/gt/intel_breadcrumbs.c | 15 +++++++-------- + 1 file changed, 7 insertions(+), 8 deletions(-) + +--- a/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c ++++ b/drivers/gpu/drm/i915/gt/intel_breadcrumbs.c +@@ -263,8 +263,13 @@ static void signal_irq_work(struct irq_w + i915_request_put(rq); + } + ++ /* Lazy irq enabling after HW submission */ + if (!READ_ONCE(b->irq_armed) && !list_empty(&b->signalers)) + intel_breadcrumbs_arm_irq(b); ++ ++ /* And confirm that we still want irqs enabled before we yield */ ++ if (READ_ONCE(b->irq_armed) && !atomic_read(&b->active)) ++ intel_breadcrumbs_disarm_irq(b); + } + + struct intel_breadcrumbs * +@@ -315,13 +320,7 @@ void __intel_breadcrumbs_park(struct int + return; + + /* Kick the work once more to drain the signalers, and disarm the irq */ +- irq_work_sync(&b->irq_work); +- while (READ_ONCE(b->irq_armed) && !atomic_read(&b->active)) { +- local_irq_disable(); +- signal_irq_work(&b->irq_work); +- local_irq_enable(); +- cond_resched(); +- } ++ irq_work_queue(&b->irq_work); + } + + void intel_breadcrumbs_free(struct kref *kref) +@@ -404,7 +403,7 @@ static void insert_breadcrumb(struct i91 + * the request as it may have completed and raised the interrupt as + * we were attaching it into the lists. + */ +- if (!b->irq_armed || __i915_request_is_complete(rq)) ++ if (!READ_ONCE(b->irq_armed) || __i915_request_is_complete(rq)) + irq_work_queue(&b->irq_work); + } + diff --git a/queue-6.9/drm-shmem-helper-fix-bug_on-on-mmap-prot_write-map_private.patch b/queue-6.9/drm-shmem-helper-fix-bug_on-on-mmap-prot_write-map_private.patch new file mode 100644 index 00000000000..be7c3f88518 --- /dev/null +++ b/queue-6.9/drm-shmem-helper-fix-bug_on-on-mmap-prot_write-map_private.patch @@ -0,0 +1,56 @@ +From 39bc27bd688066a63e56f7f64ad34fae03fbe3b8 Mon Sep 17 00:00:00 2001 +From: "Wachowski, Karol" +Date: Mon, 20 May 2024 12:05:14 +0200 +Subject: drm/shmem-helper: Fix BUG_ON() on mmap(PROT_WRITE, MAP_PRIVATE) +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Wachowski, Karol + +commit 39bc27bd688066a63e56f7f64ad34fae03fbe3b8 upstream. + +Lack of check for copy-on-write (COW) mapping in drm_gem_shmem_mmap +allows users to call mmap with PROT_WRITE and MAP_PRIVATE flag +causing a kernel panic due to BUG_ON in vmf_insert_pfn_prot: +BUG_ON((vma->vm_flags & VM_PFNMAP) && is_cow_mapping(vma->vm_flags)); + +Return -EINVAL early if COW mapping is detected. + +This bug affects all drm drivers using default shmem helpers. +It can be reproduced by this simple example: +void *ptr = mmap(0, size, PROT_WRITE, MAP_PRIVATE, fd, mmap_offset); +ptr[0] = 0; + +Fixes: 2194a63a818d ("drm: Add library for shmem backed GEM objects") +Cc: Noralf Trønnes +Cc: Eric Anholt +Cc: Rob Herring +Cc: Maarten Lankhorst +Cc: Maxime Ripard +Cc: Thomas Zimmermann +Cc: David Airlie +Cc: Daniel Vetter +Cc: dri-devel@lists.freedesktop.org +Cc: # v5.2+ +Signed-off-by: Wachowski, Karol +Signed-off-by: Jacek Lawrynowicz +Signed-off-by: Daniel Vetter +Link: https://patchwork.freedesktop.org/patch/msgid/20240520100514.925681-1-jacek.lawrynowicz@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/drm_gem_shmem_helper.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/drivers/gpu/drm/drm_gem_shmem_helper.c ++++ b/drivers/gpu/drm/drm_gem_shmem_helper.c +@@ -610,6 +610,9 @@ int drm_gem_shmem_mmap(struct drm_gem_sh + return ret; + } + ++ if (is_cow_mapping(vma->vm_flags)) ++ return -EINVAL; ++ + dma_resv_lock(shmem->base.resv, NULL); + ret = drm_gem_shmem_get_pages(shmem); + dma_resv_unlock(shmem->base.resv); diff --git a/queue-6.9/drm-xe-properly-handle-alloc_guc_id-failure.patch b/queue-6.9/drm-xe-properly-handle-alloc_guc_id-failure.patch new file mode 100644 index 00000000000..15bd8f6454a --- /dev/null +++ b/queue-6.9/drm-xe-properly-handle-alloc_guc_id-failure.patch @@ -0,0 +1,40 @@ +From 6c5cd0807c79eb4c0cda70b48f6be668a241d584 Mon Sep 17 00:00:00 2001 +From: Niranjana Vishwanathapura +Date: Tue, 21 May 2024 13:17:11 -0700 +Subject: drm/xe: Properly handle alloc_guc_id() failure +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Niranjana Vishwanathapura + +commit 6c5cd0807c79eb4c0cda70b48f6be668a241d584 upstream. + +Release the submission_state lock if alloc_guc_id() fails. + +v2: Add Fixes tag and CC stable kernel + +Fixes: dd08ebf6c352 ("drm/xe: Introduce a new DRM driver for Intel GPUs") +Cc: # v6.8+ +Signed-off-by: Niranjana Vishwanathapura +Reviewed-by: Nirmoy Das +Reviewed-by: Matthew Brost +Signed-off-by: José Roberto de Souza +Link: https://patchwork.freedesktop.org/patch/msgid/20240521201711.4934-1-niranjana.vishwanathapura@intel.com +(cherry picked from commit 40672b792a36894aff3a337b695f6136ee6ac5d4) +Signed-off-by: Thomas Hellström +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/xe/xe_guc_submit.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/gpu/drm/xe/xe_guc_submit.c ++++ b/drivers/gpu/drm/xe/xe_guc_submit.c +@@ -1257,6 +1257,7 @@ static int guc_exec_queue_init(struct xe + return 0; + + err_entity: ++ mutex_unlock(&guc->submission_state.lock); + xe_sched_entity_fini(&ge->entity); + err_sched: + xe_sched_fini(&ge->sched); diff --git a/queue-6.9/intel_th-pci-add-granite-rapids-soc-support.patch b/queue-6.9/intel_th-pci-add-granite-rapids-soc-support.patch new file mode 100644 index 00000000000..12a95d97fa0 --- /dev/null +++ b/queue-6.9/intel_th-pci-add-granite-rapids-soc-support.patch @@ -0,0 +1,34 @@ +From 854afe461b009801a171b3a49c5f75ea43e4c04c Mon Sep 17 00:00:00 2001 +From: Alexander Shishkin +Date: Mon, 29 Apr 2024 16:01:15 +0300 +Subject: intel_th: pci: Add Granite Rapids SOC support + +From: Alexander Shishkin + +commit 854afe461b009801a171b3a49c5f75ea43e4c04c upstream. + +Add support for the Trace Hub in Granite Rapids SOC. + +Signed-off-by: Alexander Shishkin +Reviewed-by: Andy Shevchenko +Cc: stable@kernel.org +Link: https://lore.kernel.org/r/20240429130119.1518073-12-alexander.shishkin@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hwtracing/intel_th/pci.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/hwtracing/intel_th/pci.c ++++ b/drivers/hwtracing/intel_th/pci.c +@@ -310,6 +310,11 @@ static const struct pci_device_id intel_ + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, + { ++ /* Granite Rapids SOC */ ++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x3256), ++ .driver_data = (kernel_ulong_t)&intel_th_2x, ++ }, ++ { + /* Alder Lake CPU */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x466f), + .driver_data = (kernel_ulong_t)&intel_th_2x, diff --git a/queue-6.9/intel_th-pci-add-granite-rapids-support.patch b/queue-6.9/intel_th-pci-add-granite-rapids-support.patch new file mode 100644 index 00000000000..ffca019cf44 --- /dev/null +++ b/queue-6.9/intel_th-pci-add-granite-rapids-support.patch @@ -0,0 +1,34 @@ +From e44937889bdf4ecd1f0c25762b7226406b9b7a69 Mon Sep 17 00:00:00 2001 +From: Alexander Shishkin +Date: Mon, 29 Apr 2024 16:01:14 +0300 +Subject: intel_th: pci: Add Granite Rapids support + +From: Alexander Shishkin + +commit e44937889bdf4ecd1f0c25762b7226406b9b7a69 upstream. + +Add support for the Trace Hub in Granite Rapids. + +Signed-off-by: Alexander Shishkin +Reviewed-by: Andy Shevchenko +Cc: stable@kernel.org +Link: https://lore.kernel.org/r/20240429130119.1518073-11-alexander.shishkin@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hwtracing/intel_th/pci.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/hwtracing/intel_th/pci.c ++++ b/drivers/hwtracing/intel_th/pci.c +@@ -305,6 +305,11 @@ static const struct pci_device_id intel_ + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, + { ++ /* Granite Rapids */ ++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0963), ++ .driver_data = (kernel_ulong_t)&intel_th_2x, ++ }, ++ { + /* Alder Lake CPU */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x466f), + .driver_data = (kernel_ulong_t)&intel_th_2x, diff --git a/queue-6.9/intel_th-pci-add-lunar-lake-support.patch b/queue-6.9/intel_th-pci-add-lunar-lake-support.patch new file mode 100644 index 00000000000..637925372d6 --- /dev/null +++ b/queue-6.9/intel_th-pci-add-lunar-lake-support.patch @@ -0,0 +1,34 @@ +From f866b65322bfbc8fcca13c25f49e1a5c5a93ae4d Mon Sep 17 00:00:00 2001 +From: Alexander Shishkin +Date: Mon, 29 Apr 2024 16:01:19 +0300 +Subject: intel_th: pci: Add Lunar Lake support + +From: Alexander Shishkin + +commit f866b65322bfbc8fcca13c25f49e1a5c5a93ae4d upstream. + +Add support for the Trace Hub in Lunar Lake. + +Signed-off-by: Alexander Shishkin +Reviewed-by: Andy Shevchenko +Cc: stable@kernel.org +Link: https://lore.kernel.org/r/20240429130119.1518073-16-alexander.shishkin@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hwtracing/intel_th/pci.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/hwtracing/intel_th/pci.c ++++ b/drivers/hwtracing/intel_th/pci.c +@@ -325,6 +325,11 @@ static const struct pci_device_id intel_ + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, + { ++ /* Lunar Lake */ ++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0xa824), ++ .driver_data = (kernel_ulong_t)&intel_th_2x, ++ }, ++ { + /* Alder Lake CPU */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x466f), + .driver_data = (kernel_ulong_t)&intel_th_2x, diff --git a/queue-6.9/intel_th-pci-add-meteor-lake-s-support.patch b/queue-6.9/intel_th-pci-add-meteor-lake-s-support.patch new file mode 100644 index 00000000000..45d823a23a6 --- /dev/null +++ b/queue-6.9/intel_th-pci-add-meteor-lake-s-support.patch @@ -0,0 +1,34 @@ +From c4a30def564d75e84718b059d1a62cc79b137cf9 Mon Sep 17 00:00:00 2001 +From: Alexander Shishkin +Date: Mon, 29 Apr 2024 16:01:17 +0300 +Subject: intel_th: pci: Add Meteor Lake-S support + +From: Alexander Shishkin + +commit c4a30def564d75e84718b059d1a62cc79b137cf9 upstream. + +Add support for the Trace Hub in Meteor Lake-S. + +Signed-off-by: Alexander Shishkin +Reviewed-by: Andy Shevchenko +Cc: stable@kernel.org +Link: https://lore.kernel.org/r/20240429130119.1518073-14-alexander.shishkin@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hwtracing/intel_th/pci.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/hwtracing/intel_th/pci.c ++++ b/drivers/hwtracing/intel_th/pci.c +@@ -295,6 +295,11 @@ static const struct pci_device_id intel_ + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, + { ++ /* Meteor Lake-S */ ++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7f26), ++ .driver_data = (kernel_ulong_t)&intel_th_2x, ++ }, ++ { + /* Raptor Lake-S */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7a26), + .driver_data = (kernel_ulong_t)&intel_th_2x, diff --git a/queue-6.9/intel_th-pci-add-sapphire-rapids-soc-support.patch b/queue-6.9/intel_th-pci-add-sapphire-rapids-soc-support.patch new file mode 100644 index 00000000000..19659d7e5f7 --- /dev/null +++ b/queue-6.9/intel_th-pci-add-sapphire-rapids-soc-support.patch @@ -0,0 +1,34 @@ +From 2e1da7efabe05cb0cf0b358883b2bc89080ed0eb Mon Sep 17 00:00:00 2001 +From: Alexander Shishkin +Date: Mon, 29 Apr 2024 16:01:16 +0300 +Subject: intel_th: pci: Add Sapphire Rapids SOC support + +From: Alexander Shishkin + +commit 2e1da7efabe05cb0cf0b358883b2bc89080ed0eb upstream. + +Add support for the Trace Hub in Sapphire Rapids SOC. + +Signed-off-by: Alexander Shishkin +Reviewed-by: Andy Shevchenko +Cc: stable@kernel.org +Link: https://lore.kernel.org/r/20240429130119.1518073-13-alexander.shishkin@linux.intel.com +Signed-off-by: Greg Kroah-Hartman +--- + drivers/hwtracing/intel_th/pci.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/drivers/hwtracing/intel_th/pci.c ++++ b/drivers/hwtracing/intel_th/pci.c +@@ -315,6 +315,11 @@ static const struct pci_device_id intel_ + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, + { ++ /* Sapphire Rapids SOC */ ++ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x3456), ++ .driver_data = (kernel_ulong_t)&intel_th_2x, ++ }, ++ { + /* Alder Lake CPU */ + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x466f), + .driver_data = (kernel_ulong_t)&intel_th_2x, diff --git a/queue-6.9/pmdomain-ti-sci-fix-duplicate-pd-referrals.patch b/queue-6.9/pmdomain-ti-sci-fix-duplicate-pd-referrals.patch new file mode 100644 index 00000000000..cac32d14768 --- /dev/null +++ b/queue-6.9/pmdomain-ti-sci-fix-duplicate-pd-referrals.patch @@ -0,0 +1,65 @@ +From 670c900f69645db394efb38934b3344d8804171a Mon Sep 17 00:00:00 2001 +From: Tomi Valkeinen +Date: Mon, 15 Apr 2024 19:00:23 +0300 +Subject: pmdomain: ti-sci: Fix duplicate PD referrals + +From: Tomi Valkeinen + +commit 670c900f69645db394efb38934b3344d8804171a upstream. + +When the dts file has multiple referrers to a single PD (e.g. +simple-framebuffer and dss nodes both point to the DSS power-domain) the +ti-sci driver will create two power domains, both with the same ID, and +that will cause problems as one of the power domains will hide the other +one. + +Fix this checking if a PD with the ID has already been created, and only +create a PD for new IDs. + +Fixes: efa5c01cd7ee ("soc: ti: ti_sci_pm_domains: switch to use multiple genpds instead of one") +Signed-off-by: Tomi Valkeinen +Cc: stable@vger.kernel.org +Link: https://lore.kernel.org/r/20240415-ti-sci-pd-v1-1-a0e56b8ad897@ideasonboard.com +Signed-off-by: Ulf Hansson +Signed-off-by: Greg Kroah-Hartman +--- + drivers/pmdomain/ti/ti_sci_pm_domains.c | 20 +++++++++++++++++++- + 1 file changed, 19 insertions(+), 1 deletion(-) + +--- a/drivers/pmdomain/ti/ti_sci_pm_domains.c ++++ b/drivers/pmdomain/ti/ti_sci_pm_domains.c +@@ -114,6 +114,18 @@ static const struct of_device_id ti_sci_ + }; + MODULE_DEVICE_TABLE(of, ti_sci_pm_domain_matches); + ++static bool ti_sci_pm_idx_exists(struct ti_sci_genpd_provider *pd_provider, u32 idx) ++{ ++ struct ti_sci_pm_domain *pd; ++ ++ list_for_each_entry(pd, &pd_provider->pd_list, node) { ++ if (pd->idx == idx) ++ return true; ++ } ++ ++ return false; ++} ++ + static int ti_sci_pm_domain_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; +@@ -149,8 +161,14 @@ static int ti_sci_pm_domain_probe(struct + break; + + if (args.args_count >= 1 && args.np == dev->of_node) { +- if (args.args[0] > max_id) ++ if (args.args[0] > max_id) { + max_id = args.args[0]; ++ } else { ++ if (ti_sci_pm_idx_exists(pd_provider, args.args[0])) { ++ index++; ++ continue; ++ } ++ } + + pd = devm_kzalloc(dev, sizeof(*pd), GFP_KERNEL); + if (!pd) { diff --git a/queue-6.9/riscv-force-page_size-linear-mapping-if-debug_pagealloc-is-enabled.patch b/queue-6.9/riscv-force-page_size-linear-mapping-if-debug_pagealloc-is-enabled.patch new file mode 100644 index 00000000000..5fa86c6c38f --- /dev/null +++ b/queue-6.9/riscv-force-page_size-linear-mapping-if-debug_pagealloc-is-enabled.patch @@ -0,0 +1,48 @@ +From c67ddf59ac44adc60649730bf8347e37c516b001 Mon Sep 17 00:00:00 2001 +From: Nam Cao +Date: Wed, 15 May 2024 07:50:39 +0200 +Subject: riscv: force PAGE_SIZE linear mapping if debug_pagealloc is enabled + +From: Nam Cao + +commit c67ddf59ac44adc60649730bf8347e37c516b001 upstream. + +debug_pagealloc is a debug feature which clears the valid bit in page table +entry for freed pages to detect illegal accesses to freed memory. + +For this feature to work, virtual mapping must have PAGE_SIZE resolution. +(No, we cannot map with huge pages and split them only when needed; because +pages can be allocated/freed in atomic context and page splitting cannot be +done in atomic context) + +Force linear mapping to use small pages if debug_pagealloc is enabled. + +Note that it is not necessary to force the entire linear mapping, but only +those that are given to memory allocator. Some parts of memory can keep +using huge page mapping (for example, kernel's executable code). But these +parts are minority, so keep it simple. This is just a debug feature, some +extra overhead should be acceptable. + +Fixes: 5fde3db5eb02 ("riscv: add ARCH_SUPPORTS_DEBUG_PAGEALLOC support") +Signed-off-by: Nam Cao +Cc: stable@vger.kernel.org +Reviewed-by: Alexandre Ghiti +Link: https://lore.kernel.org/r/2e391fa6c6f9b3fcf1b41cefbace02ee4ab4bf59.1715750938.git.namcao@linutronix.de +Signed-off-by: Palmer Dabbelt +Signed-off-by: Greg Kroah-Hartman +--- + arch/riscv/mm/init.c | 3 +++ + 1 file changed, 3 insertions(+) + +--- a/arch/riscv/mm/init.c ++++ b/arch/riscv/mm/init.c +@@ -669,6 +669,9 @@ void __init create_pgd_mapping(pgd_t *pg + static uintptr_t __init best_map_size(phys_addr_t pa, uintptr_t va, + phys_addr_t size) + { ++ if (debug_pagealloc_enabled()) ++ return PAGE_SIZE; ++ + if (pgtable_l5_enabled && + !(pa & (P4D_SIZE - 1)) && !(va & (P4D_SIZE - 1)) && size >= P4D_SIZE) + return P4D_SIZE; diff --git a/queue-6.9/riscv-rewrite-__kernel_map_pages-to-fix-sleeping-in-invalid-context.patch b/queue-6.9/riscv-rewrite-__kernel_map_pages-to-fix-sleeping-in-invalid-context.patch new file mode 100644 index 00000000000..4d7298720b9 --- /dev/null +++ b/queue-6.9/riscv-rewrite-__kernel_map_pages-to-fix-sleeping-in-invalid-context.patch @@ -0,0 +1,99 @@ +From fb1cf0878328fe75d47f0aed0a65b30126fcefc4 Mon Sep 17 00:00:00 2001 +From: Nam Cao +Date: Wed, 15 May 2024 07:50:40 +0200 +Subject: riscv: rewrite __kernel_map_pages() to fix sleeping in invalid context + +From: Nam Cao + +commit fb1cf0878328fe75d47f0aed0a65b30126fcefc4 upstream. + +__kernel_map_pages() is a debug function which clears the valid bit in page +table entry for deallocated pages to detect illegal memory accesses to +freed pages. + +This function set/clear the valid bit using __set_memory(). __set_memory() +acquires init_mm's semaphore, and this operation may sleep. This is +problematic, because __kernel_map_pages() can be called in atomic context, +and thus is illegal to sleep. An example warning that this causes: + +BUG: sleeping function called from invalid context at kernel/locking/rwsem.c:1578 +in_atomic(): 1, irqs_disabled(): 0, non_block: 0, pid: 2, name: kthreadd +preempt_count: 2, expected: 0 +CPU: 0 PID: 2 Comm: kthreadd Not tainted 6.9.0-g1d4c6d784ef6 #37 +Hardware name: riscv-virtio,qemu (DT) +Call Trace: +[] dump_backtrace+0x1c/0x24 +[] show_stack+0x2c/0x38 +[] dump_stack_lvl+0x5a/0x72 +[] dump_stack+0x14/0x1c +[] __might_resched+0x104/0x10e +[] __might_sleep+0x3e/0x62 +[] down_write+0x20/0x72 +[] __set_memory+0x82/0x2fa +[] __kernel_map_pages+0x5a/0xd4 +[] __alloc_pages_bulk+0x3b2/0x43a +[] __vmalloc_node_range+0x196/0x6ba +[] copy_process+0x72c/0x17ec +[] kernel_clone+0x60/0x2fe +[] kernel_thread+0x82/0xa0 +[] kthreadd+0x14a/0x1be +[] ret_from_fork+0xe/0x1c + +Rewrite this function with apply_to_existing_page_range(). It is fine to +not have any locking, because __kernel_map_pages() works with pages being +allocated/deallocated and those pages are not changed by anyone else in the +meantime. + +Fixes: 5fde3db5eb02 ("riscv: add ARCH_SUPPORTS_DEBUG_PAGEALLOC support") +Signed-off-by: Nam Cao +Cc: stable@vger.kernel.org +Reviewed-by: Alexandre Ghiti +Link: https://lore.kernel.org/r/1289ecba9606a19917bc12b6c27da8aa23e1e5ae.1715750938.git.namcao@linutronix.de +Signed-off-by: Palmer Dabbelt +Signed-off-by: Greg Kroah-Hartman +--- + arch/riscv/mm/pageattr.c | 28 ++++++++++++++++++++++------ + 1 file changed, 22 insertions(+), 6 deletions(-) + +--- a/arch/riscv/mm/pageattr.c ++++ b/arch/riscv/mm/pageattr.c +@@ -387,17 +387,33 @@ int set_direct_map_default_noflush(struc + } + + #ifdef CONFIG_DEBUG_PAGEALLOC ++static int debug_pagealloc_set_page(pte_t *pte, unsigned long addr, void *data) ++{ ++ int enable = *(int *)data; ++ ++ unsigned long val = pte_val(ptep_get(pte)); ++ ++ if (enable) ++ val |= _PAGE_PRESENT; ++ else ++ val &= ~_PAGE_PRESENT; ++ ++ set_pte(pte, __pte(val)); ++ ++ return 0; ++} ++ + void __kernel_map_pages(struct page *page, int numpages, int enable) + { + if (!debug_pagealloc_enabled()) + return; + +- if (enable) +- __set_memory((unsigned long)page_address(page), numpages, +- __pgprot(_PAGE_PRESENT), __pgprot(0)); +- else +- __set_memory((unsigned long)page_address(page), numpages, +- __pgprot(0), __pgprot(_PAGE_PRESENT)); ++ unsigned long start = (unsigned long)page_address(page); ++ unsigned long size = PAGE_SIZE * numpages; ++ ++ apply_to_existing_page_range(&init_mm, start, size, debug_pagealloc_set_page, &enable); ++ ++ flush_tlb_kernel_range(start, start + size); + } + #endif + diff --git a/queue-6.9/rtla-auto-analysis-replace-t-with-spaces.patch b/queue-6.9/rtla-auto-analysis-replace-t-with-spaces.patch new file mode 100644 index 00000000000..99e39d04ac8 --- /dev/null +++ b/queue-6.9/rtla-auto-analysis-replace-t-with-spaces.patch @@ -0,0 +1,274 @@ +From a40e5e4dd0207485dee75e2b8e860d5853bcc5f7 Mon Sep 17 00:00:00 2001 +From: Daniel Bristot de Oliveira +Date: Wed, 24 Apr 2024 16:36:51 +0200 +Subject: rtla/auto-analysis: Replace \t with spaces + +From: Daniel Bristot de Oliveira + +commit a40e5e4dd0207485dee75e2b8e860d5853bcc5f7 upstream. + +When copying timerlat auto-analysis from a terminal to some web pages or +chats, the \t are being replaced with a single ' ' or ' ', breaking +the output. + +For example: + ## CPU 3 hit stop tracing, analyzing it ## + IRQ handler delay: 1.30 us (0.11 %) + IRQ latency: 1.90 us + Timerlat IRQ duration: 3.00 us (0.24 %) + Blocking thread: 1223.16 us (99.00 %) + insync:4048 1223.16 us + IRQ interference 4.93 us (0.40 %) + local_timer:236 4.93 us + ------------------------------------------------------------------------ + Thread latency: 1235.47 us (100%) + +Replace \t with spaces to avoid this problem. + +Link: https://lkml.kernel.org/r/ec7ed2b2809c22ab0dfc8eb7c805ab9cddc4254a.1713968967.git.bristot@kernel.org + +Cc: stable@vger.kernel.org +Cc: Jonathan Corbet +Cc: Juri Lelli +Fixes: 27e348b221f6 ("rtla/timerlat: Add auto-analysis core") +Signed-off-by: Daniel Bristot de Oliveira +Signed-off-by: Greg Kroah-Hartman +--- + tools/tracing/rtla/src/timerlat_aa.c | 111 ++++++++++++++++++++--------------- + 1 file changed, 64 insertions(+), 47 deletions(-) + +--- a/tools/tracing/rtla/src/timerlat_aa.c ++++ b/tools/tracing/rtla/src/timerlat_aa.c +@@ -16,6 +16,9 @@ enum timelat_state { + TIMERLAT_WAITING_THREAD, + }; + ++/* Used to fill spaces in the output */ ++static const char *spaces = " "; ++ + #define MAX_COMM 24 + + /* +@@ -274,14 +277,17 @@ static int timerlat_aa_nmi_handler(struc + taa_data->prev_irq_timstamp = start; + + trace_seq_reset(taa_data->prev_irqs_seq); +- trace_seq_printf(taa_data->prev_irqs_seq, "\t%24s \t\t\t%9.2f us\n", +- "nmi", ns_to_usf(duration)); ++ trace_seq_printf(taa_data->prev_irqs_seq, " %24s %.*s %9.2f us\n", ++ "nmi", ++ 24, spaces, ++ ns_to_usf(duration)); + return 0; + } + + taa_data->thread_nmi_sum += duration; +- trace_seq_printf(taa_data->nmi_seq, " %24s \t\t\t%9.2f us\n", +- "nmi", ns_to_usf(duration)); ++ trace_seq_printf(taa_data->nmi_seq, " %24s %.*s %9.2f us\n", ++ "nmi", ++ 24, spaces, ns_to_usf(duration)); + + return 0; + } +@@ -323,8 +329,10 @@ static int timerlat_aa_irq_handler(struc + taa_data->prev_irq_timstamp = start; + + trace_seq_reset(taa_data->prev_irqs_seq); +- trace_seq_printf(taa_data->prev_irqs_seq, "\t%24s:%-3llu \t\t%9.2f us\n", +- desc, vector, ns_to_usf(duration)); ++ trace_seq_printf(taa_data->prev_irqs_seq, " %24s:%-3llu %.*s %9.2f us\n", ++ desc, vector, ++ 15, spaces, ++ ns_to_usf(duration)); + return 0; + } + +@@ -372,8 +380,10 @@ static int timerlat_aa_irq_handler(struc + * IRQ interference. + */ + taa_data->thread_irq_sum += duration; +- trace_seq_printf(taa_data->irqs_seq, " %24s:%-3llu \t %9.2f us\n", +- desc, vector, ns_to_usf(duration)); ++ trace_seq_printf(taa_data->irqs_seq, " %24s:%-3llu %.*s %9.2f us\n", ++ desc, vector, ++ 24, spaces, ++ ns_to_usf(duration)); + + return 0; + } +@@ -408,8 +418,10 @@ static int timerlat_aa_softirq_handler(s + + taa_data->thread_softirq_sum += duration; + +- trace_seq_printf(taa_data->softirqs_seq, "\t%24s:%-3llu \t %9.2f us\n", +- softirq_name[vector], vector, ns_to_usf(duration)); ++ trace_seq_printf(taa_data->softirqs_seq, " %24s:%-3llu %.*s %9.2f us\n", ++ softirq_name[vector], vector, ++ 24, spaces, ++ ns_to_usf(duration)); + return 0; + } + +@@ -452,8 +464,10 @@ static int timerlat_aa_thread_handler(st + } else { + taa_data->thread_thread_sum += duration; + +- trace_seq_printf(taa_data->threads_seq, "\t%24s:%-3llu \t\t%9.2f us\n", +- comm, pid, ns_to_usf(duration)); ++ trace_seq_printf(taa_data->threads_seq, " %24s:%-12llu %.*s %9.2f us\n", ++ comm, pid, ++ 15, spaces, ++ ns_to_usf(duration)); + } + + return 0; +@@ -482,7 +496,8 @@ static int timerlat_aa_stack_handler(str + function = tep_find_function(taa_ctx->tool->trace.tep, caller[i]); + if (!function) + break; +- trace_seq_printf(taa_data->stack_seq, "\t\t-> %s\n", function); ++ trace_seq_printf(taa_data->stack_seq, " %.*s -> %s\n", ++ 14, spaces, function); + } + } + return 0; +@@ -568,23 +583,24 @@ static void timerlat_thread_analysis(str + exp_irq_ts = taa_data->timer_irq_start_time - taa_data->timer_irq_start_delay; + if (exp_irq_ts < taa_data->prev_irq_timstamp + taa_data->prev_irq_duration) { + if (taa_data->prev_irq_timstamp < taa_data->timer_irq_start_time) +- printf(" Previous IRQ interference: \t\t up to %9.2f us\n", +- ns_to_usf(taa_data->prev_irq_duration)); ++ printf(" Previous IRQ interference: %.*s up to %9.2f us\n", ++ 16, spaces, ++ ns_to_usf(taa_data->prev_irq_duration)); + } + + /* + * The delay that the IRQ suffered before starting. + */ +- printf(" IRQ handler delay: %16s %9.2f us (%.2f %%)\n", +- (ns_to_usf(taa_data->timer_exit_from_idle) > 10) ? "(exit from idle)" : "", +- ns_to_usf(taa_data->timer_irq_start_delay), +- ns_to_per(total, taa_data->timer_irq_start_delay)); ++ printf(" IRQ handler delay: %.*s %16s %9.2f us (%.2f %%)\n", 16, spaces, ++ (ns_to_usf(taa_data->timer_exit_from_idle) > 10) ? "(exit from idle)" : "", ++ ns_to_usf(taa_data->timer_irq_start_delay), ++ ns_to_per(total, taa_data->timer_irq_start_delay)); + + /* + * Timerlat IRQ. + */ +- printf(" IRQ latency: \t\t\t\t %9.2f us\n", +- ns_to_usf(taa_data->tlat_irq_latency)); ++ printf(" IRQ latency: %.*s %9.2f us\n", 40, spaces, ++ ns_to_usf(taa_data->tlat_irq_latency)); + + if (irq) { + /* +@@ -595,15 +611,16 @@ static void timerlat_thread_analysis(str + * so it will be displayed, it is the key. + */ + printf(" Blocking thread:\n"); +- printf(" %24s:%-9llu\n", +- taa_data->run_thread_comm, taa_data->run_thread_pid); ++ printf(" %.*s %24s:%-9llu\n", 6, spaces, taa_data->run_thread_comm, ++ taa_data->run_thread_pid); + } else { + /* + * The duration of the IRQ handler that handled the timerlat IRQ. + */ +- printf(" Timerlat IRQ duration: \t\t %9.2f us (%.2f %%)\n", +- ns_to_usf(taa_data->timer_irq_duration), +- ns_to_per(total, taa_data->timer_irq_duration)); ++ printf(" Timerlat IRQ duration: %.*s %9.2f us (%.2f %%)\n", ++ 30, spaces, ++ ns_to_usf(taa_data->timer_irq_duration), ++ ns_to_per(total, taa_data->timer_irq_duration)); + + /* + * The amount of time that the current thread postponed the scheduler. +@@ -611,13 +628,13 @@ static void timerlat_thread_analysis(str + * Recalling that it is net from NMI/IRQ/Softirq interference, so there + * is no need to compute values here. + */ +- printf(" Blocking thread: \t\t\t %9.2f us (%.2f %%)\n", +- ns_to_usf(taa_data->thread_blocking_duration), +- ns_to_per(total, taa_data->thread_blocking_duration)); +- +- printf(" %24s:%-9llu %9.2f us\n", +- taa_data->run_thread_comm, taa_data->run_thread_pid, +- ns_to_usf(taa_data->thread_blocking_duration)); ++ printf(" Blocking thread: %.*s %9.2f us (%.2f %%)\n", 36, spaces, ++ ns_to_usf(taa_data->thread_blocking_duration), ++ ns_to_per(total, taa_data->thread_blocking_duration)); ++ ++ printf(" %.*s %24s:%-9llu %.*s %9.2f us\n", 6, spaces, ++ taa_data->run_thread_comm, taa_data->run_thread_pid, ++ 12, spaces, ns_to_usf(taa_data->thread_blocking_duration)); + } + + /* +@@ -629,9 +646,9 @@ static void timerlat_thread_analysis(str + * NMIs can happen during the IRQ, so they are always possible. + */ + if (taa_data->thread_nmi_sum) +- printf(" NMI interference \t\t\t %9.2f us (%.2f %%)\n", +- ns_to_usf(taa_data->thread_nmi_sum), +- ns_to_per(total, taa_data->thread_nmi_sum)); ++ printf(" NMI interference %.*s %9.2f us (%.2f %%)\n", 36, spaces, ++ ns_to_usf(taa_data->thread_nmi_sum), ++ ns_to_per(total, taa_data->thread_nmi_sum)); + + /* + * If it is an IRQ latency, the other factors can be skipped. +@@ -643,9 +660,9 @@ static void timerlat_thread_analysis(str + * Prints the interference caused by IRQs to the thread latency. + */ + if (taa_data->thread_irq_sum) { +- printf(" IRQ interference \t\t\t %9.2f us (%.2f %%)\n", +- ns_to_usf(taa_data->thread_irq_sum), +- ns_to_per(total, taa_data->thread_irq_sum)); ++ printf(" IRQ interference %.*s %9.2f us (%.2f %%)\n", 36, spaces, ++ ns_to_usf(taa_data->thread_irq_sum), ++ ns_to_per(total, taa_data->thread_irq_sum)); + + trace_seq_do_printf(taa_data->irqs_seq); + } +@@ -654,9 +671,9 @@ static void timerlat_thread_analysis(str + * Prints the interference caused by Softirqs to the thread latency. + */ + if (taa_data->thread_softirq_sum) { +- printf(" Softirq interference \t\t\t %9.2f us (%.2f %%)\n", +- ns_to_usf(taa_data->thread_softirq_sum), +- ns_to_per(total, taa_data->thread_softirq_sum)); ++ printf(" Softirq interference %.*s %9.2f us (%.2f %%)\n", 32, spaces, ++ ns_to_usf(taa_data->thread_softirq_sum), ++ ns_to_per(total, taa_data->thread_softirq_sum)); + + trace_seq_do_printf(taa_data->softirqs_seq); + } +@@ -670,9 +687,9 @@ static void timerlat_thread_analysis(str + * timer handling latency. + */ + if (taa_data->thread_thread_sum) { +- printf(" Thread interference \t\t\t %9.2f us (%.2f %%)\n", +- ns_to_usf(taa_data->thread_thread_sum), +- ns_to_per(total, taa_data->thread_thread_sum)); ++ printf(" Thread interference %.*s %9.2f us (%.2f %%)\n", 33, spaces, ++ ns_to_usf(taa_data->thread_thread_sum), ++ ns_to_per(total, taa_data->thread_thread_sum)); + + trace_seq_do_printf(taa_data->threads_seq); + } +@@ -682,8 +699,8 @@ static void timerlat_thread_analysis(str + */ + print_total: + printf("------------------------------------------------------------------------\n"); +- printf(" %s latency: \t\t\t %9.2f us (100%%)\n", irq ? "IRQ" : "Thread", +- ns_to_usf(total)); ++ printf(" %s latency: %.*s %9.2f us (100%%)\n", irq ? " IRQ" : "Thread", ++ 37, spaces, ns_to_usf(total)); + } + + static int timerlat_auto_analysis_collect_trace(struct timerlat_aa_context *taa_ctx) diff --git a/queue-6.9/rtla-timerlat-simplify-no-value-printing-on-top.patch b/queue-6.9/rtla-timerlat-simplify-no-value-printing-on-top.patch new file mode 100644 index 00000000000..b6708b3284d --- /dev/null +++ b/queue-6.9/rtla-timerlat-simplify-no-value-printing-on-top.patch @@ -0,0 +1,90 @@ +From 5f0769331a965675cdfec97c09f3f6e875d7c246 Mon Sep 17 00:00:00 2001 +From: Daniel Bristot de Oliveira +Date: Wed, 24 Apr 2024 16:36:50 +0200 +Subject: rtla/timerlat: Simplify "no value" printing on top + +From: Daniel Bristot de Oliveira + +commit 5f0769331a965675cdfec97c09f3f6e875d7c246 upstream. + +Instead of printing three times the same output, print it only once, +reducing lines and being sure that all no values have the same length. + +It also fixes an extra '\n' when running the with kernel threads, like +here: + + =============== %< ============== + Timer Latency + + 0 00:00:01 | IRQ Timer Latency (us) | Thread Timer Latency (us) + CPU COUNT | cur min avg max | cur min avg max + 2 #0 | - - - - | 161 161 161 161 + 3 #0 | - - - - | 161 161 161 161 + 8 #1 | 54 54 54 54 | - - - -'\n' + + ---------------|----------------------------------------|--------------------------------------- + ALL #1 e0 | 54 54 54 | 161 161 161 + =============== %< ============== + +This '\n' should have been removed with the user-space support that +added another '\n' if not running with kernel threads. + +Link: https://lkml.kernel.org/r/0a4d8085e7cd706733a5dc10a81ca38b82bd4992.1713968967.git.bristot@kernel.org + +Cc: stable@vger.kernel.org +Cc: Jonathan Corbet +Cc: Juri Lelli +Fixes: cdca4f4e5e8e ("rtla/timerlat_top: Add timerlat user-space support") +Signed-off-by: Daniel Bristot de Oliveira +Signed-off-by: Greg Kroah-Hartman +--- + tools/tracing/rtla/src/timerlat_top.c | 17 +++++------------ + 1 file changed, 5 insertions(+), 12 deletions(-) + +--- a/tools/tracing/rtla/src/timerlat_top.c ++++ b/tools/tracing/rtla/src/timerlat_top.c +@@ -212,6 +212,8 @@ static void timerlat_top_header(struct o + trace_seq_printf(s, "\n"); + } + ++static const char *no_value = " -"; ++ + /* + * timerlat_top_print - prints the output of a given CPU + */ +@@ -239,10 +241,7 @@ static void timerlat_top_print(struct os + trace_seq_printf(s, "%3d #%-9d |", cpu, cpu_data->irq_count); + + if (!cpu_data->irq_count) { +- trace_seq_printf(s, " - "); +- trace_seq_printf(s, " - "); +- trace_seq_printf(s, " - "); +- trace_seq_printf(s, " - |"); ++ trace_seq_printf(s, "%s %s %s %s |", no_value, no_value, no_value, no_value); + } else { + trace_seq_printf(s, "%9llu ", cpu_data->cur_irq / params->output_divisor); + trace_seq_printf(s, "%9llu ", cpu_data->min_irq / params->output_divisor); +@@ -251,10 +250,7 @@ static void timerlat_top_print(struct os + } + + if (!cpu_data->thread_count) { +- trace_seq_printf(s, " - "); +- trace_seq_printf(s, " - "); +- trace_seq_printf(s, " - "); +- trace_seq_printf(s, " -\n"); ++ trace_seq_printf(s, "%s %s %s %s", no_value, no_value, no_value, no_value); + } else { + trace_seq_printf(s, "%9llu ", cpu_data->cur_thread / divisor); + trace_seq_printf(s, "%9llu ", cpu_data->min_thread / divisor); +@@ -271,10 +267,7 @@ static void timerlat_top_print(struct os + trace_seq_printf(s, " |"); + + if (!cpu_data->user_count) { +- trace_seq_printf(s, " - "); +- trace_seq_printf(s, " - "); +- trace_seq_printf(s, " - "); +- trace_seq_printf(s, " -\n"); ++ trace_seq_printf(s, "%s %s %s %s\n", no_value, no_value, no_value, no_value); + } else { + trace_seq_printf(s, "%9llu ", cpu_data->cur_user / divisor); + trace_seq_printf(s, "%9llu ", cpu_data->min_user / divisor); diff --git a/queue-6.9/series b/queue-6.9/series index 87926799ec5..9d6a130387a 100644 --- a/queue-6.9/series +++ b/queue-6.9/series @@ -256,3 +256,18 @@ iio-adc-axi-adc-make-sure-axi-clock-is-enabled.patch iio-temperature-mcp9600-fix-temperature-reading-for-negative-values.patch iio-invensense-fix-interrupt-timestamp-alignment.patch drm-mst-fix-null-pointer-dereference-at-drm_dp_add_payload_part2.patch +riscv-rewrite-__kernel_map_pages-to-fix-sleeping-in-invalid-context.patch +riscv-force-page_size-linear-mapping-if-debug_pagealloc-is-enabled.patch +rtla-timerlat-simplify-no-value-printing-on-top.patch +rtla-auto-analysis-replace-t-with-spaces.patch +drm-i915-gt-disarm-breadcrumbs-if-engines-are-already-idle.patch +drm-shmem-helper-fix-bug_on-on-mmap-prot_write-map_private.patch +drm-xe-properly-handle-alloc_guc_id-failure.patch +drm-i915-dpt-make-dpt-object-unshrinkable.patch +drm-i915-fix-audio-component-initialization.patch +intel_th-pci-add-granite-rapids-support.patch +intel_th-pci-add-granite-rapids-soc-support.patch +intel_th-pci-add-sapphire-rapids-soc-support.patch +intel_th-pci-add-meteor-lake-s-support.patch +intel_th-pci-add-lunar-lake-support.patch +pmdomain-ti-sci-fix-duplicate-pd-referrals.patch