Re: linux-next: build warning after merge of the rcu tree

From: Stephen Rothwell
Date: Wed Jul 26 2023 - 02:37:19 EST


Hi Paul,

On Tue, 25 Jul 2023 20:48:13 -0700 "Paul E. McKenney" <paulmck@xxxxxxxxxx> wrote:
>
> Does the following incremental diff (to be squashed into the original) help?
>
> Thanx, Paul
>
> ------------------------------------------------------------------------
>
> diff --git a/init/main.c b/init/main.c
> index c946ab87783a..981170da0b1c 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -135,7 +135,7 @@ EXPORT_SYMBOL(system_state);
> void (*__initdata late_time_init)(void);
>
> /* Untouched command line saved by arch-specific code. */
> -char __initdata boot_command_line[COMMAND_LINE_SIZE];
> +char boot_command_line[COMMAND_LINE_SIZE] __ro_after_init;
> /* Untouched saved command line (eg. for /proc) */
> char *saved_command_line __ro_after_init;
> unsigned int saved_command_line_len __ro_after_init;

I needed the following (only tested x86_64 allmodconfig build):

diff --git a/include/linux/init.h b/include/linux/init.h
index 9a5973324072..e3ce68988e1b 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -112,6 +112,9 @@
#define __REFCONST .section ".ref.rodata", "a"

#ifndef __ASSEMBLY__
+
+#include <linux/cache.h>
+
/*
* Used for initialization calls..
*/
@@ -143,7 +146,7 @@ struct file_system_type;

/* Defined in init/main.c */
extern int do_one_initcall(initcall_t fn);
-extern char __initdata boot_command_line[];
+extern char boot_command_line[] __ro_after_init;
extern char *saved_command_line;
extern unsigned int saved_command_line_len;
extern unsigned int reset_devices;
diff --git a/init/main.c b/init/main.c
index c946ab87783a..981170da0b1c 100644
--- a/init/main.c
+++ b/init/main.c
@@ -135,7 +135,7 @@ EXPORT_SYMBOL(system_state);
void (*__initdata late_time_init)(void);

/* Untouched command line saved by arch-specific code. */
-char __initdata boot_command_line[COMMAND_LINE_SIZE];
+char boot_command_line[COMMAND_LINE_SIZE] __ro_after_init;
/* Untouched saved command line (eg. for /proc) */
char *saved_command_line __ro_after_init;
unsigned int saved_command_line_len __ro_after_init;

--
Cheers,
Stephen Rothwell

Attachment: pgpcVsRj8EI_k.pgp
Description: OpenPGP digital signature