lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <bcf4ab09-5b87-404c-9231-567a10fd9764@paulmck-laptop>
Date: Mon, 7 Apr 2025 09:29:44 -0700
From: "Paul E. McKenney" <paulmck@...nel.org>
To: "Deucher, Alexander" <Alexander.Deucher@....com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"kernel-team@...a.com" <kernel-team@...a.com>,
	kernel test robot <lkp@...el.com>,
	"Feng, Kenneth" <Kenneth.Feng@....com>,
	"Koenig, Christian" <Christian.Koenig@....com>,
	Xinhui Pan <Xinhui.Pan@....com>, David Airlie <airlied@...il.com>,
	Simona Vetter <simona@...ll.ch>,
	"amd-gfx@...ts.freedesktop.org" <amd-gfx@...ts.freedesktop.org>,
	"dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>
Subject: Re: [PATCH RFC 4/9] drm/amd/pm: Avoid open-coded use of
 ratelimit_state structure's internals

On Mon, Apr 07, 2025 at 02:35:59PM +0000, Deucher, Alexander wrote:
> [Public]
> 
> > -----Original Message-----
> > From: Paul E. McKenney <paulmck@...nel.org>
> > Sent: Thursday, April 3, 2025 5:15 PM
> > To: linux-kernel@...r.kernel.org
> > Cc: kernel-team@...a.com; Paul E. McKenney <paulmck@...nel.org>; kernel
> > test robot <lkp@...el.com>; Feng, Kenneth <Kenneth.Feng@....com>; Deucher,
> > Alexander <Alexander.Deucher@....com>; Koenig, Christian
> > <Christian.Koenig@....com>; Xinhui Pan <Xinhui.Pan@....com>; David Airlie
> > <airlied@...il.com>; Simona Vetter <simona@...ll.ch>; amd-
> > gfx@...ts.freedesktop.org; dri-devel@...ts.freedesktop.org
> > Subject: [PATCH RFC 4/9] drm/amd/pm: Avoid open-coded use of ratelimit_state
> > structure's internals
> >
> > 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.
> >
> > Reported-by: kernel test robot <lkp@...el.com>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202503180826.EiekA1MB-
> > lkp@...el.com/
> > Signed-off-by: Paul E. McKenney <paulmck@...nel.org>
> 
> 
> Acked-by: Alex Deucher <alexander.deucher@....com>
> 
> Feel free to take this via whatever tree makes sense for the larger series.  Otherwise, let me know, and I will pick it up.

Thank you, and yes, this does depend on a patch that is earlier in
this series, so I will be happy to carry it.

							Thanx, Paul

> Alex
> 
> 
> > Cc: Kenneth Feng <kenneth.feng@....com>
> > Cc: Alex Deucher <alexander.deucher@....com>
> > Cc: "Christian König" <christian.koenig@....com>
> > Cc: Xinhui Pan <Xinhui.Pan@....com>
> > Cc: David Airlie <airlied@...il.com>
> > Cc: Simona Vetter <simona@...ll.ch>
> > Cc: <amd-gfx@...ts.freedesktop.org>
> > Cc: <dri-devel@...ts.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 e8ae7681bf0a3..6adf4e8822108 100644
> > --- a/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> > +++ b/drivers/gpu/drm/amd/pm/amdgpu_pm.c
> > @@ -1663,7 +1663,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); @@ -1674,18 +1673,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
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ