x86/kexec: crash_vmclear_local_vmcss needs __rcu
Subsystems (4)
PATCH 1/1 x86/kexec: crash_vmclear_local_vmcss needs __rcu
This removes the sparse warning:arch/x86/kernel/crash.c:49:32: sparse: incompatible types in comparison expression (different address spaces)
--- arch/x86/include/asm/kexec.h | 4 +++- arch/x86/kernel/crash.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-)
arch/x86/include/asm/kexec.h +3 -1
@@ -163,7 +163,9 @@ struct kimage_arch { };#endif -extern void (*crash_vmclear_loaded_vmcss)(void ); +extern void __rcu (*crash_vmclear_loaded_vmcss)(void ); +#define vmclear_func_rcu (vmclear_func) \ + ((void (*)(void)) rcu_dereference(vmclear_func))#endif /* __ASSEMBLY__ */
arch/x86/kernel/crash.c +2 -2
@@ -38,7 +38,7 @@ int in_crash_kexec;* * protected by rcu. */ -void (*crash_vmclear_loaded_vmcss)(void ) =NULL ; +void __rcu (*crash_vmclear_loaded_vmcss)(void ) =NULL ;EXPORT_SYMBOL_GPL (crash_vmclear_loaded_vmcss);static inline void cpu_crash_vmclear_loaded_vmcss (void )
@@ -46,7 +46,7 @@ static inline void cpu_crash_vmclear_loaded_vmcss(void)void (*do_vmclear_operation)(void ) =NULL ;rcu_read_lock (); - do_vmclear_operation =rcu_dereference (crash_vmclear_loaded_vmcss); + do_vmclear_operation =vmclear_func_rcu (crash_vmclear_loaded_vmcss);if (do_vmclear_operation)do_vmclear_operation ();rcu_read_unlock ();
Signature · 1 line
1.7.1
Quoted 30 lines · Zhang Yanfei
This removes the sparse warning:
arch/x86/kernel/crash.c:49:32: sparse: incompatible types in comparison expression (different address spaces)Reported-by kbuild test robot <[email protected]>Signed-off-by Zhang Yanfei <[email protected]>--- arch/x86/include/asm/kexec.h | 4 +++- arch/x86/kernel/crash.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-)arch/x86/include/asm/kexec.h +3
-1@@ -163,7 +163,9 @@ struct kimage_arch { };#endif -extern void (*crash_vmclear_loaded_vmcss)(void ); +extern void __rcu (*crash_vmclear_loaded_vmcss)(void ); +#define vmclear_func_rcu (vmclear_func) \ + ((void (*)(void)) rcu_dereference(vmclear_func))#endif /* __ASSEMBLY__ */ arch/x86/kernel/crash.c +0
-0
arch/x86/kernel/crash.c int in_crash_kexec; · line 41
Quoted 5 lines
arch/x86/kernel/crash.c +1
-1@@ -38,7 +38,7 @@ int in_crash_kexec;* * protected by rcu. */ -void (*crash_vmclear_loaded_vmcss)(void ) =NULL ; +void __rcu (*crash_vmclear_loaded_vmcss)(void ) =NULL ;
Isnt this (__rcu AS tag) sufficient? After all, sparse is complaining about namespaces.
Creating a #define to cast seems excessive.
Quoted 40 lines · Marcelo Tosatti
Quoted 30 lines · Zhang Yanfei
This removes the sparse warning:
arch/x86/kernel/crash.c:49:32: sparse: incompatible types in comparison expression (different address spaces)Reported-by kbuild test robot <[email protected]>Signed-off-by Zhang Yanfei <[email protected]>--- arch/x86/include/asm/kexec.h | 4 +++- arch/x86/kernel/crash.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-)arch/x86/include/asm/kexec.h +3
-1@@ -163,7 +163,9 @@ struct kimage_arch { };#endif -extern void (*crash_vmclear_loaded_vmcss)(void ); +extern void __rcu (*crash_vmclear_loaded_vmcss)(void ); +#define vmclear_func_rcu (vmclear_func) \ + ((void (*)(void)) rcu_dereference(vmclear_func))#endif /* __ASSEMBLY__ */ arch/x86/kernel/crash.c +0
-0arch/x86/kernel/crash.c int in_crash_kexec; · line 41
Quoted 5 lines
arch/x86/kernel/crash.c +1
-1@@ -38,7 +38,7 @@ int in_crash_kexec;* * protected by rcu. */ -void (*crash_vmclear_loaded_vmcss)(void ) =NULL ; +void __rcu (*crash_vmclear_loaded_vmcss)(void ) =NULL ;Isnt this (
__rcuAS tag) sufficient? After all, sparse is complaining about namespaces.
Quoted 3 lines
Creating a #define to cast seems excessive.
I am not very familiar with the rcu.
Adding __rcu tag could solve the problem. But it imported another warning when I try to assign rcu_dereference(crash_vmclear_loaded_vmcss) to do_vmclear_operation:
arch/x86/kernel/crash.c:49:30: warning: incorrect type in assignment (different modifiers)arch/x86/kernel/crash.c:49:30: expected void ( *do_vmclear_operation )( ... )arch/x86/kernel/crash.c:49:30: got void ( [noderef] *<noident> )( ... )arch/x86/kernel/crash.c:49:30: warning: incorrect type in assignment (different modifiers)arch/x86/kernel/crash.c:49:30: expected void ( *do_vmclear_operation )( ... )arch/x86/kernel/crash.c:49:30: got void ( [noderef] *<noident> )( ... )
So I made the #define to cast its type.
If you have any suggestion, that'll be helpful.
Thanks
Zhang Yanfei
Quoted 57 lines · Zhang Yanfei
Quoted 40 lines · Marcelo Tosatti
Quoted 30 lines · Zhang Yanfei
This removes the sparse warning:
arch/x86/kernel/crash.c:49:32: sparse: incompatible types in comparison expression (different address spaces)Reported-by kbuild test robot <[email protected]>Signed-off-by Zhang Yanfei <[email protected]>--- arch/x86/include/asm/kexec.h | 4 +++- arch/x86/kernel/crash.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-)arch/x86/include/asm/kexec.h +3
-1@@ -163,7 +163,9 @@ struct kimage_arch { };#endif -extern void (*crash_vmclear_loaded_vmcss)(void ); +extern void __rcu (*crash_vmclear_loaded_vmcss)(void ); +#define vmclear_func_rcu (vmclear_func) \ + ((void (*)(void)) rcu_dereference(vmclear_func))#endif /* __ASSEMBLY__ */ arch/x86/kernel/crash.c +0
-0arch/x86/kernel/crash.c int in_crash_kexec; · line 41
Quoted 5 lines
arch/x86/kernel/crash.c +1
-1@@ -38,7 +38,7 @@ int in_crash_kexec;* * protected by rcu. */ -void (*crash_vmclear_loaded_vmcss)(void ) =NULL ; +void __rcu (*crash_vmclear_loaded_vmcss)(void ) =NULL ;Isnt this (
__rcuAS tag) sufficient? After all, sparse is complaining about namespaces.Quoted 3 lines
Creating a #define to cast seems excessive.
I am not very familiar with the rcu.
Adding__rcutag could solve the problem. But it imported another warning when I try to assignrcu_dereference(crash_vmclear_loaded_vmcss)todo_vmclear_operation:
arch/x86/kernel/crash.c:49:30: warning: incorrect type in assignment (different modifiers)arch/x86/kernel/crash.c:49:30: expected void (*do_vmclear_operation)( ... )arch/x86/kernel/crash.c:49:30: got void ( [noderef] *<noident> )( ... )arch/x86/kernel/crash.c:49:30: warning: incorrect type in assignment (different modifiers)arch/x86/kernel/crash.c:49:30: expected void (*do_vmclear_operation)( ... )arch/x86/kernel/crash.c:49:30: got void ( [noderef] *<noident> )( ... )
Quoted 4 lines
So I made the #define to cast its type.
If you have any suggestion, that'll be helpful.
Try to use typedef.
--
Gleb.
_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec
Quoted 58 lines · Gleb Natapov
Quoted 57 lines · Zhang Yanfei
Quoted 40 lines · Marcelo Tosatti
Quoted 30 lines · Zhang Yanfei
This removes the sparse warning:
arch/x86/kernel/crash.c:49:32: sparse: incompatible types in comparison expression (different address spaces)Reported-by kbuild test robot <[email protected]>Signed-off-by Zhang Yanfei <[email protected]>--- arch/x86/include/asm/kexec.h | 4 +++- arch/x86/kernel/crash.c | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-)arch/x86/include/asm/kexec.h +3
-1@@ -163,7 +163,9 @@ struct kimage_arch { };#endif -extern void (*crash_vmclear_loaded_vmcss)(void ); +extern void __rcu (*crash_vmclear_loaded_vmcss)(void ); +#define vmclear_func_rcu (vmclear_func) \ + ((void (*)(void)) rcu_dereference(vmclear_func))#endif /* __ASSEMBLY__ */ arch/x86/kernel/crash.c +0
-0arch/x86/kernel/crash.c int in_crash_kexec; · line 41
Quoted 5 lines
arch/x86/kernel/crash.c +1
-1@@ -38,7 +38,7 @@ int in_crash_kexec;* * protected by rcu. */ -void (*crash_vmclear_loaded_vmcss)(void ) =NULL ; +void __rcu (*crash_vmclear_loaded_vmcss)(void ) =NULL ;Isnt this (
__rcuAS tag) sufficient? After all, sparse is complaining about namespaces.Quoted 3 lines
Creating a #define to cast seems excessive.
I am not very familiar with the rcu.
Adding__rcutag could solve the problem. But it imported another warning when I try to assignrcu_dereference(crash_vmclear_loaded_vmcss)todo_vmclear_operation:
arch/x86/kernel/crash.c:49:30: warning: incorrect type in assignment (different modifiers)arch/x86/kernel/crash.c:49:30: expected void (*do_vmclear_operation)( ... )arch/x86/kernel/crash.c:49:30: got void ( [noderef] *<noident> )( ... )arch/x86/kernel/crash.c:49:30: warning: incorrect type in assignment (different modifiers)arch/x86/kernel/crash.c:49:30: expected void (*do_vmclear_operation)( ... )arch/x86/kernel/crash.c:49:30: got void ( [noderef] *<noident> )( ... )
Quoted 6 lines
Quoted 4 lines
So I made the #define to cast its type.
If you have any suggestion, that'll be helpful.
Try to use typedef.
Thanks. typedef works.
PATCH RESEND 1/1 x86/kexec: crash_vmclear_local_vmcss needs __rcu
In reply to Zhang YanfeiThis removes the sparse warning:arch/x86/kernel/crash.c:49:32: sparse: incompatible types in comparison expression (different address spaces)
--- arch/x86/include/asm/kexec.h | 3 ++- arch/x86/kernel/crash.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-)
arch/x86/include/asm/kexec.h +2 -1
@@ -163,7 +163,8 @@ struct kimage_arch { };#endif -extern void (*crash_vmclear_loaded_vmcss)(void ); +typedef void crash_vmclear_fn (void ); +extern crash_vmclear_fn __rcu *crash_vmclear_loaded_vmcss;#endif /* __ASSEMBLY__ */
arch/x86/kernel/crash.c +2 -2
@@ -38,12 +38,12 @@ int in_crash_kexec;* * protected by rcu. */ -void (*crash_vmclear_loaded_vmcss)(void ) =NULL ; +crash_vmclear_fn __rcu *crash_vmclear_loaded_vmcss =NULL ;EXPORT_SYMBOL_GPL (crash_vmclear_loaded_vmcss);static inline void cpu_crash_vmclear_loaded_vmcss (void ) { -void (*do_vmclear_operation)(void ) =NULL ; +crash_vmclear_fn *do_vmclear_operation =NULL ;rcu_read_lock (); do_vmclear_operation =rcu_dereference (crash_vmclear_loaded_vmcss);
Signature · 1 line
1.7.1
Marcelo Tosatti
AppliedQuoted 9 lines · Zhang Yanfei
This removes the sparse warning:
arch/x86/kernel/crash.c:49:32: sparse: incompatible types in comparison expression (different address spaces)Reported-by kbuild test robot <[email protected]>Signed-off-by Zhang Yanfei <[email protected]>--- arch/x86/include/asm/kexec.h | 3 ++- arch/x86/kernel/crash.c | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-)
Applied, thanks.