[PATCH] x86/kexec: crash_vmclear_local_vmcss needs __rcu

Zhang Yanfei zhangyanfei at cn.fujitsu.com
Tue Dec 11 04:09:33 EST 2012


于 2012年12月11日 16:10, Gleb Natapov 写道:
> On Tue, Dec 11, 2012 at 04:04:55PM +0800, Zhang Yanfei wrote:
>> 于 2012年12月11日 04:30, Marcelo Tosatti 写道:
>>> On Fri, Dec 07, 2012 at 01:40:56PM +0800, Zhang Yanfei wrote:
>>>> 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 <fengguang.wu at intel.com>
>>>> Signed-off-by: Zhang Yanfei <zhangyanfei at cn.fujitsu.com>
>>>> ---
>>>>  arch/x86/include/asm/kexec.h |    4 +++-
>>>>  arch/x86/kernel/crash.c      |    4 ++--
>>>>  2 files changed, 5 insertions(+), 3 deletions(-)
>>>>
>>>> diff --git a/arch/x86/include/asm/kexec.h b/arch/x86/include/asm/kexec.h
>>>> index 28feeba..16882cd 100644
>>>> --- a/arch/x86/include/asm/kexec.h
>>>> +++ b/arch/x86/include/asm/kexec.h
>>>> @@ -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__ */
>>>>  
>>>> diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
>>>> index 2f6b8e8..50ce1d6 100644
>>>> --- a/arch/x86/kernel/crash.c
>>>> +++ b/arch/x86/kernel/crash.c
>>>> @@ -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.
>>>
>>>
>>
>> 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.
>>
> Try to use typedef.
> 

Thanks. typedef works.




More information about the kexec mailing list