public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
From: <Conor.Dooley@microchip.com>
To: <palmer@dabbelt.com>, <ben.dooks@sifive.com>
Cc: <linux-riscv@lists.infradead.org>, <paul.walmsley@sifive.com>,
	<aou@eecs.berkeley.edu>, <sudip.mukherjee@sifive.com>,
	<jude.onyenegecha@sifive.com>
Subject: Re: [PATCH] riscv/vdso: fix missing vdso_data declaration
Date: Fri, 19 Aug 2022 07:08:10 +0000	[thread overview]
Message-ID: <71ddab3b-a38e-7957-d3cb-65d6ba64c4ef@microchip.com> (raw)
In-Reply-To: <mhng-192f7819-dbb8-4cd0-af6c-ef89d5579a14@palmer-ri-x1c9>

On 19/08/2022 00:01, Palmer Dabbelt wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> On Sun, 14 Aug 2022 09:10:48 PDT (-0700), Conor.Dooley@microchip.com wrote:
>> On 11/08/2022 22:26, Conor.Dooley@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@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@sifive.com>
>>>>>
>>>>> Reviewed-by: Conor Dooley <conor.dooley@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
> 
> Do you mind just sending a v2?  It's a touch easier than trying to
> squash stuff in.
> 

Ben sent the patch so I didn't(/don't) want to encroach by sending
a v2.

Ben, FWIW what I did was:
diff --git a/arch/riscv/include/asm/vdso/vsyscall.h b/arch/riscv/include/asm/vdso/vsyscall.h
index 82fd5d83bd60..e82ce97d27d2 100644
--- a/arch/riscv/include/asm/vdso/vsyscall.h
+++ b/arch/riscv/include/asm/vdso/vsyscall.h
@@ -5,7 +5,10 @@
  #ifndef __ASSEMBLY__
  
  #include <linux/timekeeper_internal.h>
+
+#ifdef CONFIG_GENERIC_TIME_VSYSCALL
  #include <vdso/datapage.h>
+#endif
  
  extern struct vdso_data *vdso_data;
  
But I now I am not sure if that is the correct approach.
There's an ARCH_HAS_VDSO_DATA in vdso/datapage.h:

#ifdef CONFIG_ARCH_HAS_VDSO_DATA
#include <asm/vdso/data.h>
#else
struct arch_vdso_data {};
#endif

I did a little more digging since what we are currently doing is the
exact same as what arm64 does.. I spotted that in our Kconfig we:
select GENERIC_TIME_VSYSCALL if MMU && 64BIT

Why does that depend on 64BIT? Should that have been updated when we
added the compat stuff? If that is turned on, I can trigger the build
error without applying Ben's patch.

arm64 also has a compat syscall for __NR_gettimeofday. I don't know
anything about compat, so I cant contribute any reasons as to why we
don't have one, but to the untrained eye it seems like Ben's patch is
exposing a deficiency in our compat support that may not have been
noticed because we had GENERIC_TIME_SYSCALL disabled for 32BIT.

Either way, I don't know enough about what's going on here to send an
actual patch, just enough to make some observations.
Conor.
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2022-08-19  7:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-13 22:06 [PATCH] riscv/vdso: fix missing vdso_data declaration Ben Dooks
2022-07-14  6:34 ` Conor.Dooley
2022-08-11 21:06   ` Palmer Dabbelt
2022-08-11 21:26     ` Conor.Dooley
2022-08-14 16:10       ` Conor.Dooley
2022-08-18 23:01         ` Palmer Dabbelt
2022-08-19  7:08           ` Conor.Dooley [this message]
2022-09-15 18:51             ` Conor.Dooley
2022-10-05 14:13               ` Ben Dooks

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=71ddab3b-a38e-7957-d3cb-65d6ba64c4ef@microchip.com \
    --to=conor.dooley@microchip.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=ben.dooks@sifive.com \
    --cc=jude.onyenegecha@sifive.com \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=sudip.mukherjee@sifive.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox