[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240611151159.fefefc259661e7a41afb39ed@kernel.org>
Date: Tue, 11 Jun 2024 15:11:59 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: LKML <linux-kernel@...r.kernel.org>, Linux Trace Kernel
<linux-trace-kernel@...r.kernel.org>, Tom Zanussi <zanussi@...nel.org>
Subject: Re: [PATCH 2/3] tracing/kprobe: Remove unneeded WARN_ON_ONCE() in
selftests
On Mon, 10 Jun 2024 20:18:13 -0400
Steven Rostedt <rostedt@...dmis.org> wrote:
> On Tue, 11 Jun 2024 06:26:44 +0900
> "Masami Hiramatsu (Google)" <mhiramat@...nel.org> wrote:
>
> > From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
> >
> > Since the kprobe-events selftest shows OK or NG with the reason, the
> > WARN_ON_ONCE()s for each place are redundant. Let's remove it.
> >
> > Signed-off-by: Masami Hiramatsu (Google) <mhiramat@...nel.org>
> > ---
> > kernel/trace/trace_kprobe.c | 26 +++++++++++++-------------
> > 1 file changed, 13 insertions(+), 13 deletions(-)
> >
> > diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
> > index 16383247bdbf..4abed36544d0 100644
> > --- a/kernel/trace/trace_kprobe.c
> > +++ b/kernel/trace/trace_kprobe.c
> > @@ -2023,18 +2023,18 @@ static __init int kprobe_trace_self_tests_init(void)
> > pr_info("Testing kprobe tracing: ");
> >
> > ret = create_or_delete_trace_kprobe("p:testprobe kprobe_trace_selftest_target $stack $stack0 +0($stack)");
> > - if (WARN_ON_ONCE(ret)) {
> > + if (ret) {
> > pr_warn("error on probing function entry.\n");
>
> Actually, you can consolidate this to:
>
> if (WARN_ONCE(ret, "error on probing function entry."))
Ahh, OK, let me update it.
>
> > warn++;
> > } else {
> > /* Enable trace point */
> > tk = find_trace_kprobe("testprobe", KPROBE_EVENT_SYSTEM);
> > - if (WARN_ON_ONCE(tk == NULL)) {
> > + if (tk == NULL) {
> > pr_warn("error on getting new probe.\n");
>
> And this to:
>
> if (WARN_ONCE(tk == NULL, "error on getting new probe."))
Thank you!
>
> end so on.
>
> -- Steve
>
> > warn++;
> > } else {
> > file = find_trace_probe_file(tk, top_trace_array());
> > - if (WARN_ON_ONCE(file == NULL)) {
> > + if (file == NULL) {
> > pr_warn("error on getting probe file.\n");
> > warn++;
> > } else
> > @@ -2044,18 +2044,18 @@ static __init int kprobe_trace_self_tests_init(void)
> > }
> >
> > ret = create_or_delete_trace_kprobe("r:testprobe2 kprobe_trace_selftest_target $retval");
> > - if (WARN_ON_ONCE(ret)) {
> > + if (ret) {
> > pr_warn("error on probing function return.\n");
> > warn++;
> > } else {
> > /* Enable trace point */
> > tk = find_trace_kprobe("testprobe2", KPROBE_EVENT_SYSTEM);
> > - if (WARN_ON_ONCE(tk == NULL)) {
> > + if (tk == NULL) {
> > pr_warn("error on getting 2nd new probe.\n");
> > warn++;
> > } else {
> > file = find_trace_probe_file(tk, top_trace_array());
> > - if (WARN_ON_ONCE(file == NULL)) {
> > + if (file == NULL) {
> > pr_warn("error on getting probe file.\n");
> > warn++;
> > } else
> > @@ -2079,7 +2079,7 @@ static __init int kprobe_trace_self_tests_init(void)
> >
> > /* Disable trace points before removing it */
> > tk = find_trace_kprobe("testprobe", KPROBE_EVENT_SYSTEM);
> > - if (WARN_ON_ONCE(tk == NULL)) {
> > + if (tk == NULL) {
> > pr_warn("error on getting test probe.\n");
> > warn++;
> > } else {
> > @@ -2089,7 +2089,7 @@ static __init int kprobe_trace_self_tests_init(void)
> > }
> >
> > file = find_trace_probe_file(tk, top_trace_array());
> > - if (WARN_ON_ONCE(file == NULL)) {
> > + if (file == NULL) {
> > pr_warn("error on getting probe file.\n");
> > warn++;
> > } else
> > @@ -2098,7 +2098,7 @@ static __init int kprobe_trace_self_tests_init(void)
> > }
> >
> > tk = find_trace_kprobe("testprobe2", KPROBE_EVENT_SYSTEM);
> > - if (WARN_ON_ONCE(tk == NULL)) {
> > + if (tk == NULL) {
> > pr_warn("error on getting 2nd test probe.\n");
> > warn++;
> > } else {
> > @@ -2108,7 +2108,7 @@ static __init int kprobe_trace_self_tests_init(void)
> > }
> >
> > file = find_trace_probe_file(tk, top_trace_array());
> > - if (WARN_ON_ONCE(file == NULL)) {
> > + if (file == NULL) {
> > pr_warn("error on getting probe file.\n");
> > warn++;
> > } else
> > @@ -2117,20 +2117,20 @@ static __init int kprobe_trace_self_tests_init(void)
> > }
> >
> > ret = create_or_delete_trace_kprobe("-:testprobe");
> > - if (WARN_ON_ONCE(ret)) {
> > + if (ret) {
> > pr_warn("error on deleting a probe.\n");
> > warn++;
> > }
> >
> > ret = create_or_delete_trace_kprobe("-:testprobe2");
> > - if (WARN_ON_ONCE(ret)) {
> > + if (ret) {
> > pr_warn("error on deleting a probe.\n");
> > warn++;
> > }
> >
> > end:
> > ret = dyn_events_release_all(&trace_kprobe_ops);
> > - if (WARN_ON_ONCE(ret)) {
> > + if (ret) {
> > pr_warn("error on cleaning up probes.\n");
> > warn++;
> > }
>
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists