All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Masami Hiramatsu <mhiramat@kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH v3 1/6] init: bootconfig: Remove all bootconfig data when the init memory is removed
Date: Sun,  5 Sep 2021 00:54:09 +0900	[thread overview]
Message-ID: <163077084958.222577.5924961258513004428.stgit@devnote2> (raw)
In-Reply-To: <163077084169.222577.4459698040375322439.stgit@devnote2>

Since the bootconfig is used only in the init functions,
it doesn't need to keep the data after boot. Free it when
the init memory is removed.

Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
---
 Changes in v2:
  - introduce exit_boot_config() wrapper for !CONFIG_BOOT_CONFIG
---
 init/main.c |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/init/main.c b/init/main.c
index 8d97aba78c3a..d35c4a865adb 100644
--- a/init/main.c
+++ b/init/main.c
@@ -468,7 +468,12 @@ static void __init setup_boot_config(void)
 	return;
 }
 
-#else
+static void __init exit_boot_config(void)
+{
+	xbc_destroy_all();
+}
+
+#else	/* !CONFIG_BOOT_CONFIG */
 
 static void __init setup_boot_config(void)
 {
@@ -481,7 +486,11 @@ static int __init warn_bootconfig(char *str)
 	pr_warn("WARNING: 'bootconfig' found on the kernel command line but CONFIG_BOOT_CONFIG is not set.\n");
 	return 0;
 }
-#endif
+
+#define exit_boot_config()	do {} while (0)
+
+#endif	/* CONFIG_BOOT_CONFIG */
+
 early_param("bootconfig", warn_bootconfig);
 
 /* Change NUL term back to "=", to make "param" the whole string. */
@@ -1493,6 +1502,7 @@ static int __ref kernel_init(void *unused)
 	kprobe_free_init_mem();
 	ftrace_free_init_mem();
 	kgdb_free_init_mem();
+	exit_boot_config();
 	free_initmem();
 	mark_readonly();
 


  reply	other threads:[~2021-09-04 15:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-04 15:54 [PATCH v3 0/6] bootconfig: Cleanup and reorder the init parameter from bootconfig Masami Hiramatsu
2021-09-04 15:54 ` Masami Hiramatsu [this message]
2021-09-04 15:54 ` [PATCH v3 2/6] init/bootconfig: Reorder init parameter from bootconfig and cmdline Masami Hiramatsu
2021-09-04 15:54 ` [PATCH v3 3/6] docs: bootconfig: Add how to use bootconfig for kernel parameters Masami Hiramatsu
2021-09-04 15:54 ` [PATCH v3 4/6] tools/bootconfig: Fix tracing_on option checking in ftrace2bconf.sh Masami Hiramatsu
2021-09-04 15:54 ` [PATCH v3 5/6] bootconfig: Fix missing return check of xbc_node_compose_key function Masami Hiramatsu
2021-09-04 15:54 ` [PATCH v3 6/6] tools/bootconfig: Show whole test command for each test case Masami Hiramatsu
2021-09-08  3:46 ` [PATCH v3 0/6] bootconfig: Cleanup and reorder the init parameter from bootconfig Masami Hiramatsu
2021-09-08  7:28   ` Steven Rostedt

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=163077084958.222577.5924961258513004428.stgit@devnote2 \
    --to=mhiramat@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --subject='Re: [PATCH v3 1/6] init: bootconfig: Remove all bootconfig data when the init memory is removed' \
    /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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.