Re: [PATCH v7] arm64: kprobe: Enable OPTPROBE for arm64
From: Yicong Yang
Date: Sun Mar 30 2025 - 23:13:01 EST
On 2025/3/25 20:06, Qinxin Xia wrote:
>
> 在 2025/3/17 12:01, Yicong Yang 写道:
>> On 2025/2/16 15:00, Qinxin Xia wrote:
>>> This patch introduce optprobe for ARM64. In optprobe, probed
>>> instruction is replaced by a branch instruction to trampoline.
>>>
>>> Performance of optprobe on Hip08 platform is test using kprobe
>>> example module to analyze the latency of a kernel function,
>>> and here is the result:
>>>
[...]
>>> +
>>> +void optprobe_optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs)
>> need to be static.
> ok, I will fix it in the next version.
> It must be referenced by 'optprobe_trampoline.S' and cannot be covered by the static scope.
Then it should be marked as "asmlinkage" and declared in the header.
>>> +{
>>> + if (kprobe_disabled(&op->kp))
>>> + return;
>>> +
>>> + guard(preempt)();
>>> +
>>> + if (kprobe_running()) {
>>> + kprobes_inc_nmissed_count(&op->kp);
>>> + } else {
>>> + __this_cpu_write(current_kprobe, &op->kp);
>>> + get_kprobe_ctlblk()->kprobe_status = KPROBE_HIT_ACTIVE;
>>> + opt_pre_handler(&op->kp, regs);
>>> + __this_cpu_write(current_kprobe, NULL);
>>> + }
>>> +}
>>> +NOKPROBE_SYMBOL(optprobe_optimized_callback)