public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Masami Hiramatsu <mhiramat@kernel.org>
To: Jiri Olsa <jolsa@redhat.com>
Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>,
	Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
	"David S. Miller" <davem@davemloft.net>,
	Peter Zijlstra <peterz@infradead.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] kprobe: Remove kprobe_instance and its related functions
Date: Wed, 22 Dec 2021 23:28:20 +0900	[thread overview]
Message-ID: <20211222232820.df0aafcc3baeb309fadef4d7@kernel.org> (raw)
In-Reply-To: <20211222100345.412013-1-jolsa@kernel.org>

On Wed, 22 Dec 2021 11:03:45 +0100
Jiri Olsa <jolsa@redhat.com> wrote:

> The last user od kprobe_instance got removed in [1],
> now it just occupies space, removing it.
> 
> [1] ec6aba3d2be1 ("kprobes: Remove kprobe::fault_handler")
> 

Good catch! Thank you very much!

Acked-by: Masami Hiramatsu <mhiramat@kernel.org>


> Cc: Peter Zijlstra <peterz@infradead.org>
> Signed-off-by: Jiri Olsa <jolsa@kernel.org>
> ---
>  kernel/kprobes.c | 24 ++----------------------
>  1 file changed, 2 insertions(+), 22 deletions(-)
> 
> diff --git a/kernel/kprobes.c b/kernel/kprobes.c
> index 21eccc961bba..d20ae8232835 100644
> --- a/kernel/kprobes.c
> +++ b/kernel/kprobes.c
> @@ -62,7 +62,6 @@ static bool kprobes_all_disarmed;
>  
>  /* This protects 'kprobe_table' and 'optimizing_list' */
>  static DEFINE_MUTEX(kprobe_mutex);
> -static DEFINE_PER_CPU(struct kprobe *, kprobe_instance);
>  
>  kprobe_opcode_t * __weak kprobe_lookup_name(const char *name,
>  					unsigned int __unused)
> @@ -353,17 +352,6 @@ struct kprobe_insn_cache kprobe_optinsn_slots = {
>  #endif
>  #endif
>  
> -/* We have preemption disabled.. so it is safe to use __ versions */
> -static inline void set_kprobe_instance(struct kprobe *kp)
> -{
> -	__this_cpu_write(kprobe_instance, kp);
> -}
> -
> -static inline void reset_kprobe_instance(void)
> -{
> -	__this_cpu_write(kprobe_instance, NULL);
> -}
> -
>  /*
>   * This routine is called either:
>   *	- under the 'kprobe_mutex' - during kprobe_[un]register().
> @@ -421,11 +409,8 @@ void opt_pre_handler(struct kprobe *p, struct pt_regs *regs)
>  	struct kprobe *kp;
>  
>  	list_for_each_entry_rcu(kp, &p->list, list) {
> -		if (kp->pre_handler && likely(!kprobe_disabled(kp))) {
> -			set_kprobe_instance(kp);
> +		if (kp->pre_handler && likely(!kprobe_disabled(kp)))
>  			kp->pre_handler(kp, regs);
> -		}
> -		reset_kprobe_instance();
>  	}
>  }
>  NOKPROBE_SYMBOL(opt_pre_handler);
> @@ -1177,11 +1162,9 @@ static int aggr_pre_handler(struct kprobe *p, struct pt_regs *regs)
>  
>  	list_for_each_entry_rcu(kp, &p->list, list) {
>  		if (kp->pre_handler && likely(!kprobe_disabled(kp))) {
> -			set_kprobe_instance(kp);
>  			if (kp->pre_handler(kp, regs))
>  				return 1;
>  		}
> -		reset_kprobe_instance();
>  	}
>  	return 0;
>  }
> @@ -1193,11 +1176,8 @@ static void aggr_post_handler(struct kprobe *p, struct pt_regs *regs,
>  	struct kprobe *kp;
>  
>  	list_for_each_entry_rcu(kp, &p->list, list) {
> -		if (kp->post_handler && likely(!kprobe_disabled(kp))) {
> -			set_kprobe_instance(kp);
> +		if (kp->post_handler && likely(!kprobe_disabled(kp)))
>  			kp->post_handler(kp, regs, flags);
> -			reset_kprobe_instance();
> -		}
>  	}
>  }
>  NOKPROBE_SYMBOL(aggr_post_handler);
> -- 
> 2.33.1
> 


-- 
Masami Hiramatsu <mhiramat@kernel.org>

  reply	other threads:[~2021-12-22 14:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-22 10:03 [PATCH] kprobe: Remove kprobe_instance and its related functions Jiri Olsa
2021-12-22 14:28 ` Masami Hiramatsu [this message]
2021-12-24  6:31 ` Christoph Hellwig

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=20211222232820.df0aafcc3baeb309fadef4d7@kernel.org \
    --to=mhiramat@kernel.org \
    --cc=anil.s.keshavamurthy@intel.com \
    --cc=davem@davemloft.net \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=naveen.n.rao@linux.ibm.com \
    --cc=peterz@infradead.org \
    /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