[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220927022435.129965-3-liaochang1@huawei.com>
Date: Tue, 27 Sep 2022 10:24:34 +0800
From: Liao Chang <liaochang1@...wei.com>
To: <catalin.marinas@....com>, <will@...nel.org>, <guoren@...nel.org>,
<paul.walmsley@...ive.com>, <palmer@...belt.com>,
<aou@...s.berkeley.edu>, <mhiramat@...nel.org>,
<rostedt@...dmis.org>, <maz@...nel.org>,
<alexandru.elisei@....com>, <liaochang1@...wei.com>
CC: <linux-arm-kernel@...ts.infradead.org>,
<linux-kernel@...r.kernel.org>, <linux-csky@...r.kernel.org>,
<linux-riscv@...ts.infradead.org>
Subject: [PATCH 2/3] csky/kprobe: Optimize the performance of patching single-step slot
Single-step slot would not be used until kprobe is enabled, that means
no race condition occurs on it under SMP, hence it is safe to pacth ss
slot without stopping machine.
Acked-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>
Signed-off-by: Liao Chang <liaochang1@...wei.com>
---
arch/csky/kernel/probes/kprobes.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/csky/kernel/probes/kprobes.c b/arch/csky/kernel/probes/kprobes.c
index 3c6e5c725d81..4feb5ce16264 100644
--- a/arch/csky/kernel/probes/kprobes.c
+++ b/arch/csky/kernel/probes/kprobes.c
@@ -57,7 +57,11 @@ static void __kprobes arch_prepare_ss_slot(struct kprobe *p)
p->ainsn.api.restore = (unsigned long)p->addr + offset;
- patch_text(p->ainsn.api.insn, p->opcode);
+ memcpy(p->ainsn.api.insn, &p->opcode, offset);
+ dcache_wb_range((unsigned long)p->ainsn.api.insn,
+ (unsigned long)p->ainsn.api.insn + offset);
+ icache_inv_range((unsigned long)p->ainsn.api.insn,
+ (unsigned long)p->ainsn.api.insn + offset);
}
static void __kprobes arch_prepare_simulate(struct kprobe *p)
--
2.17.1
Powered by blists - more mailing lists