linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Benjamin Gray <bgray@linux.ibm.com>,
	"linuxppc-dev@lists.ozlabs.org" <linuxppc-dev@lists.ozlabs.org>
Cc: "ajd@linux.ibm.com" <ajd@linux.ibm.com>,
	"peterz@infradead.org" <peterz@infradead.org>,
	"ardb@kernel.org" <ardb@kernel.org>,
	"jbaron@akamai.com" <jbaron@akamai.com>,
	"rostedt@goodmis.org" <rostedt@goodmis.org>,
	"npiggin@gmail.com" <npiggin@gmail.com>,
	"jpoimboe@kernel.org" <jpoimboe@kernel.org>
Subject: Re: [PATCH v2 4/6] static_call: Move static call selftest to static_call_selftest.c
Date: Mon, 26 Sep 2022 14:50:03 +0000	[thread overview]
Message-ID: <91b311cd-5e3a-ad15-c5b7-c0889a85c50d@csgroup.eu> (raw)
In-Reply-To: <20220926064316.765967-5-bgray@linux.ibm.com>



Le 26/09/2022 à 08:43, Benjamin Gray a écrit :
> These tests are out-of-line only, so moving them to the
> their own file allows them to be run when an arch does
> not implement inline static calls.
> 
> Signed-off-by: Benjamin Gray <bgray@linux.ibm.com>

I think you got a Reviewed-by from previous series.

> ---
>   kernel/Makefile               |  1 +
>   kernel/static_call_inline.c   | 43 -----------------------------------
>   kernel/static_call_selftest.c | 41 +++++++++++++++++++++++++++++++++
>   3 files changed, 42 insertions(+), 43 deletions(-)
>   create mode 100644 kernel/static_call_selftest.c
> 
> diff --git a/kernel/Makefile b/kernel/Makefile
> index 318789c728d3..8ce8beaa3cc0 100644
> --- a/kernel/Makefile
> +++ b/kernel/Makefile
> @@ -113,6 +113,7 @@ obj-$(CONFIG_KCSAN) += kcsan/
>   obj-$(CONFIG_SHADOW_CALL_STACK) += scs.o
>   obj-$(CONFIG_HAVE_STATIC_CALL) += static_call.o
>   obj-$(CONFIG_HAVE_STATIC_CALL_INLINE) += static_call_inline.o
> +obj-$(CONFIG_STATIC_CALL_SELFTEST) += static_call_selftest.o
>   obj-$(CONFIG_CFI_CLANG) += cfi.o
>   
>   obj-$(CONFIG_PERF_EVENTS) += events/
> diff --git a/kernel/static_call_inline.c b/kernel/static_call_inline.c
> index dc5665b62814..64d04d054698 100644
> --- a/kernel/static_call_inline.c
> +++ b/kernel/static_call_inline.c
> @@ -498,46 +498,3 @@ int __init static_call_init(void)
>   	return 0;
>   }
>   early_initcall(static_call_init);
> -
> -#ifdef CONFIG_STATIC_CALL_SELFTEST
> -
> -static int func_a(int x)
> -{
> -	return x+1;
> -}
> -
> -static int func_b(int x)
> -{
> -	return x+2;
> -}
> -
> -DEFINE_STATIC_CALL(sc_selftest, func_a);
> -
> -static struct static_call_data {
> -      int (*func)(int);
> -      int val;
> -      int expect;
> -} static_call_data [] __initdata = {
> -      { NULL,   2, 3 },
> -      { func_b, 2, 4 },
> -      { func_a, 2, 3 }
> -};
> -
> -static int __init test_static_call_init(void)
> -{
> -      int i;
> -
> -      for (i = 0; i < ARRAY_SIZE(static_call_data); i++ ) {
> -	      struct static_call_data *scd = &static_call_data[i];
> -
> -              if (scd->func)
> -                      static_call_update(sc_selftest, scd->func);
> -
> -              WARN_ON(static_call(sc_selftest)(scd->val) != scd->expect);
> -      }
> -
> -      return 0;
> -}
> -early_initcall(test_static_call_init);
> -
> -#endif /* CONFIG_STATIC_CALL_SELFTEST */
> diff --git a/kernel/static_call_selftest.c b/kernel/static_call_selftest.c
> new file mode 100644
> index 000000000000..246ad89f64eb
> --- /dev/null
> +++ b/kernel/static_call_selftest.c
> @@ -0,0 +1,41 @@
> +// SPDX-License-Identifier: GPL-2.0
> +#include <linux/static_call.h>
> +
> +static int func_a(int x)
> +{
> +	return x+1;
> +}
> +
> +static int func_b(int x)
> +{
> +	return x+2;
> +}
> +
> +DEFINE_STATIC_CALL(sc_selftest, func_a);
> +
> +static struct static_call_data {
> +	int (*func)(int);
> +	int val;
> +	int expect;
> +} static_call_data [] __initdata = {
> +	{ NULL,   2, 3 },
> +	{ func_b, 2, 4 },
> +	{ func_a, 2, 3 }
> +};
> +
> +static int __init test_static_call_init(void)
> +{
> +	int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(static_call_data); i++ ) {
> +		struct static_call_data *scd = &static_call_data[i];
> +
> +		if (scd->func)
> +			static_call_update(sc_selftest, scd->func);
> +
> +		WARN_ON(static_call(sc_selftest)(scd->val) != scd->expect);
> +	}
> +
> +	return 0;
> +}
> +early_initcall(test_static_call_init);

  reply	other threads:[~2022-09-26 14:51 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-26  6:43 [PATCH v2 0/6] Out-of-line static calls for powerpc64 ELF V2 Benjamin Gray
2022-09-26  6:43 ` [PATCH v2 1/6] powerpc/code-patching: Implement generic text patching function Benjamin Gray
2022-09-26  8:56   ` kernel test robot
2022-09-26 13:28   ` kernel test robot
2022-09-26 14:33   ` Christophe Leroy
2022-09-27  2:57     ` Benjamin Gray
2022-09-27  5:54       ` Christophe Leroy
2022-09-27  6:40   ` Christophe Leroy
2022-09-28  1:30     ` Benjamin Gray
2022-09-28 10:52       ` Christophe Leroy
2022-09-27  7:30   ` Christophe Leroy
2022-09-26  6:43 ` [PATCH v2 2/6] powerpc/module: Handle caller-saved TOC in module linker Benjamin Gray
2022-09-26  6:43 ` [PATCH v2 3/6] powerpc/module: Optimise nearby branches in ELF V2 ABI stub Benjamin Gray
2022-09-26 14:49   ` Christophe Leroy
2022-09-27  3:12     ` Benjamin Gray
2022-09-26  6:43 ` [PATCH v2 4/6] static_call: Move static call selftest to static_call_selftest.c Benjamin Gray
2022-09-26 14:50   ` Christophe Leroy [this message]
2022-09-26  6:43 ` [PATCH v2 5/6] powerpc/64: Add support for out-of-line static calls Benjamin Gray
2022-09-26 13:16   ` Christophe Leroy
2022-09-27  5:18     ` Benjamin Gray
2022-09-27  6:07       ` Christophe Leroy
2022-09-26 14:54   ` Christophe Leroy
2022-09-27  3:21     ` Benjamin Gray
2022-09-27  6:01       ` Christophe Leroy
2022-09-26  6:43 ` [PATCH v2 6/6] powerpc/64: Add tests " Benjamin Gray
2022-09-26 14:55   ` Christophe Leroy
2022-09-27  3:31     ` Benjamin Gray
2022-09-27  6:05       ` Christophe Leroy
2022-09-26 14:19 ` [PATCH v2 0/6] Out-of-line static calls for powerpc64 ELF V2 Christophe Leroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=91b311cd-5e3a-ad15-c5b7-c0889a85c50d@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=ajd@linux.ibm.com \
    --cc=ardb@kernel.org \
    --cc=bgray@linux.ibm.com \
    --cc=jbaron@akamai.com \
    --cc=jpoimboe@kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=npiggin@gmail.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).