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-next>] [day] [month] [year] [list]
Message-ID: <fbe93a52-365e-47fe-93a4-44a44547d601@paulmck-laptop>
Date: Thu, 3 Apr 2025 14:14:38 -0700
From: "Paul E. McKenney" <paulmck@...nel.org>
To: linux-kernel@...r.kernel.org
Cc: Andrew Morton <akpm@...ux-foundation.org>,
	Kuniyuki Iwashima <kuniyu@...zon.com>,
	Mateusz Guzik <mjguzik@...il.com>, Petr Mladek <pmladek@...e.com>,
	Steven Rostedt <rostedt@...dmis.org>,
	John Ogness <john.ogness@...utronix.de>,
	Sergey Senozhatsky <senozhatsky@...omium.org>,
	Jon Pan-Doh <pandoh@...gle.com>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Karolina Stolarek <karolina.stolarek@...cle.com>
Subject: [PATCH RFC 0/9] Reduce ratelimit's false-positive misses

Hello!

This RFC series replaces open-coded uses of the ratelimit_state structure
with formal APIs, counts all rate-limit misses, replaces jiffies=0
special case with a flag, provides a ___ratelimit() lockless fastpath
to (almost) eliminate false-positive misses, and adds a simple test.
The lockless fastpath also provides a 10-20% speedup on my x86 laptop,
though your mileage may vary.

The key point of this series is the reduction of false-positive misses.
Patches 4-7 move in this direction within the fully locked confines of
the current design, and patch 8 introduces the lockless fastpath.

The individual patches are as follows:

1.	Create functions to handle ratelimit_state internals.

2.	random: Avoid open-coded use of ratelimit_state structure's
	->missed field.

3.	drm/i915: Avoid open-coded use of ratelimit_state structure's
	->missed field.

4.	drm/amd/pm: Avoid open-coded use of ratelimit_state structure's
	internals.

5.	Convert the ->missed field to atomic_t.

6.	Count misses due to lock contention.

7.	Avoid jiffies=0 special case.

8.	Reduce ratelimit's false-positive misses.

9.	Add trivial kunit test for ratelimit.

						Thanx, Paul

------------------------------------------------------------------------

 b/drivers/char/random.c              |    9 -
 b/drivers/gpu/drm/amd/pm/amdgpu_pm.c |   11 --
 b/drivers/gpu/drm/i915/i915_perf.c   |    8 -
 b/include/linux/ratelimit.h          |   40 ++++++-
 b/include/linux/ratelimit_types.h    |    2 
 b/lib/Kconfig.debug                  |   11 ++
 b/lib/Makefile                       |    1 
 b/lib/ratelimit.c                    |    8 -
 b/lib/test_ratelimit.c               |   77 ++++++++++++++
 include/linux/ratelimit.h            |   13 --
 include/linux/ratelimit_types.h      |    4 
 lib/ratelimit.c                      |  186 +++++++++++++++++++++++++++--------
 12 files changed, 296 insertions(+), 74 deletions(-)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ