2019-11-08 09:03:40

by Lianbo Jiang

[permalink] [raw]
Subject: [PATCH 3/3 v9] kexec: Fix i386 build warnings that missed declaration of struct kimage

Kbuild test robot reported some build warnings as follow:

arch/x86/include/asm/crash.h:5:32: warning: 'struct kimage' declared
inside parameter list will not be visible outside of this definition
or declaration
int crash_load_segments(struct kimage *image);
^~~~~~
int crash_copy_backup_region(struct kimage *image);
^~~~~~
int crash_setup_memmap_entries(struct kimage *image,
^~~~~~
The 'struct kimage' is defined in the header file include/linux/kexec.h,
before using it, need to include its header file or make a declaration.
Otherwise the above warnings may be triggered.

Add a declaration of struct kimage to the file arch/x86/include/asm/
crash.h, that will solve these compile warnings.

Fixes: dd5f726076cc ("kexec: support for kexec on panic using new system call")
Reported-by: kbuild test robot <[email protected]>
Signed-off-by: Lianbo Jiang <[email protected]>
Link: https://lkml.kernel.org/r/201910310233.EJRtTMWP%[email protected]
---
arch/x86/include/asm/crash.h | 2 ++
1 file changed, 2 insertions(+)

diff --git a/arch/x86/include/asm/crash.h b/arch/x86/include/asm/crash.h
index 3dff55f4ed9d..88eadd08ad70 100644
--- a/arch/x86/include/asm/crash.h
+++ b/arch/x86/include/asm/crash.h
@@ -2,6 +2,8 @@
#ifndef _ASM_X86_CRASH_H
#define _ASM_X86_CRASH_H

+struct kimage;
+
int crash_load_segments(struct kimage *image);
int crash_copy_backup_region(struct kimage *image);
int crash_setup_memmap_entries(struct kimage *image,
--
2.17.1


2019-11-14 12:42:26

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH 3/3 v9] kexec: Fix i386 build warnings that missed declaration of struct kimage

On Fri, Nov 08, 2019 at 05:00:27PM +0800, Lianbo Jiang wrote:
> Kbuild test robot reported some build warnings as follow:
>
> arch/x86/include/asm/crash.h:5:32: warning: 'struct kimage' declared
> inside parameter list will not be visible outside of this definition
> or declaration
> int crash_load_segments(struct kimage *image);
> ^~~~~~
> int crash_copy_backup_region(struct kimage *image);
> ^~~~~~
> int crash_setup_memmap_entries(struct kimage *image,
> ^~~~~~
> The 'struct kimage' is defined in the header file include/linux/kexec.h,
> before using it, need to include its header file or make a declaration.
> Otherwise the above warnings may be triggered.
>
> Add a declaration of struct kimage to the file arch/x86/include/asm/
> crash.h, that will solve these compile warnings.
>
> Fixes: dd5f726076cc ("kexec: support for kexec on panic using new system call")

This is, of course, wrong. Your *first* patch is introducing those
warnings and I'm wondering how did you not see them during building?

In file included from arch/x86/realmode/init.c:11:
./arch/x86/include/asm/crash.h:5:32: warning: ‘struct kimage’ declared inside parameter list will not be visible outside of this definition or declaration
5 | int crash_load_segments(struct kimage *image);
| ^~~~~~
./arch/x86/include/asm/crash.h:6:37: warning: ‘struct kimage’ declared inside parameter list will not be visible outside of this definition or declaration
6 | int crash_copy_backup_region(struct kimage *image);
| ^~~~~~
./arch/x86/include/asm/crash.h:7:39: warning: ‘struct kimage’ declared inside parameter list will not be visible outside of this definition or declaration
7 | int crash_setup_memmap_entries(struct kimage *image,
|


And that happens because you've included asm/crash.h in
arch/x86/realmode/init.c and it of course complains because it hasn't
seen that struct yet.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

2019-11-14 14:22:24

by Lianbo Jiang

[permalink] [raw]
Subject: Re: [PATCH 3/3 v9] kexec: Fix i386 build warnings that missed declaration of struct kimage

在 2019年11月14日 20:39, Borislav Petkov 写道:
> On Fri, Nov 08, 2019 at 05:00:27PM +0800, Lianbo Jiang wrote:
>> Kbuild test robot reported some build warnings as follow:
>>
>> arch/x86/include/asm/crash.h:5:32: warning: 'struct kimage' declared
>> inside parameter list will not be visible outside of this definition
>> or declaration
>> int crash_load_segments(struct kimage *image);
>> ^~~~~~
>> int crash_copy_backup_region(struct kimage *image);
>> ^~~~~~
>> int crash_setup_memmap_entries(struct kimage *image,
>> ^~~~~~
>> The 'struct kimage' is defined in the header file include/linux/kexec.h,
>> before using it, need to include its header file or make a declaration.
>> Otherwise the above warnings may be triggered.
>>
>> Add a declaration of struct kimage to the file arch/x86/include/asm/
>> crash.h, that will solve these compile warnings.
>>
>> Fixes: dd5f726076cc ("kexec: support for kexec on panic using new system call")
>
> This is, of course, wrong. Your *first* patch is introducing those
> warnings and I'm wondering how did you not see them during building?
>

I really saw my building result, but kbuild reported the following messages:

vim +5 arch/x86/include/asm/crash.h

dd5f726076cc76 Vivek Goyal 2014-08-08 4
dd5f726076cc76 Vivek Goyal 2014-08-08 @5 int crash_load_segments(struct kimage *image);
dd5f726076cc76 Vivek Goyal 2014-08-08 6 int crash_copy_backup_region(struct kimage *image);
dd5f726076cc76 Vivek Goyal 2014-08-08 7 int crash_setup_memmap_entries(struct kimage *image,
dd5f726076cc76 Vivek Goyal 2014-08-08 8 struct boot_params *params);
89f579ce99f7e0 Yi Wang 2018-11-22 9 void crash_smp_send_stop(void);
dd5f726076cc76 Vivek Goyal 2014-08-08 10

:::::: The code at line 5 was first introduced by commit
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
:::::: dd5f726076cc7639d9713b334c8c133f77c6757a kexec: support for kexec on panic using new system call
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Would you mind giving me any suggestions about this?

> In file included from arch/x86/realmode/init.c:11:
> ./arch/x86/include/asm/crash.h:5:32: warning: ‘struct kimage’ declared inside parameter list will not be visible outside of this definition or declaration
> 5 | int crash_load_segments(struct kimage *image);
> | ^~~~~~
> ./arch/x86/include/asm/crash.h:6:37: warning: ‘struct kimage’ declared inside parameter list will not be visible outside of this definition or declaration
> 6 | int crash_copy_backup_region(struct kimage *image);
> | ^~~~~~
> ./arch/x86/include/asm/crash.h:7:39: warning: ‘struct kimage’ declared inside parameter list will not be visible outside of this definition or declaration
> 7 | int crash_setup_memmap_entries(struct kimage *image,
> |
>
>
> And that happens because you've included asm/crash.h in
> arch/x86/realmode/init.c and it of course complains because it hasn't
> seen that struct yet.
>

Exactly. Last time, i fixed the warnings in my first patch, please refer to the patch v8(resend).

Link: https://lkml.kernel.org/r/[email protected]
-[PATCH 1/2 RESEND v8] x86/kdump: always reserve the low 1M when the crashkernel option is specified


And kbuild said that need to add the reported-by, please refer to the following Link.

Link: https://lkml.kernel.org/r/201910310233.EJRtTMWP%[email protected]

> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <[email protected]>

Any idea about this? Any suggestions will be appreciated.

Thanks.
Lianbo

2019-11-14 14:46:01

by Borislav Petkov

[permalink] [raw]
Subject: Re: [PATCH 3/3 v9] kexec: Fix i386 build warnings that missed declaration of struct kimage

On Thu, Nov 14, 2019 at 10:20:42PM +0800, lijiang wrote:
> I really saw my building result, but kbuild reported the following messages:
>
> vim +5 arch/x86/include/asm/crash.h
>
> dd5f726076cc76 Vivek Goyal 2014-08-08 4
> dd5f726076cc76 Vivek Goyal 2014-08-08 @5 int crash_load_segments(struct kimage *image);
> dd5f726076cc76 Vivek Goyal 2014-08-08 6 int crash_copy_backup_region(struct kimage *image);
> dd5f726076cc76 Vivek Goyal 2014-08-08 7 int crash_setup_memmap_entries(struct kimage *image,
> dd5f726076cc76 Vivek Goyal 2014-08-08 8 struct boot_params *params);
> 89f579ce99f7e0 Yi Wang 2018-11-22 9 void crash_smp_send_stop(void);
> dd5f726076cc76 Vivek Goyal 2014-08-08 10
>
> :::::: The code at line 5 was first introduced by commit
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> :::::: dd5f726076cc7639d9713b334c8c133f77c6757a kexec: support for kexec on panic using new system call
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

You should not take the report of a bot blindly but should always double
check it. Like every other computer system programmed by humans, it can
make mistakes.

> Would you mind giving me any suggestions about this?

I'll take care of it all and push the results out soon.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette

2019-11-15 00:20:38

by Lianbo Jiang

[permalink] [raw]
Subject: Re: [PATCH 3/3 v9] kexec: Fix i386 build warnings that missed declaration of struct kimage

在 2019年11月14日 22:43, Borislav Petkov 写道:
> On Thu, Nov 14, 2019 at 10:20:42PM +0800, lijiang wrote:
>> I really saw my building result, but kbuild reported the following messages:
>>
>> vim +5 arch/x86/include/asm/crash.h
>>
>> dd5f726076cc76 Vivek Goyal 2014-08-08 4
>> dd5f726076cc76 Vivek Goyal 2014-08-08 @5 int crash_load_segments(struct kimage *image);
>> dd5f726076cc76 Vivek Goyal 2014-08-08 6 int crash_copy_backup_region(struct kimage *image);
>> dd5f726076cc76 Vivek Goyal 2014-08-08 7 int crash_setup_memmap_entries(struct kimage *image,
>> dd5f726076cc76 Vivek Goyal 2014-08-08 8 struct boot_params *params);
>> 89f579ce99f7e0 Yi Wang 2018-11-22 9 void crash_smp_send_stop(void);
>> dd5f726076cc76 Vivek Goyal 2014-08-08 10
>>
>> :::::: The code at line 5 was first introduced by commit
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> :::::: dd5f726076cc7639d9713b334c8c133f77c6757a kexec: support for kexec on panic using new system call
>> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> You should not take the report of a bot blindly but should always double
> check it. Like every other computer system programmed by humans, it can
> make mistakes.
>

Indeed, i totally agree.

>> Would you mind giving me any suggestions about this?
>
> I'll take care of it all and push the results out soon.
>

OK, thank you so much.

Lianbo