[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6d06f74cb610b0012ff367fd1a7ac4aba027e304.camel@xry111.site>
Date: Wed, 12 Apr 2023 18:39:04 +0800
From: Xi Ruoyao <xry111@...111.site>
To: Tiezhu Yang <yangtiezhu@...ngson.cn>,
Huacai Chen <chenhuacai@...nel.org>,
WANG Xuerui <kernel@...0n.name>
Cc: loongarch@...ts.linux.dev, linux-kernel@...r.kernel.org,
loongson-kernel@...ts.loongnix.cn
Subject: Re: [PATCH v1 1/4] LoongArch: Move three functions from kprobes.c
to inst.h
On Wed, 2023-04-12 at 18:04 +0800, Tiezhu Yang wrote:
> +static inline bool insns_not_supported(union loongarch_instruction insn)
This function seems long enough (to me) not to use "static inline".
Note that most part of this function belongs to a cold path, and IMO
it's bad to inline a cold path into every caller.
> +{
> + switch (insn.reg2i14_format.opcode) {
> + case llw_op:
> + case lld_op:
> + case scw_op:
> + case scd_op:
> + pr_notice("kprobe: ll and sc instructions are not supported\n");
> + return true;
> + }
> +
> + switch (insn.reg1i21_format.opcode) {
> + case bceqz_op:
> + pr_notice("kprobe: bceqz and bcnez instructions are not supported\n");
> + return true;
> + }
> +
> + return false;
> +}
> +
> +static inline bool insns_need_simulation(union loongarch_instruction insn)
> +{
> + if (is_pc_ins(&insn))
> + return true;
> +
> + if (is_branch_ins(&insn))
> + return true;
> +
> + return false;
I'd write "return is_pc_ins(&insn) || is_branch_ins(&insn);" here, but
there is no behavioral difference anyway.
> +}
--
Xi Ruoyao <xry111@...111.site>
School of Aerospace Science and Technology, Xidian University
Powered by blists - more mailing lists