All of lore.kernel.org
 help / color / mirror / Atom feed
* [for-linus][PATCH 0/3] tracing: More fixes for 5.7
@ 2020-05-12 13:23 Steven Rostedt
  2020-05-12 13:23 ` [for-linus][PATCH 1/3] tools/bootconfig: Fix apply_xbc() to return zero on success Steven Rostedt
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Steven Rostedt @ 2020-05-12 13:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton


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(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [for-linus][PATCH 1/3] tools/bootconfig: Fix apply_xbc() to return zero on success
  2020-05-12 13:23 [for-linus][PATCH 0/3] tracing: More fixes for 5.7 Steven Rostedt
@ 2020-05-12 13:23 ` Steven Rostedt
  2020-05-12 13:23 ` [for-linus][PATCH 2/3] tracing: Wait for preempt irq delay thread to execute Steven Rostedt
  2020-05-12 13:23 ` [for-linus][PATCH 3/3] bootconfig: Fix to prevent warning message if no bootconfig option Steven Rostedt
  2 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2020-05-12 13:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Dan Carpenter, Masami Hiramatsu

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

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.

Link: https://lore.kernel.org/r/20200508093059.GF9365@kadam

Fixes: 8842604446d1 ("tools/bootconfig: Fix resource leak in apply_xbc()")
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Tested-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 tools/bootconfig/main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/bootconfig/main.c b/tools/bootconfig/main.c
index 001076c51712..0efaf45f7367 100644
--- a/tools/bootconfig/main.c
+++ b/tools/bootconfig/main.c
@@ -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);
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [for-linus][PATCH 2/3] tracing: Wait for preempt irq delay thread to execute
  2020-05-12 13:23 [for-linus][PATCH 0/3] tracing: More fixes for 5.7 Steven Rostedt
  2020-05-12 13:23 ` [for-linus][PATCH 1/3] tools/bootconfig: Fix apply_xbc() to return zero on success Steven Rostedt
@ 2020-05-12 13:23 ` Steven Rostedt
  2020-05-12 13:23 ` [for-linus][PATCH 3/3] bootconfig: Fix to prevent warning message if no bootconfig option Steven Rostedt
  2 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2020-05-12 13:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, stable, Joel Fernandes (Google)

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

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.

Link: https://lore.kernel.org/r/20200510114210.15d9e4af@oasis.local.home

Cc: stable@vger.kernel.org
Fixes: d16a8c31077e ("tracing: Wait for preempt irq delay thread to finish")
Reviewed-by: Joel Fernandes (Google) <joel@joelfernandes.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/preemptirq_delay_test.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/kernel/trace/preemptirq_delay_test.c b/kernel/trace/preemptirq_delay_test.c
index c4c86de63cf9..312d1a0ca3b6 100644
--- a/kernel/trace/preemptirq_delay_test.c
+++ b/kernel/trace/preemptirq_delay_test.c
@@ -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;
 }
 
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [for-linus][PATCH 3/3] bootconfig: Fix to prevent warning message if no bootconfig option
  2020-05-12 13:23 [for-linus][PATCH 0/3] tracing: More fixes for 5.7 Steven Rostedt
  2020-05-12 13:23 ` [for-linus][PATCH 1/3] tools/bootconfig: Fix apply_xbc() to return zero on success Steven Rostedt
  2020-05-12 13:23 ` [for-linus][PATCH 2/3] tracing: Wait for preempt irq delay thread to execute Steven Rostedt
@ 2020-05-12 13:23 ` Steven Rostedt
  2020-05-12 14:40   ` Paul Menzel
       [not found]   ` <0686d98b-5eba-b761-6d84-f93edfbbb5a6@molgen.mpg.de>
  2 siblings, 2 replies; 6+ messages in thread
From: Steven Rostedt @ 2020-05-12 13:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Paul Menzel, Masami Hiramatsu

From: Masami Hiramatsu <mhiramat@kernel.org>

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.

Link: http://lkml.kernel.org/r/9b1ba335-071d-c983-89a4-2677b522dcc8@molgen.mpg.de
Link: http://lkml.kernel.org/r/158916116468.21787.14558782332170588206.stgit@devnote2

Fixes: de462e5f1071 ("bootconfig: Fix to remove bootconfig data from initrd while boot")
Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 init/main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/init/main.c b/init/main.c
index 1a5da2c2660c..5803ecb411ab 100644
--- a/init/main.c
+++ b/init/main.c
@@ -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
-- 
2.26.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [for-linus][PATCH 3/3] bootconfig: Fix to prevent warning message if no bootconfig option
  2020-05-12 13:23 ` [for-linus][PATCH 3/3] bootconfig: Fix to prevent warning message if no bootconfig option Steven Rostedt
@ 2020-05-12 14:40   ` Paul Menzel
       [not found]   ` <0686d98b-5eba-b761-6d84-f93edfbbb5a6@molgen.mpg.de>
  1 sibling, 0 replies; 6+ messages in thread
From: Paul Menzel @ 2020-05-12 14:40 UTC (permalink / raw)
  To: Steven Rostedt, linux-kernel; +Cc: Ingo Molnar, Andrew Morton, Masami Hiramatsu

Dear Steven,


Am 12.05.20 um 15:23 schrieb Steven Rostedt:
> From: Masami Hiramatsu <mhiramat@kernel.org>
> 
> 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.
> 
> Link: http://lkml.kernel.org/r/9b1ba335-071d-c983-89a4-2677b522dcc8@molgen.mpg.de
> Link: http://lkml.kernel.org/r/158916116468.21787.14558782332170588206.stgit@devnote2

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/9b1ba335-071d-c983-89a4-2677b522dcc8@molgen.mpg.de
HTTP/1.1 301 Moved Permanently
[ prevent LKML HTML mail detection ]
```

> Fixes: de462e5f1071 ("bootconfig: Fix to remove bootconfig data from initrd while boot")
> Reported-by: Paul Menzel <pmenzel@molgen.mpg.de>
> Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
> Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
> ---
>   init/main.c | 10 ++++++----
>   1 file changed, 6 insertions(+), 4 deletions(-)
> 
> diff --git a/init/main.c b/init/main.c
> index 1a5da2c2660c..5803ecb411ab 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -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

Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [for-linus][PATCH 3/3] bootconfig: Fix to prevent warning message if no bootconfig option
       [not found]   ` <0686d98b-5eba-b761-6d84-f93edfbbb5a6@molgen.mpg.de>
@ 2020-05-12 14:41     ` Steven Rostedt
  0 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2020-05-12 14:41 UTC (permalink / raw)
  To: Paul Menzel; +Cc: linux-kernel, Ingo Molnar, Andrew Morton, Masami Hiramatsu

On Tue, 12 May 2020 16:36:53 +0200
Paul Menzel <pmenzel@molgen.mpg.de> wrote:

> Dear Steven,
> 
> 
> Am 12.05.20 um 15:23 schrieb Steven Rostedt:
> > From: Masami Hiramatsu <mhiramat@kernel.org>
> > 
> > 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.
> > 
> > Link: http://lkml.kernel.org/r/9b1ba335-071d-c983-89a4-2677b522dcc8@molgen.mpg.de
> > Link: http://lkml.kernel.org/r/158916116468.21787.14558782332170588206.stgit@devnote2  
> 
> 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.

> 
> Reviewed-by: Paul Menzel <pmenzel@molgen.mpg.de>

Thanks,

-- Steve

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-05-12 14:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-12 13:23 [for-linus][PATCH 0/3] tracing: More fixes for 5.7 Steven Rostedt
2020-05-12 13:23 ` [for-linus][PATCH 1/3] tools/bootconfig: Fix apply_xbc() to return zero on success Steven Rostedt
2020-05-12 13:23 ` [for-linus][PATCH 2/3] tracing: Wait for preempt irq delay thread to execute Steven Rostedt
2020-05-12 13:23 ` [for-linus][PATCH 3/3] bootconfig: Fix to prevent warning message if no bootconfig option Steven Rostedt
2020-05-12 14:40   ` Paul Menzel
     [not found]   ` <0686d98b-5eba-b761-6d84-f93edfbbb5a6@molgen.mpg.de>
2020-05-12 14:41     ` Steven Rostedt

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.