[PATCH 26/63] dyndbg-test: change do_prints testpoint to accept a loopct
Jim Cromie
jim.cromie at gmail.com
Sat Nov 9 05:18:04 UTC 2024
echo 1000 > /sys/module/test_dynamic_debug/parameters/do_prints
This allows its use as a scriptable load generator, to generate
dynamic-prefix-emits for flag combinations vs undecorated printks.
This will make it easy to assess the cost of the prefixing.
NB: the count is an unsigned int, and is *not* clamped currently, but
probably should be.
Signed-off-by: Jim Cromie <jim.cromie at gmail.com>
---
lib/test_dynamic_debug.c | 29 ++++++++++++++++++++---------
1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c
index 74b98adc4ed0..5cfc156ca4bb 100644
--- a/lib/test_dynamic_debug.c
+++ b/lib/test_dynamic_debug.c
@@ -16,16 +16,24 @@
/* re-gen output by reading or writing sysfs node: do_prints */
-static void do_prints(void); /* device under test */
+static void do_prints(unsigned int); /* device under test */
static int param_set_do_prints(const char *instr, const struct kernel_param *kp)
{
- do_prints();
+ int rc;
+ unsigned int ct;
+
+ rc = kstrtouint(instr, 0, &ct);
+ if (rc) {
+ pr_err("expecting numeric input, using 1 instead\n");
+ ct = 1;
+ }
+ do_prints(ct);
return 0;
}
static int param_get_do_prints(char *buffer, const struct kernel_param *kp)
{
- do_prints();
- return scnprintf(buffer, PAGE_SIZE, "did do_prints\n");
+ do_prints(1);
+ return scnprintf(buffer, PAGE_SIZE, "did 1 do_prints\n");
}
static const struct kernel_param_ops param_ops_do_prints = {
.set = param_set_do_prints,
@@ -177,17 +185,20 @@ static void do_levels(void)
prdbg(V7);
}
-static void do_prints(void)
+static void do_prints(unsigned int ct)
{
- pr_debug("do_prints:\n");
- do_cats();
- do_levels();
+ /* maybe clamp this */
+ pr_debug("do-prints %d times:\n", ct);
+ for (; ct; ct--) {
+ do_cats();
+ do_levels();
+ }
}
static int __init test_dynamic_debug_init(void)
{
pr_debug("init start\n");
- do_prints();
+ do_prints(1);
pr_debug("init done\n");
return 0;
}
--
2.47.0
More information about the Intel-gfx-trybot
mailing list