2018-02-02 14:55:58

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 0/3] x86 bugfixes for LTO

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



2018-02-02 15:00:01

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 1/3] 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.

a9cdbe72c4e8 ("x86/dumpstack: Fix partial register dumps")
Signed-off-by: Arnd Bergmann <[email protected]>
---
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


2018-02-02 15:00:58

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 3/3] 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.

Fixes: 540adea3809f ("error-injection: Separate error-injection from kprobe")
Signed-off-by: Arnd Bergmann <[email protected]>
---
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


2018-02-02 15:01:15

by Arnd Bergmann

[permalink] [raw]
Subject: [PATCH 2/3] x86: 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 <[email protected]>
---
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


Subject: [tip:x86/urgent] x86/power: Fix swsusp_arch_resume prototype

Commit-ID: 328008a72d38b5bde6491e463405c34a81a65d3e
Gitweb: https://git.kernel.org/tip/328008a72d38b5bde6491e463405c34a81a65d3e
Author: Arnd Bergmann <[email protected]>
AuthorDate: Fri, 2 Feb 2018 15:56:18 +0100
Committer: Thomas Gleixner <[email protected]>
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 <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Cc: Len Brown <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Nicolas Pitre <[email protected]>
Cc: [email protected]
Cc: "Rafael J. Wysocki" <[email protected]>
Cc: Pavel Machek <[email protected]>
Cc: Bart Van Assche <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]

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

Subject: [tip:x86/urgent] x86/dumpstack: Avoid uninitlized variable

Commit-ID: ebfc15019cfa72496c674ffcb0b8ef10790dcddc
Gitweb: https://git.kernel.org/tip/ebfc15019cfa72496c674ffcb0b8ef10790dcddc
Author: Arnd Bergmann <[email protected]>
AuthorDate: Fri, 2 Feb 2018 15:56:17 +0100
Committer: Thomas Gleixner <[email protected]>
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 <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Nicolas Pitre <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Andy Lutomirski <[email protected]>
Cc: Josh Poimboeuf <[email protected]>
Cc: Borislav Petkov <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]

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


2018-02-03 13:31:36

by Masami Hiramatsu

[permalink] [raw]
Subject: Re: [PATCH 3/3] x86: error_inject: make just_return_func globally visible

On Fri, 2 Feb 2018 15:56:19 +0100
Arnd Bergmann <[email protected]> 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 <[email protected]>

Thank you!

>
> Fixes: 540adea3809f ("error-injection: Separate error-injection from kprobe")
> Signed-off-by: Arnd Bergmann <[email protected]>
> ---
> 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 <[email protected]>

2018-02-05 21:21:47

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [tip:x86/urgent] x86/dumpstack: Avoid uninitlized variable

On Fri, Feb 2, 2018 at 11:36 PM, tip-bot for Arnd Bergmann
<[email protected]> wrote:
> Commit-ID: ebfc15019cfa72496c674ffcb0b8ef10790dcddc
> Gitweb: https://git.kernel.org/tip/ebfc15019cfa72496c674ffcb0b8ef10790dcddc
> Author: Arnd Bergmann <[email protected]>
> AuthorDate: Fri, 2 Feb 2018 15:56:17 +0100
> Committer: Thomas Gleixner <[email protected]>
> 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

2018-02-05 21:40:22

by Josh Poimboeuf

[permalink] [raw]
Subject: Re: [tip:x86/urgent] x86/dumpstack: Avoid uninitlized variable

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
> <[email protected]> wrote:
> > Commit-ID: ebfc15019cfa72496c674ffcb0b8ef10790dcddc
> > Gitweb: https://git.kernel.org/tip/ebfc15019cfa72496c674ffcb0b8ef10790dcddc
> > Author: Arnd Bergmann <[email protected]>
> > AuthorDate: Fri, 2 Feb 2018 15:56:17 +0100
> > Committer: Thomas Gleixner <[email protected]>
> > 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

2018-02-05 21:49:50

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [tip:x86/urgent] x86/dumpstack: Avoid uninitlized variable

On Mon, Feb 5, 2018 at 10:39 PM, Josh Poimboeuf <[email protected]> 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
>> <[email protected]> wrote:
>> > Commit-ID: ebfc15019cfa72496c674ffcb0b8ef10790dcddc
>> > Gitweb: https://git.kernel.org/tip/ebfc15019cfa72496c674ffcb0b8ef10790dcddc
>> > Author: Arnd Bergmann <[email protected]>
>> > AuthorDate: Fri, 2 Feb 2018 15:56:17 +0100
>> > Committer: Thomas Gleixner <[email protected]>
>> > 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

2018-02-08 10:15:09

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH 2/3] x86: fix swsusp_arch_resume prototype

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 <[email protected]>
> ---
> 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!



2018-02-09 22:25:33

by Chris Wilson

[permalink] [raw]
Subject: Re: [PATCH 0/3] x86 bugfixes for LTO

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

2018-02-09 23:01:50

by Andi Kleen

[permalink] [raw]
Subject: Re: [PATCH 0/3] x86 bugfixes for LTO

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

Subject: [tip:x86/urgent] x86/error_inject: Make just_return_func() globally visible

Commit-ID: 01684e72f16727e6ae0aeb1392f478e11ec5b8f7
Gitweb: https://git.kernel.org/tip/01684e72f16727e6ae0aeb1392f478e11ec5b8f7
Author: Arnd Bergmann <[email protected]>
AuthorDate: Fri, 2 Feb 2018 15:56:19 +0100
Committer: Ingo Molnar <[email protected]>
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 <[email protected]>
Acked-by: Masami Hiramatsu <[email protected]>
Acked-by: Thomas Gleixner <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: Josef Bacik <[email protected]>
Cc: Linus Torvalds <[email protected]>
Cc: Nicolas Pitre <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Fixes: 540adea3809f ("error-injection: Separate error-injection from kprobe")
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Ingo Molnar <[email protected]>
---
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"