[PATCH RFC v2 riscv/for-next 5/5] riscv: align arch_static_branch function

Guo Ren guoren at kernel.org
Wed Sep 14 07:06:29 PDT 2022


Is this patch related to this series?

On Tue, Sep 13, 2022 at 5:44 PM Andy Chiu <andy.chiu at sifive.com> wrote:
>
> runtime code patching must be done at a naturally aligned address, or we
> may execute on a partial instruction.
If it's true, we can't use static branches at all. Have you
encountered a problem?

If you are right, arm64 ... csky all need the patch.


>
> Signed-off-by: Andy Chiu <andy.chiu at sifive.com>
> Reviewed-by: Greentime Hu <greentime.hu at sifive.com>
> ---
>  arch/riscv/include/asm/jump_label.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/arch/riscv/include/asm/jump_label.h b/arch/riscv/include/asm/jump_label.h
> index 38af2ec7b9bf..729991e8f782 100644
> --- a/arch/riscv/include/asm/jump_label.h
> +++ b/arch/riscv/include/asm/jump_label.h
> @@ -18,6 +18,7 @@ static __always_inline bool arch_static_branch(struct static_key *key,
>                                                bool branch)
>  {
>         asm_volatile_goto(
> +               "       .align          2                       \n\t"
>                 "       .option push                            \n\t"
>                 "       .option norelax                         \n\t"
>                 "       .option norvc                           \n\t"
> @@ -39,6 +40,7 @@ static __always_inline bool arch_static_branch_jump(struct static_key *key,
>                                                     bool branch)
>  {
>         asm_volatile_goto(
> +               "       .align          2                       \n\t"
>                 "       .option push                            \n\t"
>                 "       .option norelax                         \n\t"
>                 "       .option norvc                           \n\t"
> --
> 2.36.0
>


-- 
Best Regards
 Guo Ren



More information about the linux-riscv mailing list