lkml.org 
[lkml]   [2023]   [Apr]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v1 1/4] LoongArch: Move three functions from kprobes.c to inst.h
From
Date


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

\
 
 \ /
  Last update: 2023-04-13 03:56    [W:0.048 / U:0.492 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site