Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938718AbcJ2NvB (ORCPT ); Sat, 29 Oct 2016 09:51:01 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:49226 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756859AbcJ2Nus (ORCPT ); Sat, 29 Oct 2016 09:50:48 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Milian Wolff , Namhyung Kim , Andi Kleen , Jiri Olsa , Peter Zijlstra , Arnaldo Carvalho de Melo Subject: [PATCH 4.4 46/51] perf hists browser: Fix event group display Date: Sat, 29 Oct 2016 09:49:47 -0400 Message-Id: <20161029134924.500917519@linuxfoundation.org> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20161029134922.501052551@linuxfoundation.org> References: <20161029134922.501052551@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1846 Lines: 49 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Namhyung Kim commit d9ea48bc4e7cc297ca1073fa3f90ed80d964b7b4 upstream. Milian reported that the event group on TUI shows duplicated overhead. This was due to a bug on calculating hpp->buf position. The hpp_advance() was called from __hpp__slsmg_color_printf() on TUI but it's already called from the hpp__call_print_fn macro in __hpp__fmt(). The end result is that the print function returns number of bytes it printed but the buffer advanced twice of the length. This is generally not a problem since it doesn't need to access the buffer again. But with event group, overhead needs to be printed multiple times and hist_entry__snprintf_alignment() tries to fill the space with buffer after it printed. So it (brokenly) showed the last overhead again. The bug was there from the beginning, but I think it's only revealed when the alignment function was added. Reported-by: Milian Wolff Signed-off-by: Namhyung Kim Cc: Andi Kleen Cc: Jiri Olsa Cc: Peter Zijlstra Fixes: 89fee7094323 ("perf hists: Do column alignment on the format iterator") Link: http://lkml.kernel.org/r/20160912061958.16656-2-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Greg Kroah-Hartman --- tools/perf/ui/browsers/hists.c | 1 - 1 file changed, 1 deletion(-) --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c @@ -684,7 +684,6 @@ static int __hpp__slsmg_color_printf(str ret = scnprintf(hpp->buf, hpp->size, fmt, len, percent); ui_browser__printf(arg->b, "%s", hpp->buf); - advance_hpp(hpp, ret); return ret; }