diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2021-09-09 13:11:15 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2021-09-09 13:11:15 -0700 |
commit | 43175623dd0dffccacbf014e368ee77f77c73898 (patch) | |
tree | 6d4e2cbcf7207bd4c98cb6b2b43330f507560290 /init/main.c | |
parent | f154c806676ad7153c6e161f30c53a44855329d6 (diff) | |
parent | cfd799837dbc48499abb05d1891b3d9992354d3a (diff) |
Merge tag 'trace-v5.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull more tracing updates from Steven Rostedt:
- Add migrate-disable counter to tracing header
- Fix error handling in event probes
- Fix missed unlock in osnoise in error path
- Fix merge issue with tools/bootconfig
- Clean up bootconfig data when init memory is removed
- Fix bootconfig to loop only on subkeys
- Have kernel command lines override bootconfig options
- Increase field counts for synthetic events
- Have histograms dynamic allocate event elements to save space
- Fixes in testing and documentation
* tag 'trace-v5.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
tracing/boot: Fix to loop on only subkeys
selftests/ftrace: Exclude "(fault)" in testing add/remove eprobe events
tracing: Dynamically allocate the per-elt hist_elt_data array
tracing: synth events: increase max fields count
tools/bootconfig: Show whole test command for each test case
bootconfig: Fix missing return check of xbc_node_compose_key function
tools/bootconfig: Fix tracing_on option checking in ftrace2bconf.sh
docs: bootconfig: Add how to use bootconfig for kernel parameters
init/bootconfig: Reorder init parameter from bootconfig and cmdline
init: bootconfig: Remove all bootconfig data when the init memory is removed
tracing/osnoise: Fix missed cpus_read_unlock() in start_per_cpu_kthreads()
tracing: Fix some alloc_event_probe() error handling bugs
tracing: Add migrate-disabled counter to tracing output.
Diffstat (limited to 'init/main.c')
-rw-r--r-- | init/main.c | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/init/main.c b/init/main.c index 733e1471d95f..5c9a48df90e1 100644 --- a/init/main.c +++ b/init/main.c @@ -153,10 +153,10 @@ static char *extra_init_args; #ifdef CONFIG_BOOT_CONFIG /* Is bootconfig on command line? */ static bool bootconfig_found; -static bool initargs_found; +static size_t initargs_offs; #else # define bootconfig_found false -# define initargs_found false +# define initargs_offs 0 #endif static char *execute_command; @@ -422,9 +422,9 @@ static void __init setup_boot_config(void) if (IS_ERR(err) || !bootconfig_found) return; - /* parse_args() stops at '--' and returns an address */ + /* parse_args() stops at the next param of '--' and returns an address */ if (err) - initargs_found = true; + initargs_offs = err - tmp_cmdline; if (!data) { pr_err("'bootconfig' found on command line, but no bootconfig found\n"); @@ -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. */ @@ -646,16 +655,21 @@ static void __init setup_command_line(char *command_line) * Append supplemental init boot args to saved_command_line * so that user can check what command line options passed * to init. + * The order should always be + * " -- "[bootconfig init-param][cmdline init-param] */ - len = strlen(saved_command_line); - if (initargs_found) { - saved_command_line[len++] = ' '; + if (initargs_offs) { + len = xlen + initargs_offs; + strcpy(saved_command_line + len, extra_init_args); + len += ilen - 4; /* strlen(extra_init_args) */ + strcpy(saved_command_line + len, + boot_command_line + initargs_offs - 1); } else { + len = strlen(saved_command_line); strcpy(saved_command_line + len, " -- "); len += 4; + strcpy(saved_command_line + len, extra_init_args); } - - strcpy(saved_command_line + len, extra_init_args); } } @@ -1494,6 +1508,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(); |