mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alice Ryhl <aliceryhl@google.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Carlos Llamas <cmllamas@google.com>,
	 Boqun Feng <boqun@kernel.org>, Gary Guo <gary@garyguo.net>,
	 Tamir Duberstein <tamird@kernel.org>,
	Alexandre Courbot <acourbot@nvidia.com>
Cc: "Onur Özkan" <work@onurozkan.dev>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Benno Lossin" <lossin@kernel.org>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Ingo Molnar" <mingo@redhat.com>, "Lyude Paul" <lyude@redhat.com>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Peter Zijlstra" <peterz@infradead.org>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Waiman Long" <longman@redhat.com>,
	"Will Deacon" <will@kernel.org>,
	linux-kernel@vger.kernel.org, rust-for-linux@vger.kernel.org,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Alvin Sun" <alvin.sun@linux.dev>
Subject: [PATCH v6 0/4] Rate limited printing for Rust
Date: Wed, 07 Oct 2026 14:30:00 +0000	[thread overview]
Message-ID: <20261007-pr-ratelimited-v6-0-f14accd4ea3b@google.com> (raw)

To avoid DoS on the kernel log, the Rust Binder driver is being switched
to rate limited printing. But before we can do that, we must first
implement rate limited printing for Rust. Thus, do that.

However, it turns out that before we can implement rate limited
printing, we must first implement the ability declare a raw_spinlock_t
in a global variable. Thus, do that too.

Signed-off-by: Alice Ryhl <aliceryhl@google.com>
---
Changes in v6:
- Rebase on rust-next.
- Split out "rust_binder: consolidate transaction failure prints" to a
  separate patch series.
- Add CONFIG_UML_X86 to __ARCH_SPIN_LOCK_UNLOCKED cfg list.
- Add missing // INVARIANT: comment in Ratelimit::new_static().
- Pass caller location to Ratelimit::ratelimit().
- Also update report_netlink() and range_alloc/tree.rs to use pr_warn_ratelimited!.
- Link to v5: https://lore.kernel.org/r/20260803-pr-ratelimited-v5-0-a77d456de974@google.com

Changes in v5:
- Rebase on char-misc-next.
- Pick up Acked-by tags.
- Link to v4: https://lore.kernel.org/r/20260728-pr-ratelimited-v4-0-435f8d6e9605@google.com

Changes in v4:
- Rebase series.
- Mark Ratelimit::new_static() with #[inline]
- Link to v3: https://lore.kernel.org/r/20260722-pr-ratelimited-v3-0-57faa37fdfbd@google.com

Changes in v3:
- Rebase on char-misc-testing.
- Add rust/kernel/sync/lockdep.rs to MAINTAINERS file.
- Link to v2: https://lore.kernel.org/r/20260716-pr-ratelimited-v2-0-31c27a4543d2@google.com

Changes in v2:
- Rebase on top of binder_debug! patch series.
  - As a consequence, the logic for printing the size of transaction
    failures is changed to print the size of each piece of the
    transaction, rather than the total buffer size.
- Add doc aliases for raw_spin_lock_unlocked.
- Make raw_spin_lock_unlocked and raw_lockdep_map private.
- Add Ratelimit::new_static.
- Add some missing links to docs.
- Link to v1: https://lore.kernel.org/r/20260623-pr-ratelimited-v1-0-cc922f544dc0@google.com

---
Alice Ryhl (4):
      rust: sync: move lockdep types to rust/kernel/sync/lockdep.rs
      rust: sync: add const constructor for raw_spinlock_t
      rust: add pr_*_ratelimit! macros for printing
      rust_binder: use pr_*_ratelimited! for printing

 MAINTAINERS                                |   1 +
 drivers/android/binder/allocation.rs       |   4 +-
 drivers/android/binder/context.rs          |   6 +-
 drivers/android/binder/debug.rs            |   4 +-
 drivers/android/binder/freeze.rs           |   2 +-
 drivers/android/binder/node.rs             |   4 +-
 drivers/android/binder/page_range.rs       |  12 +-
 drivers/android/binder/process.rs          |  22 +--
 drivers/android/binder/range_alloc/tree.rs |  26 ++--
 drivers/android/binder/thread.rs           |  48 ++++---
 drivers/android/binder/transaction.rs      |   6 +-
 include/linux/spinlock_types_raw.h         |   4 +
 rust/bindings/lib.rs                       |  25 ++++
 rust/helpers/helpers.c                     |   1 +
 rust/helpers/ratelimit.c                   |  14 ++
 rust/kernel/lib.rs                         |   1 +
 rust/kernel/prelude.rs                     |   8 ++
 rust/kernel/ratelimit.rs                   | 216 +++++++++++++++++++++++++++++
 rust/kernel/sync.rs                        | 135 +-----------------
 rust/kernel/sync/lock/spinlock.rs          |  28 ++++
 rust/kernel/sync/lockdep.rs                | 161 +++++++++++++++++++++
 21 files changed, 532 insertions(+), 196 deletions(-)
---
base-commit: 2dee3d3adcadcc57d62ba6608cd02f50b0c10264
change-id: 20260619-pr-ratelimited-6e20fa89bd5b

Best regards,
-- 
Alice Ryhl <aliceryhl@google.com>


             reply	other threads:[~2026-10-07 14:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-07 14:30 Alice Ryhl [this message]
2026-10-07 14:30 ` [PATCH v6 1/4] rust: sync: move lockdep types to rust/kernel/sync/lockdep.rs Alice Ryhl
2026-10-07 14:30 ` [PATCH v6 2/4] rust: sync: add const constructor for raw_spinlock_t Alice Ryhl
2026-10-07 14:30 ` [PATCH v6 3/4] rust: add pr_*_ratelimit! macros for printing Alice Ryhl
2026-10-07 14:30 ` [PATCH v6 4/4] rust_binder: use pr_*_ratelimited! " Alice Ryhl
2026-10-12  5:10 ` [PATCH v6 0/4] Rate limited printing for Rust Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261007-pr-ratelimited-v6-0-f14accd4ea3b@google.com \
    --to=aliceryhl@google.com \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=alvin.sun@linux.dev \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=cmllamas@google.com \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=gary@garyguo.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=lossin@kernel.org \
    --cc=lyude@redhat.com \
    --cc=mingo@redhat.com \
    --cc=ojeda@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=will@kernel.org \
    --cc=work@onurozkan.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®