All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf: Move debug initialization earlier
@ 2021-05-19 16:44 Ian Rogers
  2021-05-27 15:51 ` Ian Rogers
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Rogers @ 2021-05-19 16:44 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-perf-users, linux-kernel
  Cc: eranian, Ian Rogers

This avoids segfaults during option handlers that use pr_err. For
example, "perf --debug nopager list" segfaults before this change.

Fixes: 8abceacff87d (perf debug: Add debug_set_file function)
Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/perf/perf.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 20cb91ef06ff..2f6b67189b42 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -443,6 +443,8 @@ int main(int argc, const char **argv)
 	const char *cmd;
 	char sbuf[STRERR_BUFSIZE];
 
+	perf_debug_setup();
+
 	/* libsubcmd init */
 	exec_cmd_init("perf", PREFIX, PERF_EXEC_PATH, EXEC_PATH_ENVIRONMENT);
 	pager_init(PERF_PAGER_ENVIRONMENT);
@@ -531,8 +533,6 @@ int main(int argc, const char **argv)
 	 */
 	pthread__block_sigwinch();
 
-	perf_debug_setup();
-
 	while (1) {
 		static int done_help;
 
-- 
2.31.1.751.gd2f1c929bd-goog


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf: Move debug initialization earlier
  2021-05-19 16:44 [PATCH] perf: Move debug initialization earlier Ian Rogers
@ 2021-05-27 15:51 ` Ian Rogers
  2021-05-27 16:25   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 3+ messages in thread
From: Ian Rogers @ 2021-05-27 15:51 UTC (permalink / raw)
  To: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Namhyung Kim,
	linux-perf-users, LKML, Riccardo Mancini
  Cc: Stephane Eranian

On Wed, May 19, 2021 at 9:44 AM Ian Rogers <irogers@google.com> wrote:
>
> This avoids segfaults during option handlers that use pr_err. For
> example, "perf --debug nopager list" segfaults before this change.
>
> Fixes: 8abceacff87d (perf debug: Add debug_set_file function)
> Signed-off-by: Ian Rogers <irogers@google.com>

Ping.

Thanks!
Ian

> ---
>  tools/perf/perf.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/perf.c b/tools/perf/perf.c
> index 20cb91ef06ff..2f6b67189b42 100644
> --- a/tools/perf/perf.c
> +++ b/tools/perf/perf.c
> @@ -443,6 +443,8 @@ int main(int argc, const char **argv)
>         const char *cmd;
>         char sbuf[STRERR_BUFSIZE];
>
> +       perf_debug_setup();
> +
>         /* libsubcmd init */
>         exec_cmd_init("perf", PREFIX, PERF_EXEC_PATH, EXEC_PATH_ENVIRONMENT);
>         pager_init(PERF_PAGER_ENVIRONMENT);
> @@ -531,8 +533,6 @@ int main(int argc, const char **argv)
>          */
>         pthread__block_sigwinch();
>
> -       perf_debug_setup();
> -
>         while (1) {
>                 static int done_help;
>
> --
> 2.31.1.751.gd2f1c929bd-goog
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] perf: Move debug initialization earlier
  2021-05-27 15:51 ` Ian Rogers
@ 2021-05-27 16:25   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 3+ messages in thread
From: Arnaldo Carvalho de Melo @ 2021-05-27 16:25 UTC (permalink / raw)
  To: Ian Rogers
  Cc: Peter Zijlstra, Ingo Molnar, Mark Rutland, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, linux-perf-users, LKML,
	Riccardo Mancini, Stephane Eranian

Em Thu, May 27, 2021 at 08:51:41AM -0700, Ian Rogers escreveu:
> On Wed, May 19, 2021 at 9:44 AM Ian Rogers <irogers@google.com> wrote:
> >
> > This avoids segfaults during option handlers that use pr_err. For
> > example, "perf --debug nopager list" segfaults before this change.
> >
> > Fixes: 8abceacff87d (perf debug: Add debug_set_file function)
> > Signed-off-by: Ian Rogers <irogers@google.com>
> 
> Ping.

I thought I had this one in, its now, will go to Linus probably tomorrow,

- Arnaldo
 
> Thanks!
> Ian
> 
> > ---
> >  tools/perf/perf.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/tools/perf/perf.c b/tools/perf/perf.c
> > index 20cb91ef06ff..2f6b67189b42 100644
> > --- a/tools/perf/perf.c
> > +++ b/tools/perf/perf.c
> > @@ -443,6 +443,8 @@ int main(int argc, const char **argv)
> >         const char *cmd;
> >         char sbuf[STRERR_BUFSIZE];
> >
> > +       perf_debug_setup();
> > +
> >         /* libsubcmd init */
> >         exec_cmd_init("perf", PREFIX, PERF_EXEC_PATH, EXEC_PATH_ENVIRONMENT);
> >         pager_init(PERF_PAGER_ENVIRONMENT);
> > @@ -531,8 +533,6 @@ int main(int argc, const char **argv)
> >          */
> >         pthread__block_sigwinch();
> >
> > -       perf_debug_setup();
> > -
> >         while (1) {
> >                 static int done_help;
> >
> > --
> > 2.31.1.751.gd2f1c929bd-goog
> >

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-27 16:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-19 16:44 [PATCH] perf: Move debug initialization earlier Ian Rogers
2021-05-27 15:51 ` Ian Rogers
2021-05-27 16:25   ` Arnaldo Carvalho de Melo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.