linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf tools: set GUI mode after returning from perf_session__new()
@ 2017-12-03 13:50 Song Seok Ho
  2017-12-04 15:05 ` Namhyung Kim
  0 siblings, 1 reply; 5+ messages in thread
From: Song Seok Ho @ 2017-12-03 13:50 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: linux-kernel, Jiri Olsa, Namhyung Kim, Song Seok Ho

If perf_session__new() returns NULL with use_browser set to 2 via --gtk option
previously, perf dies quietly without printing any errors.

The reason behind this is that GTK is not yet initialized when the caller
inside perf_session__new() is trying to print error message to the screen.

Reorder code to print the messages to stdio when GTK is not yet ready.

Signed-off-by: Song Seok Ho <0xdevssh@gmail.com>
---
 tools/perf/builtin-report.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 1394cd8d96f7..0cd80b8c432e 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -918,13 +918,6 @@ int cmd_report(int argc, const char **argv)
 		return -EINVAL;
 	}
 
-	if (report.use_stdio)
-		use_browser = 0;
-	else if (report.use_tui)
-		use_browser = 1;
-	else if (report.use_gtk)
-		use_browser = 2;
-
 	if (report.inverted_callchain)
 		callchain_param.order = ORDER_CALLER;
 	if (symbol_conf.cumulate_callchain && !callchain_param.order_set)
@@ -949,6 +942,13 @@ int cmd_report(int argc, const char **argv)
 	if (session == NULL)
 		return -1;
 
+	if (report.use_stdio)
+		use_browser = 0;
+	else if (report.use_tui)
+		use_browser = 1;
+	else if (report.use_gtk)
+		use_browser = 2;
+
 	if (report.queue_size) {
 		ordered_events__set_alloc_size(&session->ordered_events,
 					       report.queue_size);
-- 
2.15.1

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

* Re: [PATCH] perf tools: set GUI mode after returning from perf_session__new()
  2017-12-03 13:50 [PATCH] perf tools: set GUI mode after returning from perf_session__new() Song Seok Ho
@ 2017-12-04 15:05 ` Namhyung Kim
  2017-12-04 15:45   ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: Namhyung Kim @ 2017-12-04 15:05 UTC (permalink / raw)
  To: Song Seok Ho; +Cc: Arnaldo Carvalho de Melo, linux-kernel, Jiri Olsa

Hi SeokHo,

On Sun, Dec 3, 2017 at 10:50 PM, Song Seok Ho <0xdevssh@gmail.com> wrote:
> If perf_session__new() returns NULL with use_browser set to 2 via --gtk option
> previously, perf dies quietly without printing any errors.
>
> The reason behind this is that GTK is not yet initialized when the caller
> inside perf_session__new() is trying to print error message to the screen.
>
> Reorder code to print the messages to stdio when GTK is not yet ready.

I'm ok with this change, but it needs to consider other error messages too.
There are more pr_err() calls between perf_session__new() and
setup_browser(), so I think they have same problem.

Thanks,
Namhyung


>
> Signed-off-by: Song Seok Ho <0xdevssh@gmail.com>
> ---
>  tools/perf/builtin-report.c | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> index 1394cd8d96f7..0cd80b8c432e 100644
> --- a/tools/perf/builtin-report.c
> +++ b/tools/perf/builtin-report.c
> @@ -918,13 +918,6 @@ int cmd_report(int argc, const char **argv)
>                 return -EINVAL;
>         }
>
> -       if (report.use_stdio)
> -               use_browser = 0;
> -       else if (report.use_tui)
> -               use_browser = 1;
> -       else if (report.use_gtk)
> -               use_browser = 2;
> -
>         if (report.inverted_callchain)
>                 callchain_param.order = ORDER_CALLER;
>         if (symbol_conf.cumulate_callchain && !callchain_param.order_set)
> @@ -949,6 +942,13 @@ int cmd_report(int argc, const char **argv)
>         if (session == NULL)
>                 return -1;
>
> +       if (report.use_stdio)
> +               use_browser = 0;
> +       else if (report.use_tui)
> +               use_browser = 1;
> +       else if (report.use_gtk)
> +               use_browser = 2;
> +
>         if (report.queue_size) {
>                 ordered_events__set_alloc_size(&session->ordered_events,
>                                                report.queue_size);
> --
> 2.15.1
>

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

* Re: [PATCH] perf tools: set GUI mode after returning from perf_session__new()
  2017-12-04 15:05 ` Namhyung Kim
@ 2017-12-04 15:45   ` Arnaldo Carvalho de Melo
  2017-12-04 16:11     ` SeokHo Song
  0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-04 15:45 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: Song Seok Ho, linux-kernel, Jiri Olsa

Em Tue, Dec 05, 2017 at 12:05:18AM +0900, Namhyung Kim escreveu:
> Hi SeokHo,
> 
> On Sun, Dec 3, 2017 at 10:50 PM, Song Seok Ho <0xdevssh@gmail.com> wrote:
> > If perf_session__new() returns NULL with use_browser set to 2 via --gtk option
> > previously, perf dies quietly without printing any errors.
> >
> > The reason behind this is that GTK is not yet initialized when the caller
> > inside perf_session__new() is trying to print error message to the screen.
> >
> > Reorder code to print the messages to stdio when GTK is not yet ready.
> 
> I'm ok with this change, but it needs to consider other error messages too.
> There are more pr_err() calls between perf_session__new() and
> setup_browser(), so I think they have same problem.

So I think I can apply this one, with Namhyung's acked-by and then Song
can continue with followup patches?

- Arnaldo
 
> Thanks,
> Namhyung
> 
> 
> >
> > Signed-off-by: Song Seok Ho <0xdevssh@gmail.com>
> > ---
> >  tools/perf/builtin-report.c | 14 +++++++-------
> >  1 file changed, 7 insertions(+), 7 deletions(-)
> >
> > diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
> > index 1394cd8d96f7..0cd80b8c432e 100644
> > --- a/tools/perf/builtin-report.c
> > +++ b/tools/perf/builtin-report.c
> > @@ -918,13 +918,6 @@ int cmd_report(int argc, const char **argv)
> >                 return -EINVAL;
> >         }
> >
> > -       if (report.use_stdio)
> > -               use_browser = 0;
> > -       else if (report.use_tui)
> > -               use_browser = 1;
> > -       else if (report.use_gtk)
> > -               use_browser = 2;
> > -
> >         if (report.inverted_callchain)
> >                 callchain_param.order = ORDER_CALLER;
> >         if (symbol_conf.cumulate_callchain && !callchain_param.order_set)
> > @@ -949,6 +942,13 @@ int cmd_report(int argc, const char **argv)
> >         if (session == NULL)
> >                 return -1;
> >
> > +       if (report.use_stdio)
> > +               use_browser = 0;
> > +       else if (report.use_tui)
> > +               use_browser = 1;
> > +       else if (report.use_gtk)
> > +               use_browser = 2;
> > +
> >         if (report.queue_size) {
> >                 ordered_events__set_alloc_size(&session->ordered_events,
> >                                                report.queue_size);
> > --
> > 2.15.1
> >

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

* Re: [PATCH] perf tools: set GUI mode after returning from perf_session__new()
  2017-12-04 15:45   ` Arnaldo Carvalho de Melo
@ 2017-12-04 16:11     ` SeokHo Song
  2017-12-04 16:28       ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: SeokHo Song @ 2017-12-04 16:11 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Namhyung Kim, linux-kernel, Jiri Olsa

Hi Arnaldo,

2017-12-05 0:45 GMT+09:00 Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>:
> Em Tue, Dec 05, 2017 at 12:05:18AM +0900, Namhyung Kim escreveu:
>> Hi SeokHo,
>>
>> On Sun, Dec 3, 2017 at 10:50 PM, Song Seok Ho <0xdevssh@gmail.com> wrote:
>> > If perf_session__new() returns NULL with use_browser set to 2 via --gtk option
>> > previously, perf dies quietly without printing any errors.
>> >
>> > The reason behind this is that GTK is not yet initialized when the caller
>> > inside perf_session__new() is trying to print error message to the screen.
>> >
>> > Reorder code to print the messages to stdio when GTK is not yet ready.
>>
>> I'm ok with this change, but it needs to consider other error messages too.
>> There are more pr_err() calls between perf_session__new() and
>> setup_browser(), so I think they have same problem.
>
> So I think I can apply this one, with Namhyung's acked-by and then Song
> can continue with followup patches?
>
> - Arnaldo
>

I've sent a follow-up patch with a new title "[PATCH v2] perf tools:
set browser mode
right before setup_browser()" with Namhyung's Acked-by added.

Addressing Namhyung's comment, I've moved the use_browser variable assignment
code below when setup_browser() is called.

Please let me know if it deserves to be in a different place.

Thanks.

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

* Re: [PATCH] perf tools: set GUI mode after returning from perf_session__new()
  2017-12-04 16:11     ` SeokHo Song
@ 2017-12-04 16:28       ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-12-04 16:28 UTC (permalink / raw)
  To: SeokHo Song
  Cc: Arnaldo Carvalho de Melo, Namhyung Kim, linux-kernel, Jiri Olsa

Em Tue, Dec 05, 2017 at 01:11:49AM +0900, SeokHo Song escreveu:
> Hi Arnaldo,
> 
> 2017-12-05 0:45 GMT+09:00 Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>:
> > Em Tue, Dec 05, 2017 at 12:05:18AM +0900, Namhyung Kim escreveu:
> >> Hi SeokHo,
> >>
> >> On Sun, Dec 3, 2017 at 10:50 PM, Song Seok Ho <0xdevssh@gmail.com> wrote:
> >> > If perf_session__new() returns NULL with use_browser set to 2 via --gtk option
> >> > previously, perf dies quietly without printing any errors.
> >> >
> >> > The reason behind this is that GTK is not yet initialized when the caller
> >> > inside perf_session__new() is trying to print error message to the screen.
> >> >
> >> > Reorder code to print the messages to stdio when GTK is not yet ready.
> >>
> >> I'm ok with this change, but it needs to consider other error messages too.
> >> There are more pr_err() calls between perf_session__new() and
> >> setup_browser(), so I think they have same problem.
> >
> > So I think I can apply this one, with Namhyung's acked-by and then Song
> > can continue with followup patches?
> >
> > - Arnaldo
> >
> 
> I've sent a follow-up patch with a new title "[PATCH v2] perf tools:
> set browser mode
> right before setup_browser()" with Namhyung's Acked-by added.
> 
> Addressing Namhyung's comment, I've moved the use_browser variable assignment
> code below when setup_browser() is called.
> 
> Please let me know if it deserves to be in a different place.

Ok, I've replaced the copy I had with this v2 one.

- Arnaldo

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

end of thread, other threads:[~2017-12-04 16:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-03 13:50 [PATCH] perf tools: set GUI mode after returning from perf_session__new() Song Seok Ho
2017-12-04 15:05 ` Namhyung Kim
2017-12-04 15:45   ` Arnaldo Carvalho de Melo
2017-12-04 16:11     ` SeokHo Song
2017-12-04 16:28       ` Arnaldo Carvalho de Melo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).