All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/3] x86 bugfixes for LTO
@ 2018-02-02 14:54 Arnd Bergmann
  2018-02-02 14:56 ` [PATCH 1/3] x86: dumpstack: avoid uninitlized variable Arnd Bergmann
  2018-02-09 22:24 ` [PATCH 0/3] x86 bugfixes for LTO Chris Wilson
  0 siblings, 2 replies; 14+ messages in thread
From: Arnd Bergmann @ 2018-02-02 14:54 UTC (permalink / raw)
  To: x86; +Cc: Nicolas Pitre, Andi Kleen, linux-kernel, Arnd Bergmann

Here are three bugfixes for x86 that I needed to get LTO-enabled
kernels to build reliably. I'm not sure abouto that first one
though.

None of these are urgent, as they don't show up in mainline
kernels and they don't indicate serious problems.

Arnd Bergmann (3):
  x86: dumpstack: avoid uninitialized variable
  x86: fix swsusp_arch_resume prototype
  x86: error_inject: make  just_return_func globally visible

 arch/x86/kernel/dumpstack.c   | 2 +-
 arch/x86/lib/error-inject.c   | 1 +
 arch/x86/power/hibernate_32.c | 2 +-
 arch/x86/power/hibernate_64.c | 2 +-
 include/linux/suspend.h       | 2 ++
 kernel/power/power.h          | 3 ---
 6 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.9.0

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

* [PATCH 1/3] x86: dumpstack: avoid uninitlized variable
  2018-02-02 14:54 [PATCH 0/3] x86 bugfixes for LTO Arnd Bergmann
@ 2018-02-02 14:56 ` Arnd Bergmann
  2018-02-02 14:56   ` [PATCH 2/3] x86: fix swsusp_arch_resume prototype Arnd Bergmann
                     ` (2 more replies)
  2018-02-09 22:24 ` [PATCH 0/3] x86 bugfixes for LTO Chris Wilson
  1 sibling, 3 replies; 14+ messages in thread
From: Arnd Bergmann @ 2018-02-02 14:56 UTC (permalink / raw)
  To: x86, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Josh Poimboeuf
  Cc: Nicolas Pitre, Andi Kleen, linux-kernel, Arnd Bergmann,
	Borislav Petkov, Andy Lutomirski, Vlastimil Babka, Dave Hansen,
	Peter Zijlstra

In some configurations, 'partial' does not get initialized,
as shown by this gcc-8 warning:

arch/x86/kernel/dumpstack.c: In function 'show_trace_log_lvl':
arch/x86/kernel/dumpstack.c:156:4: error: 'partial' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    show_regs_if_on_stack(&stack_info, regs, partial);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This initializes it to false, to get the previous behavior in
this case.

a9cdbe72c4e8 ("x86/dumpstack: Fix partial register dumps")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/kernel/dumpstack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index afbecff161d1..a2d8a3908670 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -109,7 +109,7 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
 	struct stack_info stack_info = {0};
 	unsigned long visit_mask = 0;
 	int graph_idx = 0;
-	bool partial;
+	bool partial = false;
 
 	printk("%sCall Trace:\n", log_lvl);
 
-- 
2.9.0

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

* [PATCH 2/3] x86: fix swsusp_arch_resume prototype
  2018-02-02 14:56 ` [PATCH 1/3] x86: dumpstack: avoid uninitlized variable Arnd Bergmann
@ 2018-02-02 14:56   ` Arnd Bergmann
  2018-02-02 22:37     ` [tip:x86/urgent] x86/power: Fix " tip-bot for Arnd Bergmann
  2018-02-08 10:12     ` [PATCH 2/3] x86: fix " Rafael J. Wysocki
  2018-02-02 14:56   ` [PATCH 3/3] x86: error_inject: make just_return_func globally visible Arnd Bergmann
  2018-02-02 22:36   ` [tip:x86/urgent] x86/dumpstack: Avoid uninitlized variable tip-bot for Arnd Bergmann
  2 siblings, 2 replies; 14+ messages in thread
From: Arnd Bergmann @ 2018-02-02 14:56 UTC (permalink / raw)
  To: x86, Rafael J. Wysocki, Pavel Machek, Thomas Gleixner,
	Ingo Molnar, H. Peter Anvin, Len Brown
  Cc: Nicolas Pitre, Andi Kleen, linux-kernel, Arnd Bergmann,
	Bart Van Assche, linux-pm

The declaration for swsusp_arch_resume marks it as 'asmlinkage',
but the definition in x86-32 does not, and it fails to include
the header with the declaration. This leads to a warning when
building with link-time-optimizations:

kernel/power/power.h:108:23: error: type of 'swsusp_arch_resume' does not match original declaration [-Werror=lto-type-mismatch]
 extern asmlinkage int swsusp_arch_resume(void);
                       ^
arch/x86/power/hibernate_32.c:148:0: note: 'swsusp_arch_resume' was previously declared here
 int swsusp_arch_resume(void)

This moves the declaration into a globally visible header file
and fixes up both x86 definitions to match it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/power/hibernate_32.c | 2 +-
 arch/x86/power/hibernate_64.c | 2 +-
 include/linux/suspend.h       | 2 ++
 kernel/power/power.h          | 3 ---
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/x86/power/hibernate_32.c b/arch/x86/power/hibernate_32.c
index c35fdb585c68..afc4ed7b1578 100644
--- a/arch/x86/power/hibernate_32.c
+++ b/arch/x86/power/hibernate_32.c
@@ -145,7 +145,7 @@ static inline void resume_init_first_level_page_table(pgd_t *pg_dir)
 #endif
 }
 
-int swsusp_arch_resume(void)
+asmlinkage int swsusp_arch_resume(void)
 {
 	int error;
 
diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c
index f910c514438f..0ef5e5204968 100644
--- a/arch/x86/power/hibernate_64.c
+++ b/arch/x86/power/hibernate_64.c
@@ -174,7 +174,7 @@ static int relocate_restore_code(void)
 	return 0;
 }
 
-int swsusp_arch_resume(void)
+asmlinkage int swsusp_arch_resume(void)
 {
 	int error;
 
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index cc22a24516d6..440b62f7502e 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -384,6 +384,8 @@ extern int swsusp_page_is_forbidden(struct page *);
 extern void swsusp_set_page_free(struct page *);
 extern void swsusp_unset_page_free(struct page *);
 extern unsigned long get_safe_page(gfp_t gfp_mask);
+extern asmlinkage int swsusp_arch_suspend(void);
+extern asmlinkage int swsusp_arch_resume(void);
 
 extern void hibernation_set_ops(const struct platform_hibernation_ops *ops);
 extern int hibernate(void);
diff --git a/kernel/power/power.h b/kernel/power/power.h
index f29cd178df90..9e58bdc8a562 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -104,9 +104,6 @@ extern int in_suspend;
 extern dev_t swsusp_resume_device;
 extern sector_t swsusp_resume_block;
 
-extern asmlinkage int swsusp_arch_suspend(void);
-extern asmlinkage int swsusp_arch_resume(void);
-
 extern int create_basic_memory_bitmaps(void);
 extern void free_basic_memory_bitmaps(void);
 extern int hibernate_preallocate_memory(void);
-- 
2.9.0

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

* [PATCH 3/3] x86: error_inject: make  just_return_func globally visible
  2018-02-02 14:56 ` [PATCH 1/3] x86: dumpstack: avoid uninitlized variable Arnd Bergmann
  2018-02-02 14:56   ` [PATCH 2/3] x86: fix swsusp_arch_resume prototype Arnd Bergmann
@ 2018-02-02 14:56   ` Arnd Bergmann
  2018-02-03 13:21     ` Masami Hiramatsu
  2018-02-13 15:25     ` [tip:x86/urgent] x86/error_inject: Make just_return_func() " tip-bot for Arnd Bergmann
  2018-02-02 22:36   ` [tip:x86/urgent] x86/dumpstack: Avoid uninitlized variable tip-bot for Arnd Bergmann
  2 siblings, 2 replies; 14+ messages in thread
From: Arnd Bergmann @ 2018-02-02 14:56 UTC (permalink / raw)
  To: x86, Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: Nicolas Pitre, Andi Kleen, linux-kernel, Arnd Bergmann,
	Masami Hiramatsu, Josef Bacik, Alexei Starovoitov

With link time optimizations enabled, I get a link failure:

./ccLbOEHX.ltrans19.ltrans.o: In function `override_function_with_return':
<artificial>:(.text+0x7f3): undefined reference to `just_return_func'

Marking the symbol .globl makes it work as expected.

Fixes: 540adea3809f ("error-injection: Separate error-injection from kprobe")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 arch/x86/lib/error-inject.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/lib/error-inject.c b/arch/x86/lib/error-inject.c
index 7b881d03d0dd..3cdf06128d13 100644
--- a/arch/x86/lib/error-inject.c
+++ b/arch/x86/lib/error-inject.c
@@ -7,6 +7,7 @@ asmlinkage void just_return_func(void);
 
 asm(
 	".type just_return_func, @function\n"
+	".globl just_return_func\n"
 	"just_return_func:\n"
 	"	ret\n"
 	".size just_return_func, .-just_return_func\n"
-- 
2.9.0

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

* [tip:x86/urgent] x86/dumpstack: Avoid uninitlized variable
  2018-02-02 14:56 ` [PATCH 1/3] x86: dumpstack: avoid uninitlized variable Arnd Bergmann
  2018-02-02 14:56   ` [PATCH 2/3] x86: fix swsusp_arch_resume prototype Arnd Bergmann
  2018-02-02 14:56   ` [PATCH 3/3] x86: error_inject: make just_return_func globally visible Arnd Bergmann
@ 2018-02-02 22:36   ` tip-bot for Arnd Bergmann
  2018-02-05 21:21     ` Arnd Bergmann
  2 siblings, 1 reply; 14+ messages in thread
From: tip-bot for Arnd Bergmann @ 2018-02-02 22:36 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: tglx, dave.hansen, jpoimboe, mingo, vbabka, nico, arnd, bpetkov,
	luto, hpa, peterz, ak, linux-kernel

Commit-ID:  ebfc15019cfa72496c674ffcb0b8ef10790dcddc
Gitweb:     https://git.kernel.org/tip/ebfc15019cfa72496c674ffcb0b8ef10790dcddc
Author:     Arnd Bergmann <arnd@arndb.de>
AuthorDate: Fri, 2 Feb 2018 15:56:17 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 2 Feb 2018 23:33:50 +0100

x86/dumpstack: Avoid uninitlized variable

In some configurations, 'partial' does not get initialized, as shown by
this gcc-8 warning:

arch/x86/kernel/dumpstack.c: In function 'show_trace_log_lvl':
arch/x86/kernel/dumpstack.c:156:4: error: 'partial' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    show_regs_if_on_stack(&stack_info, regs, partial);
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This initializes it to false, to get the previous behavior in this case.

Fixes: a9cdbe72c4e8 ("x86/dumpstack: Fix partial register dumps")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Nicolas Pitre <nico@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Josh Poimboeuf <jpoimboe@redhat.com>
Cc: Borislav Petkov <bpetkov@suse.de>
Cc: Vlastimil Babka <vbabka@suse.cz>
Link: https://lkml.kernel.org/r/20180202145634.200291-1-arnd@arndb.de

---
 arch/x86/kernel/dumpstack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index afbecff..a2d8a39 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -109,7 +109,7 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
 	struct stack_info stack_info = {0};
 	unsigned long visit_mask = 0;
 	int graph_idx = 0;
-	bool partial;
+	bool partial = false;
 
 	printk("%sCall Trace:\n", log_lvl);
 

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

* [tip:x86/urgent] x86/power: Fix swsusp_arch_resume prototype
  2018-02-02 14:56   ` [PATCH 2/3] x86: fix swsusp_arch_resume prototype Arnd Bergmann
@ 2018-02-02 22:37     ` tip-bot for Arnd Bergmann
  2018-02-08 10:12     ` [PATCH 2/3] x86: fix " Rafael J. Wysocki
  1 sibling, 0 replies; 14+ messages in thread
From: tip-bot for Arnd Bergmann @ 2018-02-02 22:37 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: len.brown, hpa, linux-kernel, tglx, arnd, rjw, nico, ak,
	bart.vanassche, mingo, pavel

Commit-ID:  328008a72d38b5bde6491e463405c34a81a65d3e
Gitweb:     https://git.kernel.org/tip/328008a72d38b5bde6491e463405c34a81a65d3e
Author:     Arnd Bergmann <arnd@arndb.de>
AuthorDate: Fri, 2 Feb 2018 15:56:18 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Fri, 2 Feb 2018 23:33:50 +0100

x86/power: Fix swsusp_arch_resume prototype

The declaration for swsusp_arch_resume marks it as 'asmlinkage', but the
definition in x86-32 does not, and it fails to include the header with the
declaration. This leads to a warning when building with
link-time-optimizations:

kernel/power/power.h:108:23: error: type of 'swsusp_arch_resume' does not match original declaration [-Werror=lto-type-mismatch]
 extern asmlinkage int swsusp_arch_resume(void);
                       ^
arch/x86/power/hibernate_32.c:148:0: note: 'swsusp_arch_resume' was previously declared here
 int swsusp_arch_resume(void)

This moves the declaration into a globally visible header file and fixes up
both x86 definitions to match it.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Len Brown <len.brown@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Nicolas Pitre <nico@linaro.org>
Cc: linux-pm@vger.kernel.org
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Pavel Machek <pavel@ucw.cz>
Cc: Bart Van Assche <bart.vanassche@wdc.com>
Link: https://lkml.kernel.org/r/20180202145634.200291-2-arnd@arndb.de

---
 arch/x86/power/hibernate_32.c | 2 +-
 arch/x86/power/hibernate_64.c | 2 +-
 include/linux/suspend.h       | 2 ++
 kernel/power/power.h          | 3 ---
 4 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/x86/power/hibernate_32.c b/arch/x86/power/hibernate_32.c
index c35fdb5..afc4ed7 100644
--- a/arch/x86/power/hibernate_32.c
+++ b/arch/x86/power/hibernate_32.c
@@ -145,7 +145,7 @@ static inline void resume_init_first_level_page_table(pgd_t *pg_dir)
 #endif
 }
 
-int swsusp_arch_resume(void)
+asmlinkage int swsusp_arch_resume(void)
 {
 	int error;
 
diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c
index f910c51..0ef5e520 100644
--- a/arch/x86/power/hibernate_64.c
+++ b/arch/x86/power/hibernate_64.c
@@ -174,7 +174,7 @@ out:
 	return 0;
 }
 
-int swsusp_arch_resume(void)
+asmlinkage int swsusp_arch_resume(void)
 {
 	int error;
 
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index cc22a24..440b62f 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -384,6 +384,8 @@ extern int swsusp_page_is_forbidden(struct page *);
 extern void swsusp_set_page_free(struct page *);
 extern void swsusp_unset_page_free(struct page *);
 extern unsigned long get_safe_page(gfp_t gfp_mask);
+extern asmlinkage int swsusp_arch_suspend(void);
+extern asmlinkage int swsusp_arch_resume(void);
 
 extern void hibernation_set_ops(const struct platform_hibernation_ops *ops);
 extern int hibernate(void);
diff --git a/kernel/power/power.h b/kernel/power/power.h
index f29cd17..9e58bdc 100644
--- a/kernel/power/power.h
+++ b/kernel/power/power.h
@@ -104,9 +104,6 @@ extern int in_suspend;
 extern dev_t swsusp_resume_device;
 extern sector_t swsusp_resume_block;
 
-extern asmlinkage int swsusp_arch_suspend(void);
-extern asmlinkage int swsusp_arch_resume(void);
-
 extern int create_basic_memory_bitmaps(void);
 extern void free_basic_memory_bitmaps(void);
 extern int hibernate_preallocate_memory(void);

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

* Re: [PATCH 3/3] x86: error_inject: make  just_return_func globally visible
  2018-02-02 14:56   ` [PATCH 3/3] x86: error_inject: make just_return_func globally visible Arnd Bergmann
@ 2018-02-03 13:21     ` Masami Hiramatsu
  2018-02-13 15:25     ` [tip:x86/urgent] x86/error_inject: Make just_return_func() " tip-bot for Arnd Bergmann
  1 sibling, 0 replies; 14+ messages in thread
From: Masami Hiramatsu @ 2018-02-03 13:21 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: x86, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Nicolas Pitre,
	Andi Kleen, linux-kernel, Masami Hiramatsu, Josef Bacik,
	Alexei Starovoitov

On Fri,  2 Feb 2018 15:56:19 +0100
Arnd Bergmann <arnd@arndb.de> wrote:

> With link time optimizations enabled, I get a link failure:
> 
> ./ccLbOEHX.ltrans19.ltrans.o: In function `override_function_with_return':
> <artificial>:(.text+0x7f3): undefined reference to `just_return_func'
> 
> Marking the symbol .globl makes it work as expected.

Good catch!

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>

Thank you!

> 
> Fixes: 540adea3809f ("error-injection: Separate error-injection from kprobe")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  arch/x86/lib/error-inject.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/x86/lib/error-inject.c b/arch/x86/lib/error-inject.c
> index 7b881d03d0dd..3cdf06128d13 100644
> --- a/arch/x86/lib/error-inject.c
> +++ b/arch/x86/lib/error-inject.c
> @@ -7,6 +7,7 @@ asmlinkage void just_return_func(void);
>  
>  asm(
>  	".type just_return_func, @function\n"
> +	".globl just_return_func\n"
>  	"just_return_func:\n"
>  	"	ret\n"
>  	".size just_return_func, .-just_return_func\n"
> -- 
> 2.9.0
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

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

* Re: [tip:x86/urgent] x86/dumpstack: Avoid uninitlized variable
  2018-02-02 22:36   ` [tip:x86/urgent] x86/dumpstack: Avoid uninitlized variable tip-bot for Arnd Bergmann
@ 2018-02-05 21:21     ` Arnd Bergmann
  2018-02-05 21:39       ` Josh Poimboeuf
  0 siblings, 1 reply; 14+ messages in thread
From: Arnd Bergmann @ 2018-02-05 21:21 UTC (permalink / raw)
  To: Ingo Molnar, Dave Hansen, Josh Poimboeuf, Thomas Gleixner,
	Nicolas Pitre, Arnd Bergmann, Vlastimil Babka, Peter Zijlstra,
	Andy Lutomirski, H. Peter Anvin, bpetkov,
	Linux Kernel Mailing List, Andi Kleen
  Cc: linux-tip-commits

On Fri, Feb 2, 2018 at 11:36 PM, tip-bot for Arnd Bergmann
<tipbot@zytor.com> wrote:
> Commit-ID:  ebfc15019cfa72496c674ffcb0b8ef10790dcddc
> Gitweb:     https://git.kernel.org/tip/ebfc15019cfa72496c674ffcb0b8ef10790dcddc
> Author:     Arnd Bergmann <arnd@arndb.de>
> AuthorDate: Fri, 2 Feb 2018 15:56:17 +0100
> Committer:  Thomas Gleixner <tglx@linutronix.de>
> CommitDate: Fri, 2 Feb 2018 23:33:50 +0100
>
> x86/dumpstack: Avoid uninitlized variable
>
> In some configurations, 'partial' does not get initialized, as shown by
> this gcc-8 warning:
>
> arch/x86/kernel/dumpstack.c: In function 'show_trace_log_lvl':
> arch/x86/kernel/dumpstack.c:156:4: error: 'partial' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>     show_regs_if_on_stack(&stack_info, regs, partial);
>     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
> This initializes it to false, to get the previous behavior in this case.
>
> Fixes: a9cdbe72c4e8 ("x86/dumpstack: Fix partial register dumps")


I just noticed my annotation got lost when I sent the patch. I originally
meant to ask Josh to double-check whether it should be 'false' or 'true'
here, or if we maybe need a larger change.

Josh, could you take a look? Unfortunately I did not really understand
your original commit, so I don't know what the safe choice is here
in those cases in which 'partial' is uninitialized.

       Arnd

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

* Re: [tip:x86/urgent] x86/dumpstack: Avoid uninitlized variable
  2018-02-05 21:21     ` Arnd Bergmann
@ 2018-02-05 21:39       ` Josh Poimboeuf
  2018-02-05 21:48         ` Arnd Bergmann
  0 siblings, 1 reply; 14+ messages in thread
From: Josh Poimboeuf @ 2018-02-05 21:39 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Ingo Molnar, Dave Hansen, Thomas Gleixner, Nicolas Pitre,
	Vlastimil Babka, Peter Zijlstra, Andy Lutomirski, H. Peter Anvin,
	bpetkov, Linux Kernel Mailing List, Andi Kleen,
	linux-tip-commits

On Mon, Feb 05, 2018 at 10:21:06PM +0100, Arnd Bergmann wrote:
> On Fri, Feb 2, 2018 at 11:36 PM, tip-bot for Arnd Bergmann
> <tipbot@zytor.com> wrote:
> > Commit-ID:  ebfc15019cfa72496c674ffcb0b8ef10790dcddc
> > Gitweb:     https://git.kernel.org/tip/ebfc15019cfa72496c674ffcb0b8ef10790dcddc
> > Author:     Arnd Bergmann <arnd@arndb.de>
> > AuthorDate: Fri, 2 Feb 2018 15:56:17 +0100
> > Committer:  Thomas Gleixner <tglx@linutronix.de>
> > CommitDate: Fri, 2 Feb 2018 23:33:50 +0100
> >
> > x86/dumpstack: Avoid uninitlized variable
> >
> > In some configurations, 'partial' does not get initialized, as shown by
> > this gcc-8 warning:
> >
> > arch/x86/kernel/dumpstack.c: In function 'show_trace_log_lvl':
> > arch/x86/kernel/dumpstack.c:156:4: error: 'partial' may be used uninitialized in this function [-Werror=maybe-uninitialized]
> >     show_regs_if_on_stack(&stack_info, regs, partial);
> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >
> > This initializes it to false, to get the previous behavior in this case.
> >
> > Fixes: a9cdbe72c4e8 ("x86/dumpstack: Fix partial register dumps")
> 
> 
> I just noticed my annotation got lost when I sent the patch. I originally
> meant to ask Josh to double-check whether it should be 'false' or 'true'
> here, or if we maybe need a larger change.
> 
> Josh, could you take a look? Unfortunately I did not really understand
> your original commit, so I don't know what the safe choice is here
> in those cases in which 'partial' is uninitialized.

I think it doesn't matter, it seems to be a false positive warning.

The 'partial' variable is only used when 'regs' is non-NULL, and 'regs'
is only set in unwind_get_entry_regs() after 'partial' gets initialized.

-- 
Josh

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

* Re: [tip:x86/urgent] x86/dumpstack: Avoid uninitlized variable
  2018-02-05 21:39       ` Josh Poimboeuf
@ 2018-02-05 21:48         ` Arnd Bergmann
  0 siblings, 0 replies; 14+ messages in thread
From: Arnd Bergmann @ 2018-02-05 21:48 UTC (permalink / raw)
  To: Josh Poimboeuf
  Cc: Ingo Molnar, Dave Hansen, Thomas Gleixner, Nicolas Pitre,
	Vlastimil Babka, Peter Zijlstra, Andy Lutomirski, H. Peter Anvin,
	bpetkov, Linux Kernel Mailing List, Andi Kleen,
	linux-tip-commits

On Mon, Feb 5, 2018 at 10:39 PM, Josh Poimboeuf <jpoimboe@redhat.com> wrote:
> On Mon, Feb 05, 2018 at 10:21:06PM +0100, Arnd Bergmann wrote:
>> On Fri, Feb 2, 2018 at 11:36 PM, tip-bot for Arnd Bergmann
>> <tipbot@zytor.com> wrote:
>> > Commit-ID:  ebfc15019cfa72496c674ffcb0b8ef10790dcddc
>> > Gitweb:     https://git.kernel.org/tip/ebfc15019cfa72496c674ffcb0b8ef10790dcddc
>> > Author:     Arnd Bergmann <arnd@arndb.de>
>> > AuthorDate: Fri, 2 Feb 2018 15:56:17 +0100
>> > Committer:  Thomas Gleixner <tglx@linutronix.de>
>> > CommitDate: Fri, 2 Feb 2018 23:33:50 +0100
>> >
>> > x86/dumpstack: Avoid uninitlized variable
>> >
>> > In some configurations, 'partial' does not get initialized, as shown by
>> > this gcc-8 warning:
>> >
>> > arch/x86/kernel/dumpstack.c: In function 'show_trace_log_lvl':
>> > arch/x86/kernel/dumpstack.c:156:4: error: 'partial' may be used uninitialized in this function [-Werror=maybe-uninitialized]
>> >     show_regs_if_on_stack(&stack_info, regs, partial);
>> >     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> >
>> > This initializes it to false, to get the previous behavior in this case.
>> >
>> > Fixes: a9cdbe72c4e8 ("x86/dumpstack: Fix partial register dumps")
>>
>>
>> I just noticed my annotation got lost when I sent the patch. I originally
>> meant to ask Josh to double-check whether it should be 'false' or 'true'
>> here, or if we maybe need a larger change.
>>
>> Josh, could you take a look? Unfortunately I did not really understand
>> your original commit, so I don't know what the safe choice is here
>> in those cases in which 'partial' is uninitialized.
>
> I think it doesn't matter, it seems to be a false positive warning.
>
> The 'partial' variable is only used when 'regs' is non-NULL, and 'regs'
> is only set in unwind_get_entry_regs() after 'partial' gets initialized.

Right, got it now. So my patch is correct either way, just the description
could have been better.

       Arnd

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

* Re: [PATCH 2/3] x86: fix swsusp_arch_resume prototype
  2018-02-02 14:56   ` [PATCH 2/3] x86: fix swsusp_arch_resume prototype Arnd Bergmann
  2018-02-02 22:37     ` [tip:x86/urgent] x86/power: Fix " tip-bot for Arnd Bergmann
@ 2018-02-08 10:12     ` Rafael J. Wysocki
  1 sibling, 0 replies; 14+ messages in thread
From: Rafael J. Wysocki @ 2018-02-08 10:12 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: x86, Pavel Machek, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Len Brown, Nicolas Pitre, Andi Kleen, linux-kernel,
	Bart Van Assche, linux-pm

On Friday, February 2, 2018 3:56:18 PM CET Arnd Bergmann wrote:
> The declaration for swsusp_arch_resume marks it as 'asmlinkage',
> but the definition in x86-32 does not, and it fails to include
> the header with the declaration. This leads to a warning when
> building with link-time-optimizations:
> 
> kernel/power/power.h:108:23: error: type of 'swsusp_arch_resume' does not match original declaration [-Werror=lto-type-mismatch]
>  extern asmlinkage int swsusp_arch_resume(void);
>                        ^
> arch/x86/power/hibernate_32.c:148:0: note: 'swsusp_arch_resume' was previously declared here
>  int swsusp_arch_resume(void)
> 
> This moves the declaration into a globally visible header file
> and fixes up both x86 definitions to match it.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
>  arch/x86/power/hibernate_32.c | 2 +-
>  arch/x86/power/hibernate_64.c | 2 +-
>  include/linux/suspend.h       | 2 ++
>  kernel/power/power.h          | 3 ---
>  4 files changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/x86/power/hibernate_32.c b/arch/x86/power/hibernate_32.c
> index c35fdb585c68..afc4ed7b1578 100644
> --- a/arch/x86/power/hibernate_32.c
> +++ b/arch/x86/power/hibernate_32.c
> @@ -145,7 +145,7 @@ static inline void resume_init_first_level_page_table(pgd_t *pg_dir)
>  #endif
>  }
>  
> -int swsusp_arch_resume(void)
> +asmlinkage int swsusp_arch_resume(void)
>  {
>  	int error;
>  
> diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c
> index f910c514438f..0ef5e5204968 100644
> --- a/arch/x86/power/hibernate_64.c
> +++ b/arch/x86/power/hibernate_64.c
> @@ -174,7 +174,7 @@ static int relocate_restore_code(void)
>  	return 0;
>  }
>  
> -int swsusp_arch_resume(void)
> +asmlinkage int swsusp_arch_resume(void)
>  {
>  	int error;
>  
> diff --git a/include/linux/suspend.h b/include/linux/suspend.h
> index cc22a24516d6..440b62f7502e 100644
> --- a/include/linux/suspend.h
> +++ b/include/linux/suspend.h
> @@ -384,6 +384,8 @@ extern int swsusp_page_is_forbidden(struct page *);
>  extern void swsusp_set_page_free(struct page *);
>  extern void swsusp_unset_page_free(struct page *);
>  extern unsigned long get_safe_page(gfp_t gfp_mask);
> +extern asmlinkage int swsusp_arch_suspend(void);
> +extern asmlinkage int swsusp_arch_resume(void);
>  
>  extern void hibernation_set_ops(const struct platform_hibernation_ops *ops);
>  extern int hibernate(void);
> diff --git a/kernel/power/power.h b/kernel/power/power.h
> index f29cd178df90..9e58bdc8a562 100644
> --- a/kernel/power/power.h
> +++ b/kernel/power/power.h
> @@ -104,9 +104,6 @@ extern int in_suspend;
>  extern dev_t swsusp_resume_device;
>  extern sector_t swsusp_resume_block;
>  
> -extern asmlinkage int swsusp_arch_suspend(void);
> -extern asmlinkage int swsusp_arch_resume(void);
> -
>  extern int create_basic_memory_bitmaps(void);
>  extern void free_basic_memory_bitmaps(void);
>  extern int hibernate_preallocate_memory(void);
> 

Applied, thanks!

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

* Re: [PATCH 0/3] x86 bugfixes for LTO
  2018-02-02 14:54 [PATCH 0/3] x86 bugfixes for LTO Arnd Bergmann
  2018-02-02 14:56 ` [PATCH 1/3] x86: dumpstack: avoid uninitlized variable Arnd Bergmann
@ 2018-02-09 22:24 ` Chris Wilson
  2018-02-09 23:00   ` Andi Kleen
  1 sibling, 1 reply; 14+ messages in thread
From: Chris Wilson @ 2018-02-09 22:24 UTC (permalink / raw)
  To: Arnd Bergmann, x86; +Cc: Nicolas Pitre, Andi Kleen, linux-kernel, Arnd Bergmann

Quoting Arnd Bergmann (2018-02-02 14:54:28)
> Here are three bugfixes for x86 that I needed to get LTO-enabled
> kernels to build reliably. I'm not sure abouto that first one
> though.

Is there a howto on how to build LTO kernels? I tried Andi's lto-415-2
branch, but linking fails with lots of arcane PIE-vs-PIC errors. We are
wanting to investigate how we can use LTO to reduce our (i915.ko) module
size (by e.g. supporting a subset of chipsets).
-Chris

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

* Re: [PATCH 0/3] x86 bugfixes for LTO
  2018-02-09 22:24 ` [PATCH 0/3] x86 bugfixes for LTO Chris Wilson
@ 2018-02-09 23:00   ` Andi Kleen
  0 siblings, 0 replies; 14+ messages in thread
From: Andi Kleen @ 2018-02-09 23:00 UTC (permalink / raw)
  To: Chris Wilson; +Cc: Arnd Bergmann, x86, Nicolas Pitre, linux-kernel

On Fri, Feb 09, 2018 at 10:24:33PM +0000, Chris Wilson wrote:
> Quoting Arnd Bergmann (2018-02-02 14:54:28)
> > Here are three bugfixes for x86 that I needed to get LTO-enabled
> > kernels to build reliably. I'm not sure abouto that first one
> > though.
> 
> Is there a howto on how to build LTO kernels? I tried Andi's lto-415-2
> branch, but linking fails with lots of arcane PIE-vs-PIC errors. We are
> wanting to investigate how we can use LTO to reduce our (i915.ko) module
> size (by e.g. supporting a subset of chipsets).

What are the errors? Kernel shouldn't use PIE or PIC

-Andi

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

* [tip:x86/urgent] x86/error_inject: Make just_return_func() globally visible
  2018-02-02 14:56   ` [PATCH 3/3] x86: error_inject: make just_return_func globally visible Arnd Bergmann
  2018-02-03 13:21     ` Masami Hiramatsu
@ 2018-02-13 15:25     ` tip-bot for Arnd Bergmann
  1 sibling, 0 replies; 14+ messages in thread
From: tip-bot for Arnd Bergmann @ 2018-02-13 15:25 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: mhiramat, torvalds, arnd, hpa, jbacik, ast, nico, linux-kernel,
	peterz, mingo, tglx

Commit-ID:  01684e72f16727e6ae0aeb1392f478e11ec5b8f7
Gitweb:     https://git.kernel.org/tip/01684e72f16727e6ae0aeb1392f478e11ec5b8f7
Author:     Arnd Bergmann <arnd@arndb.de>
AuthorDate: Fri, 2 Feb 2018 15:56:19 +0100
Committer:  Ingo Molnar <mingo@kernel.org>
CommitDate: Tue, 13 Feb 2018 14:33:35 +0100

x86/error_inject: Make just_return_func() globally visible

With link time optimizations enabled, I get a link failure:

  ./ccLbOEHX.ltrans19.ltrans.o: In function `override_function_with_return':
  <artificial>:(.text+0x7f3): undefined reference to `just_return_func'

Marking the symbol .globl makes it work as expected.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Alexei Starovoitov <ast@kernel.org>
Cc: Josef Bacik <jbacik@fb.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Nicolas Pitre <nico@linaro.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Fixes: 540adea3809f ("error-injection: Separate error-injection from kprobe")
Link: http://lkml.kernel.org/r/20180202145634.200291-3-arnd@arndb.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
 arch/x86/lib/error-inject.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/lib/error-inject.c b/arch/x86/lib/error-inject.c
index 7b881d0..3cdf061 100644
--- a/arch/x86/lib/error-inject.c
+++ b/arch/x86/lib/error-inject.c
@@ -7,6 +7,7 @@ asmlinkage void just_return_func(void);
 
 asm(
 	".type just_return_func, @function\n"
+	".globl just_return_func\n"
 	"just_return_func:\n"
 	"	ret\n"
 	".size just_return_func, .-just_return_func\n"

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

end of thread, other threads:[~2018-02-13 15:26 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-02 14:54 [PATCH 0/3] x86 bugfixes for LTO Arnd Bergmann
2018-02-02 14:56 ` [PATCH 1/3] x86: dumpstack: avoid uninitlized variable Arnd Bergmann
2018-02-02 14:56   ` [PATCH 2/3] x86: fix swsusp_arch_resume prototype Arnd Bergmann
2018-02-02 22:37     ` [tip:x86/urgent] x86/power: Fix " tip-bot for Arnd Bergmann
2018-02-08 10:12     ` [PATCH 2/3] x86: fix " Rafael J. Wysocki
2018-02-02 14:56   ` [PATCH 3/3] x86: error_inject: make just_return_func globally visible Arnd Bergmann
2018-02-03 13:21     ` Masami Hiramatsu
2018-02-13 15:25     ` [tip:x86/urgent] x86/error_inject: Make just_return_func() " tip-bot for Arnd Bergmann
2018-02-02 22:36   ` [tip:x86/urgent] x86/dumpstack: Avoid uninitlized variable tip-bot for Arnd Bergmann
2018-02-05 21:21     ` Arnd Bergmann
2018-02-05 21:39       ` Josh Poimboeuf
2018-02-05 21:48         ` Arnd Bergmann
2018-02-09 22:24 ` [PATCH 0/3] x86 bugfixes for LTO Chris Wilson
2018-02-09 23:00   ` Andi Kleen

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.