Skip to content

Commit 24085f7

Browse files
committed
Merge tag 'trace-v5.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing fixes from Steven Rostedt: "Fixes to previous fixes. Unfortunately, the last set of fixes introduced some minor bugs: - The bootconfig apply_xbc() leak fix caused the application to return a positive number on success, when it should have returned zero. - The preempt_irq_delay_thread fix to make the creation code wait for the kthread to finish to prevent it from executing after module unload, can now cause the kthread to exit before it even executes (preventing it to run its tests). - The fix to the bootconfig that fixed the initrd to remove the bootconfig from causing the kernel to panic, now prints a warning that the bootconfig is not found, even when bootconfig is not on the command line" * tag 'trace-v5.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: bootconfig: Fix to prevent warning message if no bootconfig option tracing: Wait for preempt irq delay thread to execute tools/bootconfig: Fix apply_xbc() to return zero on success
2 parents 8ec91c0 + 611d0a9 commit 24085f7

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

init/main.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -400,9 +400,8 @@ static void __init setup_boot_config(const char *cmdline)
400400
char *data, *copy;
401401
int ret;
402402

403+
/* Cut out the bootconfig data even if we have no bootconfig option */
403404
data = get_boot_config_from_initrd(&size, &csum);
404-
if (!data)
405-
goto not_found;
406405

407406
strlcpy(tmp_cmdline, boot_command_line, COMMAND_LINE_SIZE);
408407
parse_args("bootconfig", tmp_cmdline, NULL, 0, 0, 0, NULL,
@@ -411,6 +410,11 @@ static void __init setup_boot_config(const char *cmdline)
411410
if (!bootconfig_found)
412411
return;
413412

413+
if (!data) {
414+
pr_err("'bootconfig' found on command line, but no bootconfig found\n");
415+
return;
416+
}
417+
414418
if (size >= XBC_DATA_MAX) {
415419
pr_err("bootconfig size %d greater than max size %d\n",
416420
size, XBC_DATA_MAX);
@@ -446,8 +450,6 @@ static void __init setup_boot_config(const char *cmdline)
446450
extra_init_args = xbc_make_cmdline("init");
447451
}
448452
return;
449-
not_found:
450-
pr_err("'bootconfig' found on command line, but no bootconfig found\n");
451453
}
452454

453455
#else

kernel/trace/preemptirq_delay_test.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/printk.h>
1717
#include <linux/string.h>
1818
#include <linux/sysfs.h>
19+
#include <linux/completion.h>
1920

2021
static ulong delay = 100;
2122
static char test_mode[12] = "irq";
@@ -28,6 +29,8 @@ MODULE_PARM_DESC(delay, "Period in microseconds (100 us default)");
2829
MODULE_PARM_DESC(test_mode, "Mode of the test such as preempt, irq, or alternate (default irq)");
2930
MODULE_PARM_DESC(burst_size, "The size of a burst (default 1)");
3031

32+
static struct completion done;
33+
3134
#define MIN(x, y) ((x) < (y) ? (x) : (y))
3235

3336
static void busy_wait(ulong time)
@@ -114,6 +117,8 @@ static int preemptirq_delay_run(void *data)
114117
for (i = 0; i < s; i++)
115118
(testfuncs[i])(i);
116119

120+
complete(&done);
121+
117122
set_current_state(TASK_INTERRUPTIBLE);
118123
while (!kthread_should_stop()) {
119124
schedule();
@@ -128,15 +133,18 @@ static int preemptirq_delay_run(void *data)
128133
static int preemptirq_run_test(void)
129134
{
130135
struct task_struct *task;
131-
132136
char task_name[50];
133137

138+
init_completion(&done);
139+
134140
snprintf(task_name, sizeof(task_name), "%s_test", test_mode);
135141
task = kthread_run(preemptirq_delay_run, NULL, task_name);
136142
if (IS_ERR(task))
137143
return PTR_ERR(task);
138-
if (task)
144+
if (task) {
145+
wait_for_completion(&done);
139146
kthread_stop(task);
147+
}
140148
return 0;
141149
}
142150

tools/bootconfig/main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ int apply_xbc(const char *path, const char *xbc_path)
337337
pr_err("Failed to apply a boot config magic: %d\n", ret);
338338
goto out;
339339
}
340+
ret = 0;
340341
out:
341342
close(fd);
342343
free(data);

0 commit comments

Comments
 (0)