Re: [RESEND][PATCH v3 11/17] static_call: Simple self-test

From: Borislav Petkov
Date: Thu Mar 26 2020 - 11:44:47 EST


On Tue, Mar 24, 2020 at 02:56:14PM +0100, Peter Zijlstra wrote:
>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>
> ---
> arch/Kconfig | 6 ++++++
> kernel/static_call.c | 28 ++++++++++++++++++++++++++++
> 2 files changed, 34 insertions(+)

Should we say something?

---
diff --git a/kernel/static_call.c b/kernel/static_call.c
index b7b7fb58afce..2f27cebd5abf 100644
--- a/kernel/static_call.c
+++ b/kernel/static_call.c
@@ -10,6 +10,9 @@
#include <linux/processor.h>
#include <asm/sections.h>

+#undef pr_fmt
+#define pr_fmt(fmt) "static_call: " fmt
+
extern struct static_call_site __start_static_call_sites[],
__stop_static_call_sites[];

@@ -381,6 +384,8 @@ DEFINE_STATIC_CALL(sc_selftest, func_a);

static int __init test_static_call_init(void)
{
+ pr_info("Running static_call selftest... \n");
+
WARN_ON(static_call(sc_selftest)(2) != 3);
static_call_update(sc_selftest, &func_b);
WARN_ON(static_call(sc_selftest)(2) != 4);

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette