Commit 24085f70 authored by Linus Torvalds's avatar Linus Torvalds

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
parents 8ec91c0f 611d0a95
...@@ -400,9 +400,8 @@ static void __init setup_boot_config(const char *cmdline) ...@@ -400,9 +400,8 @@ static void __init setup_boot_config(const char *cmdline)
char *data, *copy; char *data, *copy;
int ret; int ret;
/* Cut out the bootconfig data even if we have no bootconfig option */
data = get_boot_config_from_initrd(&size, &csum); data = get_boot_config_from_initrd(&size, &csum);
if (!data)
goto not_found;
strlcpy(tmp_cmdline, boot_command_line, COMMAND_LINE_SIZE); strlcpy(tmp_cmdline, boot_command_line, COMMAND_LINE_SIZE);
parse_args("bootconfig", tmp_cmdline, NULL, 0, 0, 0, NULL, parse_args("bootconfig", tmp_cmdline, NULL, 0, 0, 0, NULL,
...@@ -411,6 +410,11 @@ static void __init setup_boot_config(const char *cmdline) ...@@ -411,6 +410,11 @@ static void __init setup_boot_config(const char *cmdline)
if (!bootconfig_found) if (!bootconfig_found)
return; return;
if (!data) {
pr_err("'bootconfig' found on command line, but no bootconfig found\n");
return;
}
if (size >= XBC_DATA_MAX) { if (size >= XBC_DATA_MAX) {
pr_err("bootconfig size %d greater than max size %d\n", pr_err("bootconfig size %d greater than max size %d\n",
size, XBC_DATA_MAX); size, XBC_DATA_MAX);
...@@ -446,8 +450,6 @@ static void __init setup_boot_config(const char *cmdline) ...@@ -446,8 +450,6 @@ static void __init setup_boot_config(const char *cmdline)
extra_init_args = xbc_make_cmdline("init"); extra_init_args = xbc_make_cmdline("init");
} }
return; return;
not_found:
pr_err("'bootconfig' found on command line, but no bootconfig found\n");
} }
#else #else
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <linux/printk.h> #include <linux/printk.h>
#include <linux/string.h> #include <linux/string.h>
#include <linux/sysfs.h> #include <linux/sysfs.h>
#include <linux/completion.h>
static ulong delay = 100; static ulong delay = 100;
static char test_mode[12] = "irq"; static char test_mode[12] = "irq";
...@@ -28,6 +29,8 @@ MODULE_PARM_DESC(delay, "Period in microseconds (100 us default)"); ...@@ -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(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)"); MODULE_PARM_DESC(burst_size, "The size of a burst (default 1)");
static struct completion done;
#define MIN(x, y) ((x) < (y) ? (x) : (y)) #define MIN(x, y) ((x) < (y) ? (x) : (y))
static void busy_wait(ulong time) static void busy_wait(ulong time)
...@@ -114,6 +117,8 @@ static int preemptirq_delay_run(void *data) ...@@ -114,6 +117,8 @@ static int preemptirq_delay_run(void *data)
for (i = 0; i < s; i++) for (i = 0; i < s; i++)
(testfuncs[i])(i); (testfuncs[i])(i);
complete(&done);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
while (!kthread_should_stop()) { while (!kthread_should_stop()) {
schedule(); schedule();
...@@ -128,15 +133,18 @@ static int preemptirq_delay_run(void *data) ...@@ -128,15 +133,18 @@ static int preemptirq_delay_run(void *data)
static int preemptirq_run_test(void) static int preemptirq_run_test(void)
{ {
struct task_struct *task; struct task_struct *task;
char task_name[50]; char task_name[50];
init_completion(&done);
snprintf(task_name, sizeof(task_name), "%s_test", test_mode); snprintf(task_name, sizeof(task_name), "%s_test", test_mode);
task = kthread_run(preemptirq_delay_run, NULL, task_name); task = kthread_run(preemptirq_delay_run, NULL, task_name);
if (IS_ERR(task)) if (IS_ERR(task))
return PTR_ERR(task); return PTR_ERR(task);
if (task) if (task) {
wait_for_completion(&done);
kthread_stop(task); kthread_stop(task);
}
return 0; return 0;
} }
......
...@@ -337,6 +337,7 @@ int apply_xbc(const char *path, const char *xbc_path) ...@@ -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); pr_err("Failed to apply a boot config magic: %d\n", ret);
goto out; goto out;
} }
ret = 0;
out: out:
close(fd); close(fd);
free(data); free(data);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment