On Mon, Dec 09, 2024 at 11:41:26AM +0900, Masami Hiramatsu (Google) wrote: > From: Masami Hiramatsu (Google) <[email protected]> > > Use guard() for text_mutex, cpu_read_lock, and jump_label_lock in > the kprobes.
> @@ -853,29 +850,24 @@ static void try_to_optimize_kprobe(struct kprobe *p) > return; > > /* For preparing optimization, jump_label_text_reserved() is called. */ > - cpus_read_lock(); > - jump_label_lock(); > - mutex_lock(&text_mutex); > + guard(cpus_read_lock)(); > + guard(jump_label_lock)(); > + guard(mutex)(&text_mutex); > > @@ -1294,62 +1280,55 @@ static int register_aggr_kprobe(struct kprobe > *orig_p, struct kprobe *p) > int ret = 0; > struct kprobe *ap = orig_p; > > - cpus_read_lock(); > - > - /* For preparing optimization, jump_label_text_reserved() is called */ > - jump_label_lock(); > - mutex_lock(&text_mutex); Why does kprobe need jump_label_lock and how does it then not also need static_call_lock ?
