Message ID | 20240605180409.021080462@goodmis.org (mailing list archive) |
---|---|
State | Accepted |
Commit | 1a88c071679496907ba3e62ec1190d198c20ace8 |
Headers | show |
Series | ftrace: Clean up and comment code | expand |
On Wed, Jun 05, 2024 at 02:03:38PM -0400, Steven Rostedt wrote: > From: "Steven Rostedt (Google)" <rostedt@goodmis.org> > > The parameter "inc" in the function ftrace_hash_rec_update_modify() is > boolean. Change it to be such. > > Also add documentation to what the function does. > > Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org> Acked-by: Mark Rutland <mark.rutland@arm.com> Mark. > --- > kernel/trace/ftrace.c | 23 ++++++++++++++++++++--- > 1 file changed, 20 insertions(+), 3 deletions(-) > > diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c > index 1a2444199740..83f23f8fc26d 100644 > --- a/kernel/trace/ftrace.c > +++ b/kernel/trace/ftrace.c > @@ -1882,7 +1882,24 @@ static bool ftrace_hash_rec_enable(struct ftrace_ops *ops) > return __ftrace_hash_rec_update(ops, true); > } > > -static void ftrace_hash_rec_update_modify(struct ftrace_ops *ops, int inc) > +/* > + * This function will update what functions @ops traces when its filter > + * changes. > + * > + * The @inc states if the @ops callbacks are going to be added or removed. > + * When one of the @ops hashes are updated to a "new_hash" the dyn_ftrace > + * records are update via: > + * > + * ftrace_hash_rec_disable_modify(ops); > + * ops->hash = new_hash > + * ftrace_hash_rec_enable_modify(ops); > + * > + * Where the @ops is removed from all the records it is tracing using > + * its old hash. The @ops hash is updated to the new hash, and then > + * the @ops is added back to the records so that it is tracing all > + * the new functions. > + */ > +static void ftrace_hash_rec_update_modify(struct ftrace_ops *ops, bool inc) > { > struct ftrace_ops *op; > > @@ -1906,12 +1923,12 @@ static void ftrace_hash_rec_update_modify(struct ftrace_ops *ops, int inc) > > static void ftrace_hash_rec_disable_modify(struct ftrace_ops *ops) > { > - ftrace_hash_rec_update_modify(ops, 0); > + ftrace_hash_rec_update_modify(ops, false); > } > > static void ftrace_hash_rec_enable_modify(struct ftrace_ops *ops) > { > - ftrace_hash_rec_update_modify(ops, 1); > + ftrace_hash_rec_update_modify(ops, true); > } > > /* > -- > 2.43.0 > >
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 1a2444199740..83f23f8fc26d 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -1882,7 +1882,24 @@ static bool ftrace_hash_rec_enable(struct ftrace_ops *ops) return __ftrace_hash_rec_update(ops, true); } -static void ftrace_hash_rec_update_modify(struct ftrace_ops *ops, int inc) +/* + * This function will update what functions @ops traces when its filter + * changes. + * + * The @inc states if the @ops callbacks are going to be added or removed. + * When one of the @ops hashes are updated to a "new_hash" the dyn_ftrace + * records are update via: + * + * ftrace_hash_rec_disable_modify(ops); + * ops->hash = new_hash + * ftrace_hash_rec_enable_modify(ops); + * + * Where the @ops is removed from all the records it is tracing using + * its old hash. The @ops hash is updated to the new hash, and then + * the @ops is added back to the records so that it is tracing all + * the new functions. + */ +static void ftrace_hash_rec_update_modify(struct ftrace_ops *ops, bool inc) { struct ftrace_ops *op; @@ -1906,12 +1923,12 @@ static void ftrace_hash_rec_update_modify(struct ftrace_ops *ops, int inc) static void ftrace_hash_rec_disable_modify(struct ftrace_ops *ops) { - ftrace_hash_rec_update_modify(ops, 0); + ftrace_hash_rec_update_modify(ops, false); } static void ftrace_hash_rec_enable_modify(struct ftrace_ops *ops) { - ftrace_hash_rec_update_modify(ops, 1); + ftrace_hash_rec_update_modify(ops, true); } /*