mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Masami Hiramatsu (Google) <mhiramat@kernel.org>
To: Yicong Yang <yangyicong@huawei.com>
Cc: Qinxin Xia <xiaqinxin@huawei.com>, <catalin.marinas@arm.com>,
	<will@kernel.org>, <naveen.n.rao@linux.ibm.com>,
	<anil.s.keshavamurthy@intel.com>, <davem@davemloft.net>,
	<linuxarm@huawei.com>, <yangyicong@hisilicon.com>,
	<linux-kernel@vger.kernel.org>, <fanghao11@huawei.com>,
	<prime.zeng@hisilicon.com>, <xuwei5@huawei.com>,
	<jonathan.cameron@huawei.com>
Subject: Re: [PATCH v6] arm64: kprobe: Enable OPTPROBE for arm64
Date: Tue, 14 Jan 2025 15:32:37 +0900	[thread overview]
Message-ID: <20250114153237.8a64048fe378e96f08cd1a8c@kernel.org> (raw)
In-Reply-To: <ccb1b193-9b30-a3ff-27e2-1dacd6e2359f@huawei.com>

On Tue, 14 Jan 2025 11:56:38 +0800
Yicong Yang <yangyicong@huawei.com> wrote:

> > diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> > index 62b5b08d809d..45287e185ce3 100644
> > --- a/kernel/kprobes.c
> > +++ b/kernel/kprobes.c
> > @@ -425,6 +425,24 @@ void opt_pre_handler(struct kprobe *p, struct pt_regs *regs)
> >  }
> >  NOKPROBE_SYMBOL(opt_pre_handler);
> >  
> > +void optprobe_optimized_callback(struct optimized_kprobe *op, struct pt_regs *regs)
> > +{
> > +	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)
> > +
> 
> should we make this function arch specific rather than in the framework? it's only
> used in the arm64 code in this patch currently.

Good catch. This should be in arch/arm64 at least in this patch.
If we consolidate the optprobe callback, it should be done in
a different patch. 

> 
> Thanks.
> 
> >  /* Free optimized instructions and optimized_kprobe */
> >  static void free_aggr_kprobe(struct kprobe *p)
> >  {
> > 
> 


-- 
Masami Hiramatsu (Google) <mhiramat@kernel.org>

  reply	other threads:[~2025-01-14  6:32 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-03  1:27 Qinxin Xia
2025-01-06  9:04 ` Masami Hiramatsu
2025-01-08  2:08   ` Qinxin Xia
2025-01-14  3:56 ` Yicong Yang
2025-01-14  6:32   ` Masami Hiramatsu [this message]
2025-01-15  9:26   ` Qinxin Xia

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=20250114153237.8a64048fe378e96f08cd1a8c@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=catalin.marinas@arm.com \
    --cc=davem@davemloft.net \
    --cc=fanghao11@huawei.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxarm@huawei.com \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=prime.zeng@hisilicon.com \
    --cc=will@kernel.org \
    --cc=xiaqinxin@huawei.com \
    --cc=xuwei5@huawei.com \
    --cc=yangyicong@hisilicon.com \
    --cc=yangyicong@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

all inboxes | Powered by JetHome®