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 <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Josh Poimboeuf <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Signed-off-by: Jim Cromie <[email protected]>
---
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