Re: [PATCH 2/3] arch/powerpc : optprobes for powerpc core
From: Masami Hiramatsu
Date: Fri Sep 09 2016 - 11:34:43 EST
Hi Anju,
On Fri, 9 Sep 2016 16:19:41 +0530
Anju T Sudhakar <anju@xxxxxxxxxxxxxxxxxx> wrote:
> >> +void arch_unoptimize_kprobe(struct optimized_kprobe *op)
> >> +{
> >> + arch_arm_kprobe(&op->kp);
> >> +}
> >> +
> >> +void arch_unoptimize_kprobes(struct list_head *oplist,
> >> + struct list_head *done_list)
> >> +{
> >> + struct optimized_kprobe *op;
> >> + struct optimized_kprobe *tmp;
> >> +
> >> + list_for_each_entry_safe(op, tmp, oplist, list) {
> >> + arch_unoptimize_kprobe(op);
> >> + list_move(&op->list, done_list);
> >> + }
> >> +}
> >> +
> >> +int arch_within_optimized_kprobe(struct optimized_kprobe *op,
> >> + unsigned long addr)
> >> +{
> >> + return 0;
> > Here, please check the address range as same as arm32 optprobe implementation.
> >
> > e.g.
> > return ((unsigned long)op->kp.addr <= addr &&
> > (unsigned long)op->kp.addr + RELATIVEJUMP_SIZE > addr);
> >
> >
> > Thank you,
>
> Do we really need this? The only case this check will succeed is if
> kp.addr is not a multiple of 4, which is not a valid address at all
> onPower. So should we again check here for that?
Yes, since that is exported function, which means it can be used from
other part, other usage (e.g. for debug reason someone wants to use it).
Please do not optimize the code only for current implementation, but
for generic use case.
Thank you,
--
Masami Hiramatsu <mhiramat@xxxxxxxxxx>