[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <beee96f4-2cf4-9be7-a891-3f6d5ee4baa9@linux.alibaba.com>
Date: Sat, 23 Jan 2021 15:33:28 +0800
From: Guo Ren <guoren@...ux.alibaba.com>
To: Palmer Dabbelt <palmer@...belt.com>,
linux-riscv@...ts.infradead.org
Cc: Paul Walmsley <paul.walmsley@...ive.com>, aou@...s.berkeley.edu,
penberg@...nel.org, me@...ki.ch, mhiramat@...nel.org,
mingo@...nel.org, linux-kernel@...r.kernel.org,
kernel-team@...roid.com, Palmer Dabbelt <palmerdabbelt@...gle.com>,
kernel test robot <lkp@...el.com>
Subject: Re: [PATCH] RISC-V: probes: Treat the instruction stream as
host-endian
Acked-by: Guo Ren <guoren@...nel.org>
On 2021/1/23 上午11:34, Palmer Dabbelt wrote:
> From: Palmer Dabbelt <palmerdabbelt@...gle.com>
>
> Neither of these are actually correct: the instruction stream is defined
> (for versions of the ISA manual newer than 2.2) as a stream of 16-bit
> little-endian parcels, which is different than just being little-endian.
> In theory we should represent this as a type, but we don't have any
> concrete plans for the big endian stuff so it doesn't seem worth the
> time -- we've got variants of this all over the place.
>
> Instead I'm just dropping the unnecessary type conversion, which is a
> NOP on LE systems but causes an sparse error as the types are all mixed
> up.
>
> Reported-by: kernel test robot <lkp@...el.com>
> Signed-off-by: Palmer Dabbelt <palmerdabbelt@...gle.com>
> ---
> arch/riscv/kernel/probes/decode-insn.c | 2 +-
> arch/riscv/kernel/probes/kprobes.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/riscv/kernel/probes/decode-insn.c b/arch/riscv/kernel/probes/decode-insn.c
> index 0876c304ca77..0ed043acc882 100644
> --- a/arch/riscv/kernel/probes/decode-insn.c
> +++ b/arch/riscv/kernel/probes/decode-insn.c
> @@ -16,7 +16,7 @@
> enum probe_insn __kprobes
> riscv_probe_decode_insn(probe_opcode_t *addr, struct arch_probe_insn *api)
> {
> - probe_opcode_t insn = le32_to_cpu(*addr);
> + probe_opcode_t insn = *addr;
>
> /*
> * Reject instructions list:
> diff --git a/arch/riscv/kernel/probes/kprobes.c b/arch/riscv/kernel/probes/kprobes.c
> index e60893bd87db..a2ec18662fee 100644
> --- a/arch/riscv/kernel/probes/kprobes.c
> +++ b/arch/riscv/kernel/probes/kprobes.c
> @@ -57,7 +57,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p)
> }
>
> /* copy instruction */
> - p->opcode = le32_to_cpu(*p->addr);
> + p->opcode = *p->addr;
>
> /* decode instruction */
> switch (riscv_probe_decode_insn(p->addr, &p->ainsn.api)) {
Powered by blists - more mailing lists