[External] Re: [PATCH v3 1/2] riscv: process: Introduce idle thread using Zawrs extension

Xu Lu luxu.kernel at bytedance.com
Wed Sep 25 08:04:09 PDT 2024


Hi Andreas,

Thanks a lot for your reply.

On Wed, Sep 25, 2024 at 10:10 PM Andreas Schwab <schwab at suse.de> wrote:
>
> On Sep 25 2024, Andrew Jones wrote:
>
> > On Wed, Sep 25, 2024 at 09:15:46PM GMT, Xu Lu wrote:
> >> @@ -148,6 +149,21 @@ static inline void wait_for_interrupt(void)
> >>      __asm__ __volatile__ ("wfi");
> >>  }
> >>
> >> +static inline void wrs_nto(unsigned long *addr)
> >> +{
> >> +    int val;
> >> +
> >> +    __asm__ __volatile__(
> >> +#ifdef CONFIG_64BIT
> >> +                    "lr.d %[p], %[v]\n\t"
> >> +#else
> >> +                    "lr.w %[p], %[v]\n\t"
> >> +#endif
> >
> > val is always 32-bit since it's an int. We should always use lr.w.
>
> Shouldn't val be unsigned long like the pointer that is being read?

Yes. As I replied Andrew, the 'int val' is a mistake here. The val can
be an unsigned long (thread_info->flags) when CONFIG_SMP is disabled.
I will update the declaration of val from 'int' to 'unsigned long'.

>
> --
> Andreas Schwab, SUSE Labs, schwab at suse.de
> GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
> "And now for something completely different."

Thanks,

Xu Lu.



More information about the linux-riscv mailing list