linux/lib/dhry_run.c
Jeff Johnson 3034749132 KUnit: add missing MODULE_DESCRIPTION() macros for lib/test_*.ko
make allmodconfig && make W=1 C=1 reports for lib/test_*.ko:
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_hexdump.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_dhry.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_firmware.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_sysctl.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_hash.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_ida.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_list_sort.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_min_heap.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_module.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_sort.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_static_keys.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_static_key_base.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_memcat_p.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_blackhole_dev.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_meminit.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_free_pages.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_kprobes.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_ref_tracker.o
WARNING: modpost: missing MODULE_DESCRIPTION() in lib/test_bits.o

Add the missing invocations of the MODULE_DESCRIPTION() macro.

Link: https://lkml.kernel.org/r/20240619-md-lib-test-v2-1-301e30eeba1e@quicinc.com
Signed-off-by: Jeff Johnson <quic_jjohnson@quicinc.com>
Reviewed-by: Kees Cook <kees@kernel.org>
Reviewed-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
2024-06-24 22:25:11 -07:00

88 lines
1.7 KiB
C

// SPDX-License-Identifier: GPL-2.0-only
/*
* Dhrystone benchmark test module
*
* Copyright (C) 2022 Glider bv
*/
#include "dhry.h"
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/smp.h>
#define DHRY_VAX 1757
static int dhry_run_set(const char *val, const struct kernel_param *kp);
static const struct kernel_param_ops run_ops = {
.flags = KERNEL_PARAM_OPS_FL_NOARG,
.set = dhry_run_set,
};
static bool dhry_run;
module_param_cb(run, &run_ops, &dhry_run, 0200);
MODULE_PARM_DESC(run, "Run the test (default: false)");
static int iterations = -1;
module_param(iterations, int, 0644);
MODULE_PARM_DESC(iterations,
"Number of iterations through the benchmark (default: auto)");
static void dhry_benchmark(void)
{
unsigned int cpu = get_cpu();
int i, n;
if (iterations > 0) {
n = dhry(iterations);
goto report;
}
for (i = DHRY_VAX; i > 0; i <<= 1) {
n = dhry(i);
if (n != -EAGAIN)
break;
}
report:
put_cpu();
if (n >= 0)
pr_info("CPU%u: Dhrystones per Second: %d (%d DMIPS)\n", cpu,
n, n / DHRY_VAX);
else if (n == -EAGAIN)
pr_err("Please increase the number of iterations\n");
else
pr_err("Dhrystone benchmark failed error %pe\n", ERR_PTR(n));
}
static int dhry_run_set(const char *val, const struct kernel_param *kp)
{
int ret;
if (val) {
ret = param_set_bool(val, kp);
if (ret)
return ret;
} else {
dhry_run = true;
}
if (dhry_run && system_state == SYSTEM_RUNNING)
dhry_benchmark();
return 0;
}
static int __init dhry_init(void)
{
if (dhry_run)
dhry_benchmark();
return 0;
}
module_init(dhry_init);
MODULE_AUTHOR("Geert Uytterhoeven <geert+renesas@glider.be>");
MODULE_DESCRIPTION("Dhrystone benchmark test module");
MODULE_LICENSE("GPL");