Messages in this thread | | | Subject | Re: [PATCH v1 1/4] LoongArch: Move three functions from kprobes.c to inst.h | From | Tiezhu Yang <> | Date | Thu, 13 Apr 2023 09:55:03 +0800 |
| |
On 04/12/2023 06:39 PM, Xi Ruoyao wrote: > 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.
OK, I will move the three functions from kprobes.c to inst.c.
> >> +{ >> + 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.
I prefer leave it as it is.
Thanks, Tiezhu
| |