klp: remove superfluous errors in asm/livepatch.h
PATCH 1/1 klp: remove superfluous errors in asm/livepatch.h
There is an #error in asm/livepatch.h for both x86 and s390 in !CONFIG_LIVEPATCH cases. It does not make much sense as pointed out by Michael Ellerman. One can happily include asm/livepatch.h with CONFIG_LIVEPATCH. Remove it as useless.
--- arch/s390/include/asm/livepatch.h | 2 -- arch/x86/include/asm/livepatch.h | 2 -- 2 files changed, 4 deletions(-)
arch/s390/include/asm/livepatch.h +0 -2
@@ -36,8 +36,6 @@ static inline void klp_arch_set_pc(struct pt_regs *regs, unsigned long ip) { regs->psw.addr = ip; } -#else -#error Include linux/livepatch.h, not asm/livepatch.h#endif #endif
arch/x86/include/asm/livepatch.h +0 -2
@@ -40,8 +40,6 @@ static inline void klp_arch_set_pc(struct pt_regs *regs, unsigned long ip) { regs->ip = ip; } -#else -#error Include linux/livepatch.h, not asm/livepatch.h#endif #endif /* _ASM_X86_LIVEPATCH_H */
Signature · 1 line
2.7.2
Quoted 7 lines · Miroslav Benes
There is an #error in
asm/livepatch.hfor both x86 and s390 in !CONFIG_LIVEPATCH cases. It does not make much sense as pointed out by Michael Ellerman. One can happily includeasm/livepatch.hwithCONFIG_LIVEPATCH. Remove it as useless.Suggested-by Michael Ellerman <[email protected]>Signed-off-by Miroslav Benes <[email protected]>
Looks fine to me. While we're at it, do we even need the '#ifdef CONFIG_LIVEPATCH' in these files? And in include/linux/livepatch.h?
Quoted 34 lines
--- arch/s390/include/asm/livepatch.h | 2 -- arch/x86/include/asm/livepatch.h | 2 -- 2 files changed, 4 deletions(-)arch/s390/include/asm/livepatch.h +0
-2@@ -36,8 +36,6 @@ static inline void klp_arch_set_pc(struct pt_regs *regs, unsigned long ip) { regs->psw.addr = ip; } -#else -#error Include linux/livepatch.h, not asm/livepatch.h#endif #endif arch/x86/include/asm/livepatch.h +0
-2@@ -40,8 +40,6 @@ static inline void klp_arch_set_pc(struct pt_regs *regs, unsigned long ip) { regs->ip = ip; } -#else -#error Include linux/livepatch.h, not asm/livepatch.h#endif #endif /* _ASM_X86_LIVEPATCH_H */ Signature · 1 line
2.7.2
Signature · 1 line
Josh
Quoted 9 lines · Josh Poimboeuf
Quoted 7 lines
There is an #error in
asm/livepatch.hfor both x86 and s390 in !CONFIG_LIVEPATCH cases. It does not make much sense as pointed out by Michael Ellerman. One can happily includeasm/livepatch.hwithCONFIG_LIVEPATCH. Remove it as useless.Suggested-by Michael Ellerman <[email protected]>Signed-off-by Miroslav Benes <[email protected]>Looks fine to me.
Thanks. I consider this to be your Ack then :) (if you disagree, please shout loudly).
Quoted 2 lines
While we're at it, do we even need the '#ifdef
CONFIG_LIVEPATCH' in these files? And ininclude/linux/livepatch.h?
You are right, this seems indeed completely unnecessary. I'll remove it for 4.6 as well, if noone has any objections.
Signature · 2 lines
Jiri Kosina SUSE Labs
Josh Poimboeuf
Acked-byQuoted 7 lines · Jiri Kosina
Quoted 5 lines · Josh Poimboeuf
Quoted 5 lines
There is an #error in
asm/livepatch.hfor both x86 and s390 in !CONFIG_LIVEPATCH cases. It does not make much sense as pointed out by Michael Ellerman. One can happily includeasm/livepatch.hwithCONFIG_LIVEPATCH. Remove it as useless.
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Suggested-by Michael Ellerman <[email protected]>Signed-off-by Miroslav Benes <[email protected]>Looks fine to me.
Thanks. I consider this to be your Ack then :) (if you disagree, please shout loudly).
:-)
Quoted 6 lines
Quoted 3 lines
While we're at it, do we even need the '#ifdef
CONFIG_LIVEPATCH' in these files? And ininclude/linux/livepatch.h?You are right, this seems indeed completely unnecessary. I'll remove it for 4.6 as well, if noone has any objections.
Signature · 1 line
Josh
+++ Jiri Kosina [06/03/16 22:13 +0100]:
Quoted 12 lines · Josh Poimboeuf
Quoted 10 lines
Quoted 8 lines
There is an #error in
asm/livepatch.hfor both x86 and s390 in !CONFIG_LIVEPATCH cases. It does not make much sense as pointed out by Michael Ellerman. One can happily includeasm/livepatch.hwithCONFIG_LIVEPATCH. Remove it as useless.Suggested-by Michael Ellerman <[email protected]>Signed-off-by Miroslav Benes <[email protected]>Looks fine to me.
Quoted 8 lines
Thanks. I consider this to be your Ack then :) (if you disagree, please shout loudly).
Quoted 2 lines
While we're at it, do we even need the '#ifdef
CONFIG_LIVEPATCH' in these files? And ininclude/linux/livepatch.h?You are right, this seems indeed completely unnecessary. I'll remove it for 4.6 as well, if noone has any objections.
Hm, I should've caught this earlier, but the notifier cleanup patch that removes the livepatch module notifier had kernel/module.c include livepatch.h for the klp_module_{coming,going} function stubs in the !CONFIG_LIVEPATCH case. See here: https://lkml.org/lkml/2016/2/8/1182
Looking back, I now don't think it makes sense for module.c to include all those livepatch definitions in the first place, since all it needed was the klp_module_{coming,going} declarations. I guess my question is, since we've removed the #ifdef CONFIG_LIVEPATCH blocks from livepatch.h, where might be a better place for the klp_module_{coming,going} stubs? Perhaps they could go in module.h instead?
Jessica
Quoted 11 lines · Jessica Yu
Quoted 6 lines · Josh Poimboeuf
Quoted 2 lines
While we're at it, do we even need the '#ifdef
CONFIG_LIVEPATCH' in these files? And ininclude/linux/livepatch.h?You are right, this seems indeed completely unnecessary. I'll remove it for 4.6 as well, if noone has any objections.
Hm, I should've caught this earlier, but the notifier cleanup patch that removes the livepatch module notifier had
kernel/module.cincludelivepatch.hfor the klp_module_{coming,going} function stubs in the !CONFIG_LIVEPATCH case. See here: https://lkml.org/lkml/2016/2/8/1182
Great catch! And you are in time because Mirek has vacation this week :-)
Quoted 7 lines
Looking back, I now don't think it makes sense for
module.cto include all those livepatch definitions in the first place, since all it needed was the klp_module_{coming,going} declarations. I guess my question is, since we've removed the #ifdefCONFIG_LIVEPATCHblocks fromlivepatch.h, where might be a better place for the klp_module_{coming,going} stubs? Perhaps they could go inmodule.hinstead?
I personally prefer to keep the klp_module_{coming,going} declarations in livepatch.h. It means to keep the '#ifdef CONFIG_LIVEPATCH' there as well. It is a standard solution. It helps to find things where one would expect them.
Best Regards,
Petr
Quoted 5 lines · Jessica Yu
Hm, I should've caught this earlier, but the notifier cleanup patch that removes the livepatch module notifier had
kernel/module.cincludelivepatch.hfor the klp_module_{coming,going} function stubs in the !CONFIG_LIVEPATCH case. See here: https://lkml.org/lkml/2016/2/8/1182
Quoted 7 lines
Looking back, I now don't think it makes sense for
module.cto include all those livepatch definitions in the first place, since all it needed was the klp_module_{coming,going} declarations. I guess my question is, since we've removed the #ifdefCONFIG_LIVEPATCHblocks fromlivepatch.h, where might be a better place for the klp_module_{coming,going} stubs? Perhaps they could go inmodule.hinstead?
Well, once there actually are alternate stubs to be included through the header file (like in the proposed notifier removal), it indeed makes sense to reintroduce the #ifdef. And once it's there, it probably doesn't make too much sense to have it guard only portion of the file.
Thanks,
Signature · 2 lines
Jiri Kosina SUSE Labs
Quoted 15 lines · Jiri Kosina
Quoted 5 lines · Jessica Yu
Hm, I should've caught this earlier, but the notifier cleanup patch that removes the livepatch module notifier had
kernel/module.cincludelivepatch.hfor the klp_module_{coming,going} function stubs in the !CONFIG_LIVEPATCH case. See here: https://lkml.org/lkml/2016/2/8/1182Quoted 7 lines
Looking back, I now don't think it makes sense for
module.cto include all those livepatch definitions in the first place, since all it needed was the klp_module_{coming,going} declarations. I guess my question is, since we've removed the #ifdefCONFIG_LIVEPATCHblocks fromlivepatch.h, where might be a better place for the klp_module_{coming,going} stubs? Perhaps they could go inmodule.hinstead?
Quoted 4 lines
Well, once there actually are alternate stubs to be included through the header file (like in the proposed notifier removal), it indeed makes sense to reintroduce the #ifdef. And once it's there, it probably doesn't make too much sense to have it guard only portion of the file.
It's a minor issue but I think it would be cleaner if we only guard the parts of the file which need to be guarded.
Signature · 1 line
Josh
Quoted 11 lines · Josh Poimboeuf
Quoted 7 lines · Miroslav Benes
There is an #error in
asm/livepatch.hfor both x86 and s390 in !CONFIG_LIVEPATCH cases. It does not make much sense as pointed out by Michael Ellerman. One can happily includeasm/livepatch.hwithCONFIG_LIVEPATCH. Remove it as useless.Suggested-by Michael Ellerman <[email protected]>Signed-off-by Miroslav Benes <[email protected]>Looks fine to me. While we're at it, do we even need the '#ifdef
CONFIG_LIVEPATCH' in these files? And ininclude/linux/livepatch.h?
IIRC there was a reason to this. If you build a patch module on (against) the kernel with CONFIG_LIVEPATCH=n the build fails immediately with those ifdefs, because there is no declaration of needed symbols present (klp_register_patch(), data structures and such). Without ifdefs the build succeeds and modprobe/insmod fails. The former could be advantageous in some scenarios.
But since the guard in include/linux/livepatch.h (which is the only important header file in fact) returns with Jessica's patches for better reason there is no point to discuss this further :)
Miroslav