From: tongtiangen <tongtiangen@huawei.com>
To: "Björn Töpel" <bjorn.topel@gmail.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>,
Palmer Dabbelt <palmer@dabbelt.com>,
Palmer Dabbelt <palmerdabbelt@google.com>,
Albert Ou <aou@eecs.berkeley.edu>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>,
linux-riscv <linux-riscv@lists.infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Netdev <netdev@vger.kernel.org>, bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH bpf-next] riscv, bpf: fix some compiler error
Date: Wed, 3 Nov 2021 15:26:48 +0800 [thread overview]
Message-ID: <f3ed7e48-c565-9147-eca0-6298a36b3d61@huawei.com> (raw)
In-Reply-To: <CAJ+HfNj_p36trWFzdyxVVgykrPVq=OvKcYq61w2QyKsHwa0gDw@mail.gmail.com>
On 2021/11/3 14:10, Björn Töpel wrote:
> On Wed, 3 Nov 2021 at 04:06, tongtiangen <tongtiangen@huawei.com> wrote:
>>
> [...]
>>>
>> Hi Björn:
>> From the perspective of development, introduce asm/extable.h is also prepare for the
>> subsequent modification of exception_table_entry, such as:
>> 1. https://lkml.org/lkml/2021/10/20/591
>> 2. https://lore.kernel.org/linux-arm-kernel/20211019160219.5202-11-mark.rutland@arm.com/
>>
>> Therefore, the prototype declarations and definitions related to kernel config are placed in head file,
>> which can avoid compiler error and simplify the rendering of functions.
>>
>
> Sure, but *this* patch is about getting the broken RV32 build to work,
> aimed for the bpf tree. Moving the extable.h is unrelated, and should
> not be done here. IMO it would be better to have this patch small/easy
> to read. I can't really see how this patch helps, when merging with
> Jisheng's work.
>
> ...and I still think that:
> --8<--
> diff --git a/arch/riscv/mm/extable.c b/arch/riscv/mm/extable.c
> index 18bf338303b6..ddb7d3b99e89 100644
> --- a/arch/riscv/mm/extable.c
> +++ b/arch/riscv/mm/extable.c
> @@ -11,7 +11,7 @@
> #include <linux/module.h>
> #include <linux/uaccess.h>
>
> -#ifdef CONFIG_BPF_JIT
> +#if defined(CONFIG_BPF_JIT) && defined(CONFIG_ARCH_RV64I)
> int rv_bpf_fixup_exception(const struct exception_table_entry *ex,
> struct pt_regs *regs);
> #endif
>
> @@ -23,7 +23,7 @@ int fixup_exception(struct pt_regs *regs)
> if (!fixup)
> return 0;
>
> -#ifdef CONFIG_BPF_JIT
> +#if defined(CONFIG_BPF_JIT) && defined(CONFIG_ARCH_RV64I)
> if (regs->epc >= BPF_JIT_REGION_START && regs->epc < BPF_JIT_REGION_END)
> return rv_bpf_fixup_exception(fixup, regs);
> #endif
> diff --git a/arch/riscv/net/bpf_jit_comp64.c b/arch/riscv/net/bpf_jit_comp64.c
> index 2ca345c7b0bf..6372a235522d 100644
> --- a/arch/riscv/net/bpf_jit_comp64.c
> +++ b/arch/riscv/net/bpf_jit_comp64.c
> @@ -459,6 +459,8 @@ static int emit_call(bool fixed, u64 addr, struct
> rv_jit_context *ctx)
> #define BPF_FIXUP_OFFSET_MASK GENMASK(26, 0)
> #define BPF_FIXUP_REG_MASK GENMASK(31, 27)
>
> +int rv_bpf_fixup_exception(const struct exception_table_entry *ex,
> + struct pt_regs *regs);
> int rv_bpf_fixup_exception(const struct exception_table_entry *ex,
> struct pt_regs *regs)
> {
> -->8--
>
> is much simpler.
Adding a function declaration in bpf_jit_comp64.c file cannot fix this compiler error:
....
when CONFIG_BPF_JIT and CONFIG_ARCH_64I is open, There is the following compiler error (W=1):
error: no previous prototype for 'rv_bpf_fixup_exception'
....
To fix this compiler error, you need to make a declaration in a header file, which is also
the reason for introducing extable.h.
Before making this patch, I thought about this change, but on the whole, I think the modification
scheme of adding header files moved me.;-)
>
>
>
> Thoughts?
> Björn
>
>
>
>
>> Thanks.
>> Tong.
>>
>>>
>>> Björn
>>> .
>>>
> .
>
next prev parent reply other threads:[~2021-11-03 7:27 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-02 14:56 Tong Tiangen
2021-11-02 15:45 ` Björn Töpel
2021-11-03 3:06 ` tongtiangen
2021-11-03 6:10 ` Björn Töpel
2021-11-03 7:26 ` tongtiangen [this message]
2021-11-03 7:41 ` Björn Töpel
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=f3ed7e48-c565-9147-eca0-6298a36b3d61@huawei.com \
--to=tongtiangen@huawei.com \
--cc=andrii@kernel.org \
--cc=aou@eecs.berkeley.edu \
--cc=ast@kernel.org \
--cc=bjorn.topel@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=netdev@vger.kernel.org \
--cc=palmer@dabbelt.com \
--cc=palmerdabbelt@google.com \
--cc=paul.walmsley@sifive.com \
--cc=songliubraving@fb.com \
--cc=yhs@fb.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
all inboxes | Powered by JetHome®