mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jim Cromie <jim.cromie@gmail.com>
To: peterz@infradead.org, gregkh@linuxfoundation.org
Cc: jpoimboe@kernel.org, jbaron@akamai.com, aliceryhl@google.com,
	rostedt@goodmis.org, ardb@kernel.org, x86@kernel.org,
	linux-kernel@vger.kernel.org, Jim Cromie <jim.cromie@gmail.com>
Subject: [PATCH 3/5] dyndbg: use static-key queueing API in dynamic-debug
Date: Fri,  3 Apr 2026 08:23:59 -0600	[thread overview]
Message-ID: <20260403142401.1387033-4-jim.cromie@gmail.com> (raw)
In-Reply-To: <20260403142401.1387033-1-jim.cromie@gmail.com>

Use the new static-key queueing API in dynamic-debug to reduce IPIs.

this replaces the 2 calls to static_branch_{enable.disable}() in
ddebug_change() with their _queued() counterparts, and adds a call to
static_branch_apply_queued() at the bottom.

This gives a theoretical reduction of IPIs up to 256x, and a practical
reduction by 120-180x.

Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 lib/dynamic_debug.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index b5060749464e..9bee7dde5148 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -250,9 +250,9 @@ static int ddebug_change(const struct ddebug_query *query,
 #ifdef CONFIG_JUMP_LABEL
 			if (dp->flags & _DPRINTK_FLAGS_PRINT) {
 				if (!(newflags & _DPRINTK_FLAGS_PRINT))
-					static_branch_disable(&dp->key.dd_key_true);
+					static_branch_disable_queued(&dp->key.dd_key_true);
 			} else if (newflags & _DPRINTK_FLAGS_PRINT) {
-				static_branch_enable(&dp->key.dd_key_true);
+				static_branch_enable_queued(&dp->key.dd_key_true);
 			}
 #endif
 			v4pr_info("changed %s:%d [%s]%s %s => %s\n",
@@ -263,6 +263,7 @@ static int ddebug_change(const struct ddebug_query *query,
 			dp->flags = newflags;
 		}
 	}
+	static_branch_apply_queued();
 	mutex_unlock(&ddebug_lock);
 	v2pr_info("applied %d queued updates to sites in total\n", nfound);
 
-- 
2.53.0


  parent reply	other threads:[~2026-04-03 14:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-03 14:23 [PATCH 0/5] jump_label: mitigate dynamic-debug induced IPI storms Jim Cromie
2026-04-03 14:23 ` [PATCH 1/5] jump_label: add queueing API for batched static key updates Jim Cromie
2026-04-03 14:23 ` [PATCH 2/5] x86/alternative.c: sort text-pokes before flushing the queue Jim Cromie
2026-04-03 14:23 ` Jim Cromie [this message]
2026-04-03 14:24 ` [PATCH 4/5] dyndbg: factor ddebug_match_desc out from ddebug_change (for demonstration only) Jim Cromie
2026-04-03 14:24 ` [PATCH 5/5] lib/dynamic_debug: add negation support to queries Jim Cromie

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=20260403142401.1387033-4-jim.cromie@gmail.com \
    --to=jim.cromie@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=ardb@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jbaron@akamai.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=x86@kernel.org \
    /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®