native_save_fl() causes a warning
Subsystems (2)
Hi Nick,
It seems that this linux kernel commit of yours:
commit d0a8d9378d16eb3c69bd8e6d23779fbdbee3a8c7
Author: Nick Desaulniers Date: Thu Jun 21 09:23:24 2018 -0700
x86/paravirt: Make native_save_fl() extern inline
introduced a new warning (with W=1):
./arch/x86/include/asm/irqflags.h:16:29: warning: no previous prototype for ‘native_save_fl’ [-Wmissing-prototypes]
extern inline unsigned long native_save_fl(void)
^
Please fix it.
Secondly, I am quite curious why you changed only native_save_fl() from static inline to extern inline, when native_restore_fl(), native_irq_disable() and native_irq_enable() are equally referenced by address in arch/x86/kernel/paravirt.c and thus should suffer from the same problem. Can you explain?
Thanks,
Signature · 2 lines
Jean Delvare SUSE L3 Support
Quoted 11 lines · Jean Delvare
Hi Nick,
It seems that this linux kernel commit of yours:
commit
d0a8d9378d16eb3c69bd8e6d23779fbdbee3a8c7Author: Nick Desaulniers Date: Thu Jun 21 09:23:24 2018 -0700x86/paravirt: Make
native_save_fl()extern inline
Quoted 7 lines
introduced a new warning (with W=1):
./arch/x86/include/asm/irqflags.h:16:29: warning: no previous prototype for ‘native_save_fl’ [-Wmissing-prototypes]
extern inline unsigned longnative_save_fl(void)^Please fix it.
Hi Jean, thanks for the report. David Laight also reported this warning; he tested a patch I sent him overnight.
Let me guess, you're using a version of GCC < 4.9? It seems that GCC < 4.9 will produce that warning for extern inline functions without previous declarations.
I'll add your Reported-By tag to the patch that I will send out in a few minutes.
Quoted 5 lines
Secondly, I am quite curious why you changed only
native_save_fl()from static inline to extern inline, whennative_restore_fl(),native_irq_disable()andnative_irq_enable()are equally referenced by address inarch/x86/kernel/paravirt.cand thus should suffer from the same problem. Can you explain?
This is a good point. With native_save_fl, we were not able to boot the kernel at all. Maybe this was called from the boot sequence (maybe Juergen knows more)? It seems that the other functions aren't preventing us from booting, but maybe exercising other paths in paravirt would expose such an issue? Or maybe paravirt doesn't have the same calling convention requirements for those functions?
Is there a standard testing procedure for paravirt? I'd be happy to try it to see if we can expose more things that should have the same cleanup.
Signature · 2 lines
Thanks, ~Nick Desaulniers
PATCH 1/1 x86/irqflags: provide a declaration for native_save_fl
Fixes commit d0a8d9378d16 ("x86/paravirt: Make native_save_fl() extern inline").
It was reported that the above commit was causing users of gcc < 4.9 to observe -Werror=missing-prototypes errors.
Indeed, it seems that:
extern inline unsigned long native_save_fl(void) { return 0; }
compiled with -Werror=missing-prototypes produces this warning in gcc < 4.9, but not gcc >= 4.9.
--- arch/x86/include/asm/irqflags.h | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/include/asm/irqflags.h +2 -0
@@ -13,6 +13,8 @@* Interrupt control: */ +/* Declaration required for gcc < 4.9 to prevent -Werror=missing-prototypes */ +extern inline unsigned long native_save_fl (void );extern inline unsigned long native_save_fl (void ) {unsigned long flags;
Signature · 1 line
2.18.0.597.ga71716f1ad-goog
tip-bot for Nick Desaulniers
merge bot[tip:x86/urgent] x86/irqflags: Provide a declaration for native_save_fl
x86/irqflags: Provide a declaration for native_save_fl
Commit-ID: 208cbb32558907f68b3b2a081ca2337ac3744794 Gitweb: https://git.kernel.org/tip/208cbb32558907f68b3b2a081ca2337ac3744794 Author: Nick Desaulniers <[email protected]> AuthorDate: Fri, 3 Aug 2018 10:05:50 -0700 Committer: Thomas Gleixner <[email protected]> CommitDate: Sun, 5 Aug 2018 22:30:37 +0200
x86/irqflags: Provide a declaration for native_save_fl
It was reported that the commit d0a8d9378d16 is causing users of gcc < 4.9 to observe -Werror=missing-prototypes errors.
Indeed, it seems that:
extern inline unsigned long native_save_fl(void) { return 0; }
compiled with -Werror=missing-prototypes produces this warning in gcc < 4.9, but not gcc >= 4.9.
--- arch/x86/include/asm/irqflags.h | 2 ++ 1 file changed, 2 insertions(+)
arch/x86/include/asm/irqflags.h +2 -0
@@ -13,6 +13,8 @@* Interrupt control: */ +/* Declaration required for gcc < 4.9 to prevent -Werror=missing-prototypes */ +extern inline unsigned long native_save_fl (void );extern inline unsigned long native_save_fl (void ) {unsigned long flags;
Re: [tip:x86/urgent] x86/irqflags: Provide a declaration for native_save_fl
Quoted 28 lines · tip-bot for Nick Desaulniers
Commit-ID: 208cbb32558907f68b3b2a081ca2337ac3744794 Gitweb: https://git.kernel.org/tip/208cbb32558907f68b3b2a081ca2337ac3744794 Author: Nick Desaulniers <[email protected]> AuthorDate: Fri, 3 Aug 2018 10:05:50 -0700 Committer: Thomas Gleixner <[email protected]> CommitDate: Sun, 5 Aug 2018 22:30:37 +0200x86/irqflags: Provide a declaration for
native_save_flIt was reported that the commit
d0a8d9378d16is causing users of gcc < 4.9 to observe -Werror=missing-prototypes errors.Indeed, it seems that:
extern inline unsigned longnative_save_fl(void){ return 0; }compiled with -Werror=missing-prototypes produces this warning in gcc < 4.9, but not gcc >= 4.9.
Fixes d0a8d9378d16 ("x86/paravirt: Make native_save_fl() extern inline").Reported-by David Laight <[email protected]>Reported-by Jean Delvare <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>Signed-off-by Thomas Gleixner <[email protected]>
Quoted 8 lines
Not sure if this was going to be cleaned up in an automated way, but looks like this commit message drops the comment to stable as to how far back it should go:
# 4.17, 4.14, 4.9, 4.4
also, there were tested by's reported:
--
Thanks,
~Nick Desaulniers
Re: [tip:x86/urgent] x86/irqflags: Provide a declaration for native_save_fl
Quoted 9 lines · Nick Desaulniers
Quoted 1 line · tip-bot for Nick Desaulniers
Not sure if this was going to be cleaned up in an automated way, but looks like this commit message drops the comment to stable as to how far back it should go:
# 4.17, 4.14, 4.9, 4.4
The Fixes tag is enough. If the upstream commit was backported, then the tools of the stable folks will find it and know exactly how far it needs to go back.
Quoted 4 lines
also, there were tested by's reported:
Tested-by David Laight <[email protected]>Tested-by Sedat Dilek <[email protected]>
Which came in after I applied it....
Thanks,
tglx
Re: [tip:x86/urgent] x86/irqflags: Provide a declaration for native_save_fl
Quoted 10 lines · Thomas Gleixner
Quoted 8 lines · Nick Desaulniers
Quoted 1 line · tip-bot for Nick Desaulniers
Not sure if this was going to be cleaned up in an automated way, but looks like this commit message drops the comment to stable as to how far back it should go:
Quoted 5 lines
Quoted 1 line
# 4.17, 4.14, 4.9, 4.4
The Fixes tag is enough. If the upstream commit was backported, then the tools of the stable folks will find it and know exactly how far it needs to go back.
Oh, cool.
Quoted 6 lines
Quoted 4 lines
also, there were tested by's reported:
Tested-by David Laight <[email protected]>Tested-by Sedat Dilek <[email protected]>Which came in after I applied it....
I've seen other maintainers revise commit messages before sending pull requests along, but I guess that's problematic as anyone else who has pulled before the revision would then have a merge conflict.
Signature · 2 lines
Thanks, ~Nick Desaulniers
Re: [tip:x86/urgent] x86/irqflags: Provide a declaration for native_save_fl
Quoted 4 lines · Nick Desaulniers
Quoted 3 lines · Thomas Gleixner
Quoted 2 lines · Nick Desaulniers
also, there were tested by's reported:
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Tested-by David Laight <[email protected]>Tested-by Sedat Dilek <[email protected]>Which came in after I applied it....
I've seen other maintainers revise commit messages before sending pull requests along, but I guess that's problematic as anyone else who has pulled before the revision would then have a merge conflict.
In general I avoid redoing commits for that reason and others and one of the reasons why we have the Link: tag in the commit message is to be able to look up such additional information easily - assumed that the archives have not vanished from the planet.
Thanks,
tglx
RE: [PATCH] x86/irqflags: provide a declaration for native_save_fl
In reply to Nick DesaulniersFrom: Nick Desaulniers
Quoted 10 lines
Sent: 03 August 2018 18:06
Fixes commitd0a8d9378d16("x86/paravirt: Makenative_save_fl()extern inline").It was reported that the above commit was causing users of gcc < 4.9 to observe -Werror=missing-prototypes errors.
Indeed, it seems that:
extern inline unsigned longnative_save_fl(void){ return 0; }
Quoted 7 lines
compiled with -Werror=missing-prototypes produces this warning in gcc < 4.9, but not gcc >= 4.9.
Cc [email protected] # 4.17, 4.14, 4.9, 4.4Reported-by David Laight <[email protected]>Reported-by Jean Delvare <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>
You can add my:
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)
Sedat Dilek
Tested-byRe: [PATCH] x86/irqflags: provide a declaration for native_save_fl
Quoted 14 lines · David Laight
From: Nick Desaulniers
Quoted 13 lines
Sent: 03 August 2018 18:06
Fixes commitd0a8d9378d16("x86/paravirt: Makenative_save_fl()extern inline").It was reported that the above commit was causing users of gcc < 4.9 to observe -Werror=missing-prototypes errors.
Indeed, it seems that:
extern inline unsigned longnative_save_fl(void){ return 0; }compiled with -Werror=missing-prototypes produces this warning in gcc < 4.9, but not gcc >= 4.9.
Quoted 9 lines
Quoted 4 lines
Cc [email protected] # 4.17, 4.14, 4.9, 4.4Reported-by David Laight <[email protected]>Reported-by Jean Delvare <[email protected]>Signed-off-by Nick Desaulniers <[email protected]>You can add my:
Tested-by David Laight <[email protected]>
On top of Linux v4.18-rc8 with clang version 7.0.0-svn338205.
- sed@ -
Quoted 37 lines · Nick Desaulniers
Quoted 11 lines · Jean Delvare
Hi Nick,
It seems that this linux kernel commit of yours:
commit
d0a8d9378d16eb3c69bd8e6d23779fbdbee3a8c7Author: Nick Desaulniers Date: Thu Jun 21 09:23:24 2018 -0700x86/paravirt: Make
native_save_fl()extern inlineQuoted 7 lines
introduced a new warning (with W=1):
./arch/x86/include/asm/irqflags.h:16:29: warning: no previous prototype for ‘native_save_fl’ [-Wmissing-prototypes]
extern inline unsigned longnative_save_fl(void)^Please fix it.
Hi Jean, thanks for the report. David Laight also reported this warning; he tested a patch I sent him overnight.
Let me guess, you're using a version of GCC < 4.9? It seems that GCC < 4.9 will produce that warning for extern inline functions without previous declarations.
I'll add your Reported-By tag to the patch that I will send out in a few minutes.
Quoted 5 lines
Secondly, I am quite curious why you changed only
native_save_fl()from static inline to extern inline, whennative_restore_fl(),native_irq_disable()andnative_irq_enable()are equally referenced by address inarch/x86/kernel/paravirt.cand thus should suffer from the same problem. Can you explain?
Quoted 6 lines
This is a good point. With
native_save_fl, we were not able to boot the kernel at all. Maybe this was called from the boot sequence (maybe Juergen knows more)? It seems that the other functions aren't preventing us from booting, but maybe exercising other paths in paravirt would expose such an issue? Or maybe paravirt doesn't have the same calling convention requirements for those functions?
The core issue these patches worked around was the automatic/heuristic generation of stack guard code by clang, which ended up clobbering %ecx/%rcx in a way not expected by the contract of the paravirt code. The only function affected by this problem was native_save_fl(), because only it has a C stack (and thus, has a stack that requires guarding).
The other functions could have been converted at the same time, and they will have to be converted if (down the line) somebody adds C stack variables to them. But, for now, the patch series seems to correctly work around this issue.
Quoted 3 lines
Is there a standard testing procedure for paravirt? I'd be happy to try it to see if we can expose more things that should have the same cleanup.
This bug was so obvious you just enabled CONFIG_PARAVIRT, built with CC=clang, and booted the x86_64 bzImage on any qemu. The minute the paravirt alternatives were patched in, it exploded.
Quoted 3 lines
--
Thanks,
~Nick Desaulniers