diff mbox series

[v3,1/6] kunit: move KUNIT_TABLE out of INIT_DATA

Message ID 20231204221932.1465004-1-rmoar@google.com (mailing list archive)
State Accepted
Commit 69dfdce1c5161a37a14720e5f6f62a36e387aa33
Headers show
Series [v3,1/6] kunit: move KUNIT_TABLE out of INIT_DATA | expand

Commit Message

Rae Moar Dec. 4, 2023, 10:19 p.m. UTC
Alter the linker section of KUNIT_TABLE to move it out of INIT_DATA and
into DATA_DATA.

Data for KUnit tests does not need to be in the init section.

In order to run tests again after boot the KUnit data cannot be labeled as
init data as the kernel could write over it.

Add a KUNIT_INIT_TABLE in the next patch for KUnit tests that test init
data/functions.

Signed-off-by: Rae Moar <rmoar@google.com>
---
 include/asm-generic/vmlinux.lds.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)


base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86

Comments

David Gow Dec. 9, 2023, 7:48 a.m. UTC | #1
On Tue, 5 Dec 2023 at 06:19, Rae Moar <rmoar@google.com> wrote:
>
> Alter the linker section of KUNIT_TABLE to move it out of INIT_DATA and
> into DATA_DATA.
>
> Data for KUnit tests does not need to be in the init section.
>
> In order to run tests again after boot the KUnit data cannot be labeled as
> init data as the kernel could write over it.
>
> Add a KUNIT_INIT_TABLE in the next patch for KUnit tests that test init
> data/functions.
>
> Signed-off-by: Rae Moar <rmoar@google.com>
> ---

I think this actually fixes a potential bug, as we loop through the
list of suites after init has ended in the debugfs logic.

So maybe this is:
Fixes: 90a025a859a3 ("vmlinux.lds.h: add linker section for KUnit test suites")

Regardless, I'd love to get this in, even if we don't manage to get
the rest of the series in soon.

Reviewed-by: David Gow <davidgow@google.com>

Cheers,
-- David

>  include/asm-generic/vmlinux.lds.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> index bae0fe4d499b..1107905d37fc 100644
> --- a/include/asm-generic/vmlinux.lds.h
> +++ b/include/asm-generic/vmlinux.lds.h
> @@ -370,7 +370,8 @@
>         BRANCH_PROFILE()                                                \
>         TRACE_PRINTKS()                                                 \
>         BPF_RAW_TP()                                                    \
> -       TRACEPOINT_STR()
> +       TRACEPOINT_STR()                                                \
> +       KUNIT_TABLE()
>
>  /*
>   * Data section helpers
> @@ -699,8 +700,7 @@
>         THERMAL_TABLE(governor)                                         \
>         EARLYCON_TABLE()                                                \
>         LSM_TABLE()                                                     \
> -       EARLY_LSM_TABLE()                                               \
> -       KUNIT_TABLE()
> +       EARLY_LSM_TABLE()
>
>  #define INIT_TEXT                                                      \
>         *(.init.text .init.text.*)                                      \
>
> base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86
> --
> 2.43.0.rc2.451.g8631bc7472-goog
>
Rae Moar Dec. 11, 2023, 10:08 p.m. UTC | #2
On Sat, Dec 9, 2023 at 2:48 AM David Gow <davidgow@google.com> wrote:
>
> On Tue, 5 Dec 2023 at 06:19, Rae Moar <rmoar@google.com> wrote:
> >
> > Alter the linker section of KUNIT_TABLE to move it out of INIT_DATA and
> > into DATA_DATA.
> >
> > Data for KUnit tests does not need to be in the init section.
> >
> > In order to run tests again after boot the KUnit data cannot be labeled as
> > init data as the kernel could write over it.
> >
> > Add a KUNIT_INIT_TABLE in the next patch for KUnit tests that test init
> > data/functions.
> >
> > Signed-off-by: Rae Moar <rmoar@google.com>
> > ---
>
> I think this actually fixes a potential bug, as we loop through the
> list of suites after init has ended in the debugfs logic.
>
> So maybe this is:
> Fixes: 90a025a859a3 ("vmlinux.lds.h: add linker section for KUnit test suites")
>
> Regardless, I'd love to get this in, even if we don't manage to get
> the rest of the series in soon.
>
> Reviewed-by: David Gow <davidgow@google.com>
>
> Cheers,
> -- David

Hello!

Thanks for reviewing! I will be adding this fixes tag. Should I make
this a separate patch for the next version?

Thanks!
-Rae

>
> >  include/asm-generic/vmlinux.lds.h | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
> > index bae0fe4d499b..1107905d37fc 100644
> > --- a/include/asm-generic/vmlinux.lds.h
> > +++ b/include/asm-generic/vmlinux.lds.h
> > @@ -370,7 +370,8 @@
> >         BRANCH_PROFILE()                                                \
> >         TRACE_PRINTKS()                                                 \
> >         BPF_RAW_TP()                                                    \
> > -       TRACEPOINT_STR()
> > +       TRACEPOINT_STR()                                                \
> > +       KUNIT_TABLE()
> >
> >  /*
> >   * Data section helpers
> > @@ -699,8 +700,7 @@
> >         THERMAL_TABLE(governor)                                         \
> >         EARLYCON_TABLE()                                                \
> >         LSM_TABLE()                                                     \
> > -       EARLY_LSM_TABLE()                                               \
> > -       KUNIT_TABLE()
> > +       EARLY_LSM_TABLE()
> >
> >  #define INIT_TEXT                                                      \
> >         *(.init.text .init.text.*)                                      \
> >
> > base-commit: b85ea95d086471afb4ad062012a4d73cd328fa86
> > --
> > 2.43.0.rc2.451.g8631bc7472-goog
> >
diff mbox series

Patch

diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h
index bae0fe4d499b..1107905d37fc 100644
--- a/include/asm-generic/vmlinux.lds.h
+++ b/include/asm-generic/vmlinux.lds.h
@@ -370,7 +370,8 @@ 
 	BRANCH_PROFILE()						\
 	TRACE_PRINTKS()							\
 	BPF_RAW_TP()							\
-	TRACEPOINT_STR()
+	TRACEPOINT_STR()						\
+	KUNIT_TABLE()
 
 /*
  * Data section helpers
@@ -699,8 +700,7 @@ 
 	THERMAL_TABLE(governor)						\
 	EARLYCON_TABLE()						\
 	LSM_TABLE()							\
-	EARLY_LSM_TABLE()						\
-	KUNIT_TABLE()
+	EARLY_LSM_TABLE()
 
 #define INIT_TEXT							\
 	*(.init.text .init.text.*)					\