mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jim Cromie <jim.cromie@gmail.com>
To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	amd-gfx@lists.freedesktop.org,
	intel-gvt-dev@lists.freedesktop.org,
	intel-gfx@lists.freedesktop.org
Cc: Jim Cromie <jim.cromie@gmail.com>,
	Jason Baron <jbaron@akamai.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Josh Poimboeuf <jpoimboe@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [RFC PATCH 4/7] dyndbg: use static-key queueing API in dynamic-debug
Date: Thu,  5 Mar 2026 18:50:07 -0700	[thread overview]
Message-ID: <20260306015022.1940986-5-jim.cromie@gmail.com> (raw)
In-Reply-To: <20260306015022.1940986-1-jim.cromie@gmail.com>

Use the new static-key queueing API in dynamic-debug

function _get_cal_count() {
    # Sum all CPU columns for the 'CAL' (Function call interrupts) line
    grep CAL /proc/interrupts | awk '{ sum=0; for(i=2; i<NF-2; i++) sum+=$i; print sum }'
}
function ddcmdq () {
    local cal_before=$(_get_cal_count)
    echo $* > /proc/dynamic_debug/control
    local cal_after=$(_get_cal_count)
    printf "Delta-CAL (IPI): %d\n" "$((cal_after - cal_before))"
}

Before:

  #> ddcmdq +p
  #> ddcmdq -p
  ...
  [   37.165860] virtqueue callback for 000000009e760656 (00000000011de1b1)
  [   37.165952] virtiofs virtio0: virtio_fs_vq_done requests.0
  [   37.166119] dyndbg: query 0: "-p" mod:*
  Delta-CAL (IPI): 16154

After:
  ...
  [   32.189131] dyndbg: batch desc: ffffffff89468028, static_key addr ffffffff89468050 (fbcon_startup:1032)
  [   32.189225] dyndbg: batch desc: ffffffff89468060, static_key addr ffffffff89468088 (acpi_table_parse_entries_array:264)
  [   32.189332] dyndbg: batch desc: ffffffff89468098, static_key addr ffffffff894680c0 (acpi_table_print_madt_entry:229)
  Delta-CAL (IPI): 134

Extra context:

  #> wc /proc/dynamic_debug/control
  1903 15092 185427 /proc/dynamic_debug/control
  #> ddgrep dynamic_debug
  lib/dynamic_debug.c:386 [dynamic_debug]ddebug_change =_ "batch desc: %px, static_key addr %px (%s:%d)\n"
  lib/dynamic_debug.c:397 [dynamic_debug]ddebug_change =_ "applied queued updates to %d sites in total\n"
  #> dmesg | grep queued
  [   26.837520] dyndbg: applied queued updates to 1902 sites in total
  [   26.837631] applying 1866 queued jump_labels

The baseline has the 2 ratelimited patches cherry-picked in, so both
of these numbers include whatever overhead is caused by virtio and
dynamic-debugs pr_debug()s.

Cc: Jason Baron <jbaron@akamai.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Josh Poimboeuf <jpoimboe@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jim Cromie <jim.cromie@gmail.com>
---
 lib/dynamic_debug.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/dynamic_debug.c b/lib/dynamic_debug.c
index aa16782bc93b..e555a8dbdc27 100644
--- a/lib/dynamic_debug.c
+++ b/lib/dynamic_debug.c
@@ -371,10 +371,12 @@ static int ddebug_change(const struct ddebug_query *query, struct flag_settings
 #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);
 			}
+			pr_debug("batch desc: %px, static_key addr %px (%s:%d)\n",
+				 dp, &dp->key.dd_key_true, dp->function, dp->lineno);
 #endif
 			v4pr_info("changed %s:%d [%s]%s %s => %s\n",
 				  trim_prefix(dp->filename), dp->lineno,
@@ -384,6 +386,8 @@ static int ddebug_change(const struct ddebug_query *query, struct flag_settings
 			dp->flags = newflags;
 		}
 	}
+	pr_debug("applied queued updates to %d sites in total\n", nfound);
+	static_key_apply_queued();
 	mutex_unlock(&ddebug_lock);
 
 	return nfound;
-- 
2.53.0


  parent reply	other threads:[~2026-03-06  1:51 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-06  1:50 [RFC PATCH 0/7] queued static-key API reduces IPIs to 134/16154 in dyndbg Jim Cromie
2026-03-06  1:50 ` [RFC PATCH 1/7] jump_label: expose queueing API for batched static key updates Jim Cromie
2026-03-08  9:54   ` Peter Zijlstra
2026-03-06  1:50 ` [RFC PATCH 2/7] virtio: use pr_debug_ratelimited to avoid flooding Jim Cromie
2026-03-06  1:50 ` [RFC PATCH 3/7] drivers/tty/serial/serial_core: ratelimit uart_wait_until_sent Jim Cromie
2026-03-06  6:32   ` Jiri Slaby
2026-03-06 14:02     ` jim.cromie
2026-03-06  1:50 ` Jim Cromie [this message]
2026-03-06  1:50 ` [RFC PATCH 5/7] dyndbg: hoist static_key_apply_queued up Jim Cromie
2026-03-06  1:50 ` [RFC PATCH 6/7] lib/dynamic_debug: add negation support to queries Jim Cromie
2026-03-06  1:50 ` [RFC PATCH 7/7] dyndbg-test: test keyword !value negation 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=20260306015022.1940986-5-jim.cromie@gmail.com \
    --to=jim.cromie@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=intel-gvt-dev@lists.freedesktop.org \
    --cc=jbaron@akamai.com \
    --cc=jpoimboe@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /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®