tracing: More fixes for 5.7
Subsystems (3)
Steven Rostedt
maintainercover tracing: More fixes for 5.7
Masami Hiramatsu (1):
bootconfig: Fix to prevent warning message if no bootconfig option
Steven Rostedt (VMware) (2):
tools/bootconfig: Fix apply_xbc() to return zero on success
tracing: Wait for preempt irq delay thread to execute
----
init/main.c | 10 ++++++---- kernel/trace/preemptirq_delay_test.c | 12 ++++++++++-- tools/bootconfig/main.c | 1 + 3 files changed, 17 insertions(+), 6 deletions(-)
Steven Rostedt
maintainerPATCH 1/3 tools/bootconfig: Fix apply_xbc() to return zero on success
From: "Steven Rostedt (VMware)" <[email protected]>
The return of apply_xbc() returns the result of the last write() call, which is not what is expected. It should only return zero on success.
--- tools/bootconfig/main.c | 1 + 1 file changed, 1 insertion(+)
tools/bootconfig/main.c +1 -0
@@ -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);
Signature · 1 line
2.26.2
Steven Rostedt
maintainerPATCH 2/3 tracing: Wait for preempt irq delay thread to execute
In reply to Steven RostedtFrom: "Steven Rostedt (VMware)" <[email protected]>
A bug report was posted that running the preempt irq delay module on a slow machine, and removing it quickly could lead to the thread created by the modlue to execute after the module is removed, and this could cause the kernel to crash. The fix for this was to call kthread_stop() after creating the thread to make sure it finishes before allowing the module to be removed.
Now this caused the opposite problem on fast machines. What now happens is the kthread_stop() can cause the kthread never to execute and the test never to run. To fix this, add a completion and wait for the kthread to execute, then wait for it to end.
This issue caused the ftracetest selftests to fail on the preemptirq tests.
--- kernel/trace/preemptirq_delay_test.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
kernel/trace/preemptirq_delay_test.c +10 -2
@@ -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" ;
@@ -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)
@@ -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 ();
@@ -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 ; }
Signature · 1 line
2.26.2
Steven Rostedt
maintainerPATCH 3/3 bootconfig: Fix to prevent warning message if no bootconfig option
In reply to Steven RostedtFrom: Masami Hiramatsu <[email protected]>
Commit de462e5f1071 ("bootconfig: Fix to remove bootconfig data from initrd while boot") causes a cosmetic regression on dmesg, which warns "no bootconfig data" message without bootconfig cmdline option.
Fix setup_boot_config() by moving no bootconfig check after commandline option check.
--- init/main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
init/main.c +6 -4
@@ -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,
@@ -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 );
@@ -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
Signature · 1 line
2.26.2
Re: [for-linus][PATCH 3/3] bootconfig: Fix to prevent warning message if no bootconfig option
Dear Steven,
Am 12.05.20 um 15:23 schrieb Steven Rostedt:
Quoted 7 lines
From: Masami Hiramatsu <[email protected]>
Commit
de462e5f1071("bootconfig: Fix to remove bootconfig data from initrd while boot") causes a cosmetic regression on dmesg, which warns "no bootconfig data" message without bootconfig cmdline option.
Quoted 5 lines
Fix
setup_boot_config()by moving no bootconfig check after commandline option check.
It’d be great if you could update your script to include HTTPS URLs. That would save one redirect.
``` $ curl -I http://lkml.kernel.org/r/[email protected] HTTP/1.1 301 Moved Permanently [ prevent LKML HTML mail detection ] ```
Quoted 36 lines
Fixes de462e5f1071 ("bootconfig: Fix to remove bootconfig data from initrd while boot")Reported-by Paul Menzel <[email protected]>Signed-off-by Masami Hiramatsu <[email protected]>Signed-off-by Steven Rostedt (VMware) <[email protected]>--- init/main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)init/main.c +6
-2@@ -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,@@ -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 );
init/main.c static void __init setup_boot_config(const char *cmdline) · line 455
Quoted 8 lines
init/main.c +0
-2@@ -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
Kind regards,
Paul
A message that is not in the archive (sent off-list or not yet received): [email protected]
Steven Rostedt
maintainerRe: [for-linus][PATCH 3/3] bootconfig: Fix to prevent warning message if no bootconfig option
Quoted 11 lines · On Tue, 12 May 2020 16:36:53 +0200 Paul Menzel <[email protected]> wrote:
Dear Steven,
Am 12.05.20 um 15:23 schrieb Steven Rostedt:
Quoted 7 lines
From: Masami Hiramatsu <[email protected]>
Commit
de462e5f1071("bootconfig: Fix to remove bootconfig data from initrd while boot") causes a cosmetic regression on dmesg, which warns "no bootconfig data" message without bootconfig cmdline option.
Quoted 8 lines
Quoted 5 lines
Fix
setup_boot_config()by moving no bootconfig check after commandline option check.It’d be great if you could update your script to include HTTPS URLs. That would save one redirect.
Never thought of that as an issue, but sure, it's easy enough to fix.
Quoted 2 lines
Reviewed-by Paul Menzel <[email protected]>
Thanks,
-- Steve