mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Xi Ruoyao <xry111@xry111.site>
To: Tiezhu Yang <yangtiezhu@loongson.cn>,
	Huacai Chen <chenhuacai@kernel.org>,
	WANG Xuerui <kernel@xen0n.name>
Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org,
	loongson-kernel@lists.loongnix.cn
Subject: Re: [PATCH v1 1/4] LoongArch: Move three functions from kprobes.c to inst.h
Date: Wed, 12 Apr 2023 18:39:04 +0800	[thread overview]
Message-ID: <6d06f74cb610b0012ff367fd1a7ac4aba027e304.camel@xry111.site> (raw)
In-Reply-To: <1681293901-24918-2-git-send-email-yangtiezhu@loongson.cn>

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@xry111.site>
School of Aerospace Science and Technology, Xidian University

  reply	other threads:[~2023-04-12 10:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-12 10:04 [PATCH v1 0/4] Add uprobes support for LoongArch Tiezhu Yang
2023-04-12 10:04 ` [PATCH v1 1/4] LoongArch: Move three functions from kprobes.c to inst.h Tiezhu Yang
2023-04-12 10:39   ` Xi Ruoyao [this message]
2023-04-13  1:55     ` Tiezhu Yang
2023-04-12 10:04 ` [PATCH v1 2/4] LoongArch: Add larch_insn_gen_break() to generate break insns Tiezhu Yang
2023-04-12 10:05 ` [PATCH v1 3/4] LoongArch: Use larch_insn_gen_break() for kprobes Tiezhu Yang
2023-04-12 11:08   ` Xi Ruoyao
2023-04-13  1:58     ` Tiezhu Yang
2023-04-12 10:05 ` [PATCH v1 4/4] LoongArch: Add uprobes support Tiezhu Yang

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=6d06f74cb610b0012ff367fd1a7ac4aba027e304.camel@xry111.site \
    --to=xry111@xry111.site \
    --cc=chenhuacai@kernel.org \
    --cc=kernel@xen0n.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loongarch@lists.linux.dev \
    --cc=loongson-kernel@lists.loongnix.cn \
    --cc=yangtiezhu@loongson.cn \
    /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®