linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "chengjian (D)" <cj.chengjian@huawei.com>
To: <andrew.murray@arm.com>, <bristot@redhat.com>,
	<jakub.kicinski@netronome.com>, Kees Cook <keescook@chromium.org>
Cc: "x86@kernel.org" <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	"Xiexiuqi (Xie XiuQi)" <xiexiuqi@huawei.com>,
	Li Bin <huawei.libin@huawei.com>, <bobo.shaobowang@huawei.com>,
	"chengjian (D)" <cj.chengjian@huawei.com>
Subject: Why is text_mutex used in jump_label_transform for x86_64
Date: Thu, 19 Mar 2020 21:49:04 +0800	[thread overview]
Message-ID: <f7f686f2-4f28-1763-dd19-43eff6a5a8f2@huawei.com> (raw)

Hi,everyone

I'm sorry to disturb you. I have a problem about jump_label, and a bit 
confused about the code

I noticed that text_mutex is used in this function under x86_64 
architecture,
but other architectures do not.

in arch/x86/kernel/jump_label.c
         static void __ref jump_label_transform(struct jump_entry *entry,
              enum jump_label_type type,
              int init)
         {
          mutex_lock(&text_mutex);
          __jump_label_transform(entry, type, init);
          mutex_unlock(&text_mutex);

in arch/arm64/kernel/jump_label.c

         void arch_jump_label_transform(struct jump_entry *entry,
                                        enum jump_label_type type)
         {
                 void *addr = (void *)jump_entry_code(entry);
                 u32 insn;

                 if (type == JUMP_LABEL_JMP) {
                         insn = 
aarch64_insn_gen_branch_imm(jump_entry_code(entry),
jump_entry_target(entry),
AARCH64_INSN_BRANCH_NOLINK);
                 } else {
                         insn = aarch64_insn_gen_nop();
                 }

                 aarch64_insn_patch_text_nosync(addr, insn);
         }


Is there anything wrong with x86

or

is this missing for other architectures?


Thanks

---- Cheng Jian






             reply	other threads:[~2020-03-19 13:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-19 13:49 chengjian (D) [this message]
2020-03-20 10:27 ` Why is text_mutex used in jump_label_transform for x86_64 Peter Zijlstra
2020-04-06  8:39   ` chengjian (D)
2020-04-06  9:15     ` Peter Zijlstra
2020-04-06 14:10       ` Will Deacon
2020-04-08  1:17         ` chengjian (D)

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=f7f686f2-4f28-1763-dd19-43eff6a5a8f2@huawei.com \
    --to=cj.chengjian@huawei.com \
    --cc=andrew.murray@arm.com \
    --cc=bobo.shaobowang@huawei.com \
    --cc=bristot@redhat.com \
    --cc=huawei.libin@huawei.com \
    --cc=jakub.kicinski@netronome.com \
    --cc=keescook@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=x86@kernel.org \
    --cc=xiexiuqi@huawei.com \
    /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;
as well as URLs for NNTP newsgroup(s).