[PATCH] riscv/vdso: fix missing vdso_data declaration

Conor.Dooley at microchip.com Conor.Dooley at microchip.com
Sun Aug 14 09:10:48 PDT 2022


On 11/08/2022 22:26, Conor.Dooley at microchip.com wrote:
> On 11/08/2022 22:06, Palmer Dabbelt wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>
>> On Wed, 13 Jul 2022 23:34:36 PDT (-0700), Conor.Dooley at microchip.com wrote:
>>> On 13/07/2022 23:06, Ben Dooks wrote:
>>>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>>>>
>>>> The vdso_data is defined by has no declaration as the
>>>> arch/riscv/kernel/vdso.c does not include asm/vdso/vsyscall.h
>>>> for the definition. Fix the following sparse warning by
>>>> adding in the asm/vdso/vsyscall.h
>>>>
>>>> arch/riscv/kernel/vdso.c:42:18: warning: symbol 'vdso_data' was not declared. Should it be static?
>>>>
>>>> Signed-off-by: Ben Dooks <ben.dooks at sifive.com>
>>>
>>> Reviewed-by: Conor Dooley <conor.dooley at microchip.com>
>>
>> This one gives me a bunch of build errors, things like
> 
> Hmm, what's your defconfig for this?
> I tested with my dev defconfig and riscv's default one at the time but
> saw nothing. Tried both again now & no errors.

Reproduced it with riscv-systems-ci.
Looks like it is happening on one of your 32 bit defconfigs where
CONFIG_GENERIC_TIME_VSYSCALL is not set. In vdso.c, the include of
vdso/datapage.h is guarded by CONFIG_GENERIC_TIME_VSYSCALL but the
one in asm/vdso/vsyscall.h is not.

Adding the same guard around the include there fixes the build /shrug

FWIW, config is attached.

> 
>>
>> In file included from /scratch/merges/ko-linux-next/linux/include/vdso/datapage.h:137,
>>                 from /scratch/merges/ko-linux-next/linux/arch/riscv/include/asm/vdso/vsyscall.h:8,
>>                 from /scratch/merges/ko-linux-next/linux/arch/riscv/kernel/vdso.c:16:
>> /scratch/merges/ko-linux-next/linux/arch/riscv/include/asm/vdso/gettimeofday.h: In function 'gettimeofday_fallback':
>> /scratch/merges/ko-linux-next/linux/arch/riscv/include/asm/vdso/gettimeofday.h:21:38: error: '__NR_gettimeofday' undeclared (first use in this function)
>>   21 |         register long nr asm("a7") = __NR_gettimeofday;
>>      |                                      ^~~~~~~~~~~~~~~~~
>> /scratch/merges/ko-linux-next/linux/arch/riscv/include/asm/vdso/gettimeofday.h:21:38: note: each undeclared identifier is reported only once for each function it appears in
>> /scratch/merges/ko-linux-next/linux/arch/riscv/include/asm/vdso/gettimeofday.h: In function 'clock_gettime_fallback':
>> /scratch/merges/ko-linux-next/linux/arch/riscv/include/asm/vdso/gettimeofday.h:37:38: error: '__NR_clock_gettime' undeclared (first use in this function)
>>   37 |         register long nr asm("a7") = __NR_clock_gettime;
>>      |                                      ^~~~~~~~~~~~~~~~~~
>> /scratch/merges/ko-linux-next/linux/arch/riscv/include/asm/vdso/gettimeofday.h: In function 'clock_getres_fallback':
>> /scratch/merges/ko-linux-next/linux/arch/riscv/include/asm/vdso/gettimeofday.h:53:38: error: '__NR_clock_getres' undeclared (first use in this function)
>>   53 |         register long nr asm("a7") = __NR_clock_getres;
>>      |                                      ^~~~~~~~~~~~~~~~~
>> /scratch/merges/ko-linux-next/linux/arch/riscv/kernel/vdso.c: At top level:
>> /scratch/merges/ko-linux-next/linux/arch/riscv/kernel/vdso.c:22:8: error: redefinition of 'struct vdso_data'
>>   22 | struct vdso_data {
>>      |        ^~~~~~~~~
>> /scratch/merges/ko-linux-next/linux/include/vdso/datapage.h:90:8: note: originally defined here
>>   90 | struct vdso_data {
>>      |        ^~~~~~~~~
>> /scratch/merges/ko-linux-next/linux/arch/riscv/kernel/vdso.c:51:19: error: conflicting types for 'vdso_data'; have 'struct vdso_data *'
>>   51 | struct vdso_data *vdso_data = &vdso_data_store.data;
>>      |                   ^~~~~~~~~
>> /scratch/merges/ko-linux-next/linux/arch/riscv/include/asm/vdso/vsyscall.h:10:26: note: previous declaration of 'vdso_data' with type 'struct vdso_data *'
>>   10 | extern struct vdso_data *vdso_data;
>>      |                          ^~~~~~~~~
>>
>>>
>>>> ---
>>>>   arch/riscv/kernel/vdso.c | 1 +
>>>>   1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/arch/riscv/kernel/vdso.c b/arch/riscv/kernel/vdso.c
>>>> index 69b05b6c181b..7564f0208957 100644
>>>> --- a/arch/riscv/kernel/vdso.c
>>>> +++ b/arch/riscv/kernel/vdso.c
>>>> @@ -13,6 +13,7 @@
>>>>   #include <linux/err.h>
>>>>   #include <asm/page.h>
>>>>   #include <asm/vdso.h>
>>>> +#include <asm/vdso/vsyscall.h>
>>>>   #include <linux/time_namespace.h>
>>>>
>>>>   #ifdef CONFIG_GENERIC_TIME_VSYSCALL
>>>> -- 
>>>> 2.35.1
>>>>
>>>>
>>>> _______________________________________________
>>>> linux-riscv mailing list
>>>> linux-riscv at lists.infradead.org
>>>> http://lists.infradead.org/mailman/listinfo/linux-riscv
>>>
> 
> _______________________________________________
> linux-riscv mailing list
> linux-riscv at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-riscv

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: oldconfig
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20220814/c6c71005/attachment.ksh>


More information about the linux-riscv mailing list