All of lore.kernel.org
 help / color / mirror / Atom feed
* UI messages in event thread hangs perf top
@ 2018-10-28  3:58 David Miller
  2018-10-29 12:25 ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 2+ messages in thread
From: David Miller @ 2018-10-28  3:58 UTC (permalink / raw)
  To: acme; +Cc: linux-kernel, kan.liang


If I run perf top with a "make -j128" kernel build, I get ring buffer event
processing timeouts which results in:

		ui__warning("Too slow to read ring buffer.\n"
			    "Please try increasing the period (-c) or\n"
			    "decreasing the freq (-F) or\n"
			    "limiting the number of CPUs (-C)\n");

from perf_top__mmap_read().

This hangs the main event thread.  Only the display thread runs after
this point.

We can't issue UI messages from the event thread, because those will
hang waiting for a keypress.  The display thread will eat any keys
we press and the event thread thus hangs forever.

I can tell this is what has happened because the histogram entries
continue to decay, yet the event count stops increasing.

If I put a gdb on the perf process, indeed the backtrace in the event
processing thread is in the select() call done by ui__getch().

Adding insult to injury, the display thread immediately overwrites the
warning message printed by the event thread, and thus the user has no
chance to even see it.

I really wonder how this was tested.

Perhaps we should mark the event thread in a special way and trigger
assertions if UI messages are printed from it.  Again, any such
operation will hang the thread and stop all event processing.

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

* Re: UI messages in event thread hangs perf top
  2018-10-28  3:58 UI messages in event thread hangs perf top David Miller
@ 2018-10-29 12:25 ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 2+ messages in thread
From: Arnaldo Carvalho de Melo @ 2018-10-29 12:25 UTC (permalink / raw)
  To: David Miller; +Cc: linux-kernel, kan.liang

Em Sat, Oct 27, 2018 at 08:58:30PM -0700, David Miller escreveu:
> 
> If I run perf top with a "make -j128" kernel build, I get ring buffer event
> processing timeouts which results in:
> 
> 		ui__warning("Too slow to read ring buffer.\n"
> 			    "Please try increasing the period (-c) or\n"
> 			    "decreasing the freq (-F) or\n"
> 			    "limiting the number of CPUs (-C)\n");
> 
> from perf_top__mmap_read().
> 
> This hangs the main event thread.  Only the display thread runs after
> this point.
> 
> We can't issue UI messages from the event thread, because those will
> hang waiting for a keypress.  The display thread will eat any keys
> we press and the event thread thus hangs forever.
> 
> I can tell this is what has happened because the histogram entries
> continue to decay, yet the event count stops increasing.
> 
> If I put a gdb on the perf process, indeed the backtrace in the event
> processing thread is in the select() call done by ui__getch().
> 
> Adding insult to injury, the display thread immediately overwrites the
> warning message printed by the event thread, and thus the user has no
> chance to even see it.
> 
> I really wonder how this was tested.
> 
> Perhaps we should mark the event thread in a special way and trigger
> assertions if UI messages are printed from it.  Again, any such
> operation will hang the thread and stop all event processing.

Right, I thought about marking a flag in the main event thread that then
gets picked up by the display thread, I'll try and write a patch for
that, if none has been submitted, I'm still downloading this weekend's
messages.

- Arnaldo

P.S. I was busy working as a volunteer in the brazilian elections :-\

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

end of thread, other threads:[~2018-10-29 12:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-28  3:58 UI messages in event thread hangs perf top David Miller
2018-10-29 12: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.