Skip to content

Commit

Permalink
Merge tag 'trace-v5.7-rc4' of git://git.kernel.org/pub/scm/linux/kern…
Browse files Browse the repository at this point in the history
…el/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
  • Loading branch information
Linus Torvalds committed May 12, 2020
2 parents 8ec91c0 + 611d0a9 commit 24085f7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
10 changes: 6 additions & 4 deletions init/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -400,9 +400,8 @@ static void __init setup_boot_config(const char *cmdline)
char *data, *copy;
int ret;

/* Cut out the bootconfig data even if we have no bootconfig option */
data = get_boot_config_from_initrd(&size, &csum);
if (!data)
goto not_found;

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

if (!data) {
pr_err("'bootconfig' found on command line, but no bootconfig found\n");
return;
}

if (size >= XBC_DATA_MAX) {
pr_err("bootconfig size %d greater than max size %d\n",
size, XBC_DATA_MAX);
Expand Down Expand Up @@ -446,8 +450,6 @@ static void __init setup_boot_config(const char *cmdline)
extra_init_args = xbc_make_cmdline("init");
}
return;
not_found:
pr_err("'bootconfig' found on command line, but no bootconfig found\n");
}

#else
Expand Down
12 changes: 10 additions & 2 deletions kernel/trace/preemptirq_delay_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include <linux/printk.h>
#include <linux/string.h>
#include <linux/sysfs.h>
#include <linux/completion.h>

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

static struct completion done;

#define MIN(x, y) ((x) < (y) ? (x) : (y))

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

complete(&done);

set_current_state(TASK_INTERRUPTIBLE);
while (!kthread_should_stop()) {
schedule();
Expand All @@ -128,15 +133,18 @@ static int preemptirq_delay_run(void *data)
static int preemptirq_run_test(void)
{
struct task_struct *task;

char task_name[50];

init_completion(&done);

snprintf(task_name, sizeof(task_name), "%s_test", test_mode);
task = kthread_run(preemptirq_delay_run, NULL, task_name);
if (IS_ERR(task))
return PTR_ERR(task);
if (task)
if (task) {
wait_for_completion(&done);
kthread_stop(task);
}
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions tools/bootconfig/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ int apply_xbc(const char *path, const char *xbc_path)
pr_err("Failed to apply a boot config magic: %d\n", ret);
goto out;
}
ret = 0;
out:
close(fd);
free(data);
Expand Down

0 comments on commit 24085f7

Please sign in to comment.