lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <948a48a8-10c4-4440-b905-a1db669a31ba@bootlin.com>
Date: Tue, 15 Apr 2025 12:04:49 +0200
From: Louis Chauvet <louis.chauvet@...tlin.com>
To: Jim Cromie <jim.cromie@...il.com>, jbaron@...mai.com,
 gregkh@...uxfoundation.org, ukaszb@...omium.org, linux-kernel@...r.kernel.org
Cc: dri-devel@...ts.freedesktop.org, amd-gfx@...ts.freedesktop.org,
 intel-gvt-dev@...ts.freedesktop.org, intel-gfx@...ts.freedesktop.org,
 daniel.vetter@...ll.ch, tvrtko.ursulin@...ux.intel.com,
 jani.nikula@...el.com, ville.syrjala@...ux.intel.com
Subject: Re: [PATCH v3 21/54] dyndbg-test: change do_prints testpoint to
 accept a loopct



Le 02/04/2025 à 19:41, Jim Cromie a écrit :
> 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 messages.
> This will make it easy to assess the cost of the prefixing.
> 
> Reading the ./do_prints node also prints messages (once) to the-log.
> 
> NB: the count is clamped to 10000, chosen to be notice able, but not
> annoying, and not enough to accidentally flood the logs.
> 
> Signed-off-by: Jim Cromie <jim.cromie@...il.com>

Reviewed-by: Louis Chauvet <louis.chauvet@...tlin.com>

I think this could be in a separate series / merged independently to 
reduce the size of this series.

> ---
>   lib/test_dynamic_debug.c | 37 ++++++++++++++++++++++++++-----------
>   1 file changed, 26 insertions(+), 11 deletions(-)
> 
> diff --git a/lib/test_dynamic_debug.c b/lib/test_dynamic_debug.c
> index 9f9e3fddd7e6..4a3d2612ef60 100644
> --- a/lib/test_dynamic_debug.c
> +++ b/lib/test_dynamic_debug.c
> @@ -29,18 +29,30 @@
>   
>   #include <linux/module.h>
>   
> -/* re-gen output by reading or writing sysfs node: do_prints */
> -
> -static void do_prints(void); /* device under test */
> +/* re-trigger debug output by reading or writing sysfs node: do_prints */
> +#define PRINT_CLAMP 10000
> +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;
> +	}
> +	if (ct > PRINT_CLAMP) {
> +		ct = PRINT_CLAMP;
> +		pr_info("clamping print-count to %d\n", ct);
> +	}
> +	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,
> @@ -191,17 +203,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;
>   }

-- 
Louis Chauvet, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ