From: Kefeng Wang <wangkefeng.wang@huawei.com>
To: Jisheng Zhang <jszhang3@mail.ustc.edu.cn>,
Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Masahiro Yamada <masahiroy@kernel.org>,
Michal Marek <michal.lkml@markovi.net>,
Nick Desaulniers <ndesaulniers@google.com>
Cc: <linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
<linux-kbuild@vger.kernel.org>
Subject: Re: [PATCH v2 1/2] riscv: consolidate __ex_table construction
Date: Thu, 21 Oct 2021 19:38:41 +0800 [thread overview]
Message-ID: <bd3419a3-b858-1a4d-a081-d09bbc56eaa7@huawei.com> (raw)
In-Reply-To: <20211020220610.25443e4c@xhacker>
On 2021/10/20 22:06, Jisheng Zhang wrote:
> From: Jisheng Zhang <jszhang@kernel.org>
>
> Consolidate all the __ex_table constuction code with a _ASM_EXTABLE
> helper.
>
> There should be no functional change as a result of this patch.
>
> Signed-off-by: Jisheng Zhang <jszhang@kernel.org>
> ---
> arch/riscv/include/asm/futex.h | 12 +++-------
> arch/riscv/include/asm/uaccess.h | 40 +++++++++++---------------------
> 2 files changed, 17 insertions(+), 35 deletions(-)
>
> diff --git a/arch/riscv/include/asm/futex.h b/arch/riscv/include/asm/futex.h
> index 1b00badb9f87..3191574e135c 100644
> --- a/arch/riscv/include/asm/futex.h
> +++ b/arch/riscv/include/asm/futex.h
> @@ -30,10 +30,7 @@
> "3: li %[r],%[e] \n" \
> " jump 2b,%[t] \n" \
> " .previous \n" \
> - " .section __ex_table,\"a\" \n" \
> - " .balign " RISCV_SZPTR " \n" \
> - " " RISCV_PTR " 1b, 3b \n" \
> - " .previous \n" \
> + _ASM_EXTABLE(1b, 3b) \
> : [r] "+r" (ret), [ov] "=&r" (oldval), \
> [u] "+m" (*uaddr), [t] "=&r" (tmp) \
> : [op] "Jr" (oparg), [e] "i" (-EFAULT) \
> @@ -103,11 +100,8 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
> "4: li %[r],%[e] \n"
> " jump 3b,%[t] \n"
> " .previous \n"
> - " .section __ex_table,\"a\" \n"
> - " .balign " RISCV_SZPTR " \n"
> - " " RISCV_PTR " 1b, 4b \n"
> - " " RISCV_PTR " 2b, 4b \n"
> - " .previous \n"
> + _ASM_EXTABLE(1b, 4b) \
> + _ASM_EXTABLE(2b, 4b) \
> : [r] "+r" (ret), [v] "=&r" (val), [u] "+m" (*uaddr), [t] "=&r" (tmp)
> : [ov] "Jr" (oldval), [nv] "Jr" (newval), [e] "i" (-EFAULT)
> : "memory");
> diff --git a/arch/riscv/include/asm/uaccess.h b/arch/riscv/include/asm/uaccess.h
> index f314ff44c48d..35802e72ace8 100644
> --- a/arch/riscv/include/asm/uaccess.h
> +++ b/arch/riscv/include/asm/uaccess.h
> @@ -10,6 +10,12 @@
>
> #include <asm/pgtable.h> /* for TASK_SIZE */
>
> +#define _ASM_EXTABLE(from, to) \
> + " .pushsection __ex_table, \"a\"\n" \
> + " .balign " RISCV_SZPTR " \n" \
> + " " RISCV_PTR "(" #from "), (" #to ")\n" \
> + " .popsection\n"
> +
The jump_label mechanism could use this macro too,
see arch/riscv/include/asm/jump_label.h, maybe move the above into asm.h
and also do some replace in next patch ?
Question: the jump label use relative address, but why not trigger the
Section mismatch issue?
next prev parent reply other threads:[~2021-10-21 11:38 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-20 14:05 [PATCH v2 0/2] riscv: switch to relative extable Jisheng Zhang
2021-10-20 14:06 ` [PATCH v2 1/2] riscv: consolidate __ex_table construction Jisheng Zhang
2021-10-21 11:38 ` Kefeng Wang [this message]
2021-10-21 15:43 ` Jisheng Zhang
2021-10-22 0:43 ` Kefeng Wang
2021-10-20 14:07 ` [PATCH v2 2/2] riscv: switch to relative exception tables Jisheng Zhang
2021-10-21 11:42 ` Kefeng Wang
2021-10-21 15:47 ` Jisheng Zhang
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=bd3419a3-b858-1a4d-a081-d09bbc56eaa7@huawei.com \
--to=wangkefeng.wang@huawei.com \
--cc=aou@eecs.berkeley.edu \
--cc=jszhang3@mail.ustc.edu.cn \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=masahiroy@kernel.org \
--cc=michal.lkml@markovi.net \
--cc=ndesaulniers@google.com \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@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