Skip to contentSkip to conversation

tracing: More fixes for 5.7

PATCH In review Steven Rostedt 2 participants 6 messages May 12, 2020 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
author maintainer
#1 lore raw

PATCH 1/3 tools/bootconfig: Fix apply_xbc() to return zero on success

In reply to Steven Rostedt

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.

Fixes 8842604446d1 ("tools/bootconfig: Fix resource leak in apply_xbc()")
---
 tools/bootconfig/main.c | 1 +
 1 file changed, 1 insertion(+)
tools/bootconfig/main.c +1 -0
index 001076c51712..0efaf45f7367 100644
@@ -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
author maintainer
#3 lore raw

PATCH 3/3 bootconfig: Fix to prevent warning message if no bootconfig option

In reply to Steven Rostedt

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.

Fix setup_boot_config() by moving no bootconfig check after commandline option check.

Fixes de462e5f1071 ("bootconfig: Fix to remove bootconfig data from initrd while boot")
---
 init/main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
init/main.c +6 -4
index 1a5da2c2660c..5803ecb411ab 100644
@@ -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

Steven Rostedt

author maintainer
#0 lore raw

cover 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(-)
author maintainer
#2 lore raw

PATCH 2/3 tracing: Wait for preempt irq delay thread to execute

From: "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.

Fixes d16a8c31077e ("tracing: Wait for preempt irq delay thread to finish")
---
 kernel/trace/preemptirq_delay_test.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
kernel/trace/preemptirq_delay_test.c +10 -2
index c4c86de63cf9..312d1a0ca3b6 100644
@@ -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
Reviewed-by on v1 3/3
#4 lore raw

Re: [for-linus][PATCH 3/3] bootconfig: Fix to prevent warning message if no bootconfig option

In reply to Steven Rostedt

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")
---
  init/main.c | 10 ++++++----
  1 file changed, 6 insertions(+), 4 deletions(-)
init/main.c +6 -2
index 1a5da2c2660c..5803ecb411ab 100644
@@ -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

author maintainer
#6 lore raw

Re: [for-linus][PATCH 3/3] bootconfig: Fix to prevent warning message if no bootconfig option

In reply to a message not in the archive
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

Thanks,

-- Steve