From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C6E4A1D0175; Fri, 1 Nov 2024 19:27:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730489270; cv=none; b=fX1Jveqi+TkCknVesfuMz4WR5wh5XHtitelSLDYIkSCW9RgP1j6NOpQqZ1CjwoaO0gPCOgWYxpBjI0UAHJOP3ZVqM56vbK1ZdeneWtVj0k1DiqMwr8TSGxnBWMcrthwYjXWgz6V7IuKSkI5oopPZ/BrmisA1yCDrHlTpz/e7a2g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1730489270; c=relaxed/simple; bh=qUoDfrWZtTXA73EqDAfTKWfPD+zXz7pQ7pVwV8DMHsI=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=k+ni3qHy+9wuYDtoLc8BdjjukfQfJVDWITLdY5r5vz/9w3jq7cStONrIwzFWI38TMcQyNfaz6S+9nwOeB3+runHf991G8gNtPcrqosAebTUxS5XiQSwH+FOdT8z0/bTVKTn1rzndRdxZKWcJ6x2pRLR4zKyK9vmPOwhNOJKJk8w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0FD00C4CECE; Fri, 1 Nov 2024 19:27:45 +0000 (UTC) Date: Fri, 1 Nov 2024 15:28:44 -0400 From: Steven Rostedt To: "Masami Hiramatsu (Google)" Cc: Alexei Starovoitov , Florent Revest , linux-trace-kernel@vger.kernel.org, LKML , Martin KaFai Lau , bpf , Alexei Starovoitov , Jiri Olsa , Alan Maguire , Mark Rutland , linux-arch@vger.kernel.org, Catalin Marinas , Will Deacon , Huacai Chen , WANG Xuerui , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Naveen N Rao , Madhavan Srinivasan , Paul Walmsley , Palmer Dabbelt , Albert Ou , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Mathieu Desnoyers , Andrew Morton Subject: Re: [PATCH v18 11/17] fprobe: Rewrite fprobe on function-graph tracer Message-ID: <20241101152844.3a589594@gandalf.local.home> In-Reply-To: <172991746318.443985.12713087979890519872.stgit@devnote2> References: <172991731968.443985.4558065903004844780.stgit@devnote2> <172991746318.443985.12713087979890519872.stgit@devnote2> X-Mailer: Claws Mail 3.20.0git84 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Sat, 26 Oct 2024 13:37:43 +0900 "Masami Hiramatsu (Google)" wrote: > diff --git a/include/linux/fprobe.h b/include/linux/fprobe.h > index ef609bcca0f9..686b30ce48b4 100644 > --- a/include/linux/fprobe.h > +++ b/include/linux/fprobe.h > @@ -5,10 +5,11 @@ > > #include > #include > -#include > +#include > +#include > +#include > > struct fprobe; > - > typedef int (*fprobe_entry_cb)(struct fprobe *fp, unsigned long entry_ip, > unsigned long ret_ip, struct ftrace_regs *regs, > void *entry_data); > @@ -17,35 +18,57 @@ typedef void (*fprobe_exit_cb)(struct fprobe *fp, unsigned long entry_ip, > unsigned long ret_ip, struct ftrace_regs *regs, > void *entry_data); > > +/** > + * strcut fprobe_hlist_node - address based hash list node for fprobe. struct > + * > + * @hlist: The hlist node for address search hash table. > + * @addr: The address represented by this. What is "this" in the above? > + * @fp: The fprobe which owns this. > + */ > +struct fprobe_hlist_node { > + struct hlist_node hlist; > + unsigned long addr; > + struct fprobe *fp; > +}; > + > +/** > + * struct fprobe_hlist - hash list nodes for fprobe. > + * > + * @hlist: The hlist node for existence checking hash table. > + * @rcu: rcu_head for RCU deferred release. > + * @fp: The fprobe which owns this fprobe_hlist. > + * @size: The size of @array. > + * @array: The fprobe_hlist_node for each address to probe. > + */ > +struct fprobe_hlist { > + struct hlist_node hlist; > + struct rcu_head rcu; > + struct fprobe *fp; > + int size; > + struct fprobe_hlist_node array[]; Should the above have __counted_by(size) ? -- Steve > +}; > + > /** > * struct fprobe - ftrace based probe. > - * @ops: The ftrace_ops. > + * > * @nmissed: The counter for missing events. > * @flags: The status flag. > - * @rethook: The rethook data structure. (internal data) > * @entry_data_size: The private data storage size. > - * @nr_maxactive: The max number of active functions. > + * @nr_maxactive: The max number of active functions. (*deprecated) > * @entry_handler: The callback function for function entry. > * @exit_handler: The callback function for function exit. > + * @hlist_array: The fprobe_hlist for fprobe search from IP hash table. > */ > struct fprobe { > -#ifdef CONFIG_FUNCTION_TRACER > - /* > - * If CONFIG_FUNCTION_TRACER is not set, CONFIG_FPROBE is disabled too. > - * But user of fprobe may keep embedding the struct fprobe on their own > - * code. To avoid build error, this will keep the fprobe data structure > - * defined here, but remove ftrace_ops data structure. > - */ > - struct ftrace_ops ops; > -#endif > unsigned long nmissed; > unsigned int flags; > - struct rethook *rethook; > size_t entry_data_size; > int nr_maxactive; > > fprobe_entry_cb entry_handler; > fprobe_exit_cb exit_handler; > + > + struct fprobe_hlist *hlist_array; > }; >