Patch "perf top: Fix window dimensions change handling" has been added to the 4.14-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
perf top: Fix window dimensions change handling
to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
perf-top-fix-window-dimensions-change-handling.patch
and it can be found in the queue-4.14 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From foo@baz Fri Feb 23 11:45:09 CET 2018
From: Jiri Olsa <[email protected]>
Date: Tue, 14 Nov 2017 10:23:39 +0100
Subject: perf top: Fix window dimensions change handling
From: Jiri Olsa <[email protected]>
[ Upstream commit 89d0aeab4252adc2a7ea693637dd21c588bfa2d1 ]
The stdio perf top crashes when we change the terminal window size. The reason is that we assumed we get the perf_top pointer as a signal handler argument which is not the case.
Changing the SIGWINCH handler logic to change global resize variable, which is checked in the main thread loop.
--- tools/perf/builtin-top.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
tools/perf/builtin-top.c +12 -3
@@ -77,6 +77,7 @@#include "sane_ctype.h" static volatile int done; +static volatile int resize;#define HEADER_LINE_NR 5
@@ -86,10 +87,13 @@ static void perf_top__update_print_entri }static void perf_top__sig_winch (int sig__maybe_unused , -siginfo_t *info__maybe_unused ,void *arg) +siginfo_t *info__maybe_unused ,void *arg__maybe_unused ) { -struct perf_top *top = arg; + resize =1 ; +} +static void perf_top__resize (struct perf_top *top) +{get_term_dimensions (&top->winsize);perf_top__update_print_entries (top); }
@@ -477,7 +481,7 @@ static bool perf_top__handle_keypress(st .sa_sigaction = perf_top__sig_winch, .sa_flags = SA_SIGINFO, }; -perf_top__sig_winch (SIGWINCH ,NULL , top); +perf_top__resize (top);sigaction (SIGWINCH , &act,NULL ); }else {signal (SIGWINCH ,SIG_DFL );
@@ -1022,6 +1026,11 @@ static int __cmd_top(struct perf_top *toif (hits == top->samples) ret =perf_evlist__poll (top->evlist,100 ); + +if (resize) { +perf_top__resize (top); + resize =0 ; + } } ret =0 ;
Patches currently in stable-queue which might be from [email protected] are
queue-4.14/perf-top-fix-window-dimensions-change-handling.patch queue-4.14/perf-fix-header.size-for-namespace-events.patch queue-4.14/perf-help-fix-a-bug-during-strstart-conversion.patch queue-4.14/perf-record-fix-c-f-options-for-cpu-event-aliases.patch