* [PATCH v3 04/20] drm/i915: Avoid open-coded use of ratelimit_state structure's ->missed field [not found] <72ee57b8-9e2a-4cad-aaa0-1e3353d146d8@paulmck-laptop> @ 2025-04-25 0:28 ` Paul E. McKenney 2025-04-25 8:48 ` Jani Nikula 2025-04-25 0:28 ` [PATCH v3 05/20] drm/amd/pm: Avoid open-coded use of ratelimit_state structure's internals Paul E. McKenney 1 sibling, 1 reply; 4+ messages in thread From: Paul E. McKenney @ 2025-04-25 0:28 UTC (permalink / raw) To: linux-kernel Cc: kernel-team, Andrew Morton, Kuniyuki Iwashima, Mateusz Guzik, Petr Mladek, Steven Rostedt, John Ogness, Sergey Senozhatsky, Jon Pan-Doh, Bjorn Helgaas, Karolina Stolarek, Paul E. McKenney, Jani Nikula, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin, David Airlie, Simona Vetter, intel-gfx, dri-devel The i915_oa_stream_destroy() function directly accesses the ratelimit_state structure's ->missed field, which work, but which also makes it more difficult to change this field. Therefore, make use of the ratelimit_state_get_miss() function instead of directly accessing the ->missed field. Link: https://lore.kernel.org/all/fbe93a52-365e-47fe-93a4-44a44547d601@paulmck-laptop/ Link: https://lore.kernel.org/all/20250423115409.3425-1-spasswolf@web.de/ Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Reviewed-by: Petr Mladek <pmladek@suse.com> Cc: Jani Nikula <jani.nikula@linux.intel.com> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> Cc: Tvrtko Ursulin <tursulin@ursulin.net> Cc: David Airlie <airlied@gmail.com> Cc: Simona Vetter <simona@ffwll.ch> Cc: <intel-gfx@lists.freedesktop.org> Cc: <dri-devel@lists.freedesktop.org> --- drivers/gpu/drm/i915/i915_perf.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c index de0b413600a15..1658f1246c6fa 100644 --- a/drivers/gpu/drm/i915/i915_perf.c +++ b/drivers/gpu/drm/i915/i915_perf.c @@ -1666,6 +1666,7 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream) struct i915_perf *perf = stream->perf; struct intel_gt *gt = stream->engine->gt; struct i915_perf_group *g = stream->engine->oa_group; + int m; if (WARN_ON(stream != g->exclusive_stream)) return; @@ -1690,10 +1691,9 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream) free_oa_configs(stream); free_noa_wait(stream); - if (perf->spurious_report_rs.missed) { - gt_notice(gt, "%d spurious OA report notices suppressed due to ratelimiting\n", - perf->spurious_report_rs.missed); - } + m = ratelimit_state_get_miss(&perf->spurious_report_rs); + if (m) + gt_notice(gt, "%d spurious OA report notices suppressed due to ratelimiting\n", m); } static void gen7_init_oa_buffer(struct i915_perf_stream *stream) -- 2.40.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v3 04/20] drm/i915: Avoid open-coded use of ratelimit_state structure's ->missed field 2025-04-25 0:28 ` [PATCH v3 04/20] drm/i915: Avoid open-coded use of ratelimit_state structure's ->missed field Paul E. McKenney @ 2025-04-25 8:48 ` Jani Nikula 2025-04-25 14:27 ` Paul E. McKenney 0 siblings, 1 reply; 4+ messages in thread From: Jani Nikula @ 2025-04-25 8:48 UTC (permalink / raw) To: Paul E. McKenney, linux-kernel Cc: kernel-team, Andrew Morton, Kuniyuki Iwashima, Mateusz Guzik, Petr Mladek, Steven Rostedt, John Ogness, Sergey Senozhatsky, Jon Pan-Doh, Bjorn Helgaas, Karolina Stolarek, Paul E. McKenney, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin, David Airlie, Simona Vetter, intel-gfx, dri-devel On Thu, 24 Apr 2025, "Paul E. McKenney" <paulmck@kernel.org> wrote: > The i915_oa_stream_destroy() function directly accesses the > ratelimit_state structure's ->missed field, which work, but which also > makes it more difficult to change this field. Therefore, make use of > the ratelimit_state_get_miss() function instead of directly accessing > the ->missed field. Acked-by: Jani Nikula <jani.nikula@intel.com> For merging via whichever tree is convenient for you. Please let us know if you want us to pick it up via drm-intel. > > Link: https://lore.kernel.org/all/fbe93a52-365e-47fe-93a4-44a44547d601@paulmck-laptop/ > Link: https://lore.kernel.org/all/20250423115409.3425-1-spasswolf@web.de/ > Signed-off-by: Paul E. McKenney <paulmck@kernel.org> > Reviewed-by: Petr Mladek <pmladek@suse.com> > Cc: Jani Nikula <jani.nikula@linux.intel.com> > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> > Cc: Tvrtko Ursulin <tursulin@ursulin.net> > Cc: David Airlie <airlied@gmail.com> > Cc: Simona Vetter <simona@ffwll.ch> > Cc: <intel-gfx@lists.freedesktop.org> > Cc: <dri-devel@lists.freedesktop.org> > --- > drivers/gpu/drm/i915/i915_perf.c | 8 ++++---- > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c > index de0b413600a15..1658f1246c6fa 100644 > --- a/drivers/gpu/drm/i915/i915_perf.c > +++ b/drivers/gpu/drm/i915/i915_perf.c > @@ -1666,6 +1666,7 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream) > struct i915_perf *perf = stream->perf; > struct intel_gt *gt = stream->engine->gt; > struct i915_perf_group *g = stream->engine->oa_group; > + int m; > > if (WARN_ON(stream != g->exclusive_stream)) > return; > @@ -1690,10 +1691,9 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream) > free_oa_configs(stream); > free_noa_wait(stream); > > - if (perf->spurious_report_rs.missed) { > - gt_notice(gt, "%d spurious OA report notices suppressed due to ratelimiting\n", > - perf->spurious_report_rs.missed); > - } > + m = ratelimit_state_get_miss(&perf->spurious_report_rs); > + if (m) > + gt_notice(gt, "%d spurious OA report notices suppressed due to ratelimiting\n", m); > } > > static void gen7_init_oa_buffer(struct i915_perf_stream *stream) -- Jani Nikula, Intel ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v3 04/20] drm/i915: Avoid open-coded use of ratelimit_state structure's ->missed field 2025-04-25 8:48 ` Jani Nikula @ 2025-04-25 14:27 ` Paul E. McKenney 0 siblings, 0 replies; 4+ messages in thread From: Paul E. McKenney @ 2025-04-25 14:27 UTC (permalink / raw) To: Jani Nikula Cc: linux-kernel, kernel-team, Andrew Morton, Kuniyuki Iwashima, Mateusz Guzik, Petr Mladek, Steven Rostedt, John Ogness, Sergey Senozhatsky, Jon Pan-Doh, Bjorn Helgaas, Karolina Stolarek, Joonas Lahtinen, Rodrigo Vivi, Tvrtko Ursulin, David Airlie, Simona Vetter, intel-gfx, dri-devel On Fri, Apr 25, 2025 at 11:48:31AM +0300, Jani Nikula wrote: > On Thu, 24 Apr 2025, "Paul E. McKenney" <paulmck@kernel.org> wrote: > > The i915_oa_stream_destroy() function directly accesses the > > ratelimit_state structure's ->missed field, which work, but which also > > makes it more difficult to change this field. Therefore, make use of > > the ratelimit_state_get_miss() function instead of directly accessing > > the ->missed field. > > Acked-by: Jani Nikula <jani.nikula@intel.com> Thank you, Jani! I will apply this on my next rebase later today. > For merging via whichever tree is convenient for you. Please let us know > if you want us to pick it up via drm-intel. This one depends on a commit earlier in the series, so I will very happily take you up on your kind offer of letting me push it. ;-) Thanx, Paul > > Link: https://lore.kernel.org/all/fbe93a52-365e-47fe-93a4-44a44547d601@paulmck-laptop/ > > Link: https://lore.kernel.org/all/20250423115409.3425-1-spasswolf@web.de/ > > Signed-off-by: Paul E. McKenney <paulmck@kernel.org> > > Reviewed-by: Petr Mladek <pmladek@suse.com> > > Cc: Jani Nikula <jani.nikula@linux.intel.com> > > Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> > > Cc: Rodrigo Vivi <rodrigo.vivi@intel.com> > > Cc: Tvrtko Ursulin <tursulin@ursulin.net> > > Cc: David Airlie <airlied@gmail.com> > > Cc: Simona Vetter <simona@ffwll.ch> > > Cc: <intel-gfx@lists.freedesktop.org> > > Cc: <dri-devel@lists.freedesktop.org> > > --- > > drivers/gpu/drm/i915/i915_perf.c | 8 ++++---- > > 1 file changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c > > index de0b413600a15..1658f1246c6fa 100644 > > --- a/drivers/gpu/drm/i915/i915_perf.c > > +++ b/drivers/gpu/drm/i915/i915_perf.c > > @@ -1666,6 +1666,7 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream) > > struct i915_perf *perf = stream->perf; > > struct intel_gt *gt = stream->engine->gt; > > struct i915_perf_group *g = stream->engine->oa_group; > > + int m; > > > > if (WARN_ON(stream != g->exclusive_stream)) > > return; > > @@ -1690,10 +1691,9 @@ static void i915_oa_stream_destroy(struct i915_perf_stream *stream) > > free_oa_configs(stream); > > free_noa_wait(stream); > > > > - if (perf->spurious_report_rs.missed) { > > - gt_notice(gt, "%d spurious OA report notices suppressed due to ratelimiting\n", > > - perf->spurious_report_rs.missed); > > - } > > + m = ratelimit_state_get_miss(&perf->spurious_report_rs); > > + if (m) > > + gt_notice(gt, "%d spurious OA report notices suppressed due to ratelimiting\n", m); > > } > > > > static void gen7_init_oa_buffer(struct i915_perf_stream *stream) > > -- > Jani Nikula, Intel ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v3 05/20] drm/amd/pm: Avoid open-coded use of ratelimit_state structure's internals [not found] <72ee57b8-9e2a-4cad-aaa0-1e3353d146d8@paulmck-laptop> 2025-04-25 0:28 ` [PATCH v3 04/20] drm/i915: Avoid open-coded use of ratelimit_state structure's ->missed field Paul E. McKenney @ 2025-04-25 0:28 ` Paul E. McKenney 1 sibling, 0 replies; 4+ messages in thread From: Paul E. McKenney @ 2025-04-25 0:28 UTC (permalink / raw) To: linux-kernel Cc: kernel-team, Andrew Morton, Kuniyuki Iwashima, Mateusz Guzik, Petr Mladek, Steven Rostedt, John Ogness, Sergey Senozhatsky, Jon Pan-Doh, Bjorn Helgaas, Karolina Stolarek, Paul E. McKenney, kernel test robot, Alex Deucher, Kenneth Feng, Christian König, Xinhui Pan, David Airlie, Simona Vetter, amd-gfx, dri-devel The amdgpu_set_thermal_throttling_logging() function directly accesses the ratelimit_state structure's ->missed field, which work, but which also makes it more difficult to change this field. Therefore, make use of the ratelimit_state_reset_miss() function instead of directly accessing the ->missed field. Nevertheless, open-coded use of ->burst and ->interval is still permitted, for example, for runtime sysfs adjustment of these fields. Link: https://lore.kernel.org/all/fbe93a52-365e-47fe-93a4-44a44547d601@paulmck-laptop/ Link: https://lore.kernel.org/all/20250423115409.3425-1-spasswolf@web.de/ Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202503180826.EiekA1MB-lkp@intel.com/ Signed-off-by: Paul E. McKenney <paulmck@kernel.org> Acked-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Cc: Kenneth Feng <kenneth.feng@amd.com> Cc: "Christian König" <christian.koenig@amd.com> Cc: Xinhui Pan <Xinhui.Pan@amd.com> Cc: David Airlie <airlied@gmail.com> Cc: Simona Vetter <simona@ffwll.ch> Cc: <amd-gfx@lists.freedesktop.org> Cc: <dri-devel@lists.freedesktop.org> --- drivers/gpu/drm/amd/pm/amdgpu_pm.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/amdgpu_pm.c b/drivers/gpu/drm/amd/pm/amdgpu_pm.c index 922def51685b0..d533c79f7e215 100644 --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c @@ -1606,7 +1606,6 @@ static ssize_t amdgpu_set_thermal_throttling_logging(struct device *dev, struct drm_device *ddev = dev_get_drvdata(dev); struct amdgpu_device *adev = drm_to_adev(ddev); long throttling_logging_interval; - unsigned long flags; int ret = 0; ret = kstrtol(buf, 0, &throttling_logging_interval); @@ -1617,18 +1616,12 @@ static ssize_t amdgpu_set_thermal_throttling_logging(struct device *dev, return -EINVAL; if (throttling_logging_interval > 0) { - raw_spin_lock_irqsave(&adev->throttling_logging_rs.lock, flags); /* * Reset the ratelimit timer internals. * This can effectively restart the timer. */ - adev->throttling_logging_rs.interval = - (throttling_logging_interval - 1) * HZ; - adev->throttling_logging_rs.begin = 0; - adev->throttling_logging_rs.printed = 0; - adev->throttling_logging_rs.missed = 0; - raw_spin_unlock_irqrestore(&adev->throttling_logging_rs.lock, flags); - + ratelimit_state_reset_interval(&adev->throttling_logging_rs, + (throttling_logging_interval - 1) * HZ); atomic_set(&adev->throttling_logging_enabled, 1); } else { atomic_set(&adev->throttling_logging_enabled, 0); -- 2.40.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-04-25 14:27 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <72ee57b8-9e2a-4cad-aaa0-1e3353d146d8@paulmck-laptop> 2025-04-25 0:28 ` [PATCH v3 04/20] drm/i915: Avoid open-coded use of ratelimit_state structure's ->missed field Paul E. McKenney 2025-04-25 8:48 ` Jani Nikula 2025-04-25 14:27 ` Paul E. McKenney 2025-04-25 0:28 ` [PATCH v3 05/20] drm/amd/pm: Avoid open-coded use of ratelimit_state structure's internals Paul E. McKenney
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).