lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150311002617.GG943@sejong>
Date:	Wed, 11 Mar 2015 09:26:17 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	He Kuang <hekuang@...wei.com>
Cc:	a.p.zijlstra@...llo.nl, paulus@...ba.org, mingo@...hat.com,
	acme@...nel.org, jolsa@...nel.org, wangnan0@...wei.com,
	yunlong.song@...wei.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf hists browser: Fix UI bug after fold/unfold

Hi,

On Tue, Mar 10, 2015 at 03:26:41PM +0800, He Kuang wrote:
> hi,
> On 2015/3/10 14:28, Namhyung Kim wrote:
> >On Fri, Mar 06, 2015 at 08:51:44PM +0800, He Kuang wrote:
> >>In perf hists browser, the fold/unfold stat of each hist entry is
> >>recorded but hb->nr_callchain_rows loses its value after zoom out and
> >>zoom in back. This causes a wrong row cursor range that restrict user to
> >>move down anymore.
> >>
> >>Before:
> >>   $ perf record -g -e syscalls:* ls
> >>   $ perf report
> >>
> >>(select an event and unfold, then zoom out and back, row cursor blocked)
> >>
> >>     Children      Self  Command  Shared Object          Symbol
> >>   ================================================================
> >>   -  100.00%   100.00%  ls       libuClibc-0.9.33.2.so  [.] lstat64
> >>   - lstat64
> >>        16.67% 0x6469702e64
> >>        16.67% 0x692d6f732e6f7364
> >>        8.33% 0x442d00746f6f725f
> >>        8.33% 0x746f006469
> >>        8.33% 0x646c6f2e617461
> >>        8.33% 0x646970
> >>        8.33% 0x617461 <= [cursor may stop here, can't move down anymore]
> >>        8.33% 0x7365
> >>        8.33% 0x6469
> >>        8.33% 0x65
> >>   -   16.67%     0.00%  ls       [unknown]              [.]0x6469702e64
> >>      0x6469702e64
> >>
> >>When zoom into DSO or thread, nr_rows is not cleared which causes a
> >>similar problem.
> >>
> >>This patch recalculates hb->nr_callchain_rows and clears nr_rows to fix
> >>the bug.
> >The intention was that it should reset the folding state when a filter
> >is applied.  So I guess just resetting he->nr_rows to 0 in hists__
> >remove_entry_filter() would solve the problem.
> >
> >Thanks,
> >Namhyung
> 
> Actually, this patch fixes two bugs. The first one is caused by
> fold/unfold stat not matched with hb->nr_callchain_rows, which is
> not related to hists__remove_entry_filter.

So this is not related to zooming, right?  Could you please give me a
reproduce step then?


> The second one is
> caused by he->nr_rows not cleared when zoom into DSO or thread.

This will be solved by resetting he->nr_rows, I guess.


> 
> These two bugs both have a same problem as I described in the
> chat, so I thought it can be resloved in one patch. What do you
> think?

I think you'd better to split the fix into two patches with more
detailed description and/or reproduce steps.

Thanks,
Namhyung


> >
> >>Signed-off-by: He Kuang <hekuang@...wei.com>
> >>---
> >>  tools/perf/ui/browsers/hists.c | 20 ++++++++++++++++++++
> >>  tools/perf/util/hist.c         |  1 +
> >>  2 files changed, 21 insertions(+)
> >>
> >>diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
> >>index 1106bb8..bef9ab0 100644
> >>--- a/tools/perf/ui/browsers/hists.c
> >>+++ b/tools/perf/ui/browsers/hists.c
> >>@@ -42,6 +42,7 @@ static void hist_browser__update_nr_entries(struct hist_browser *hb);
> >>  static struct rb_node *hists__filter_entries(struct rb_node *nd,
> >>  					     float min_pcnt);
> >>+static int __hist_browser__get_folding(struct hist_browser *browser);
> >>  static bool hist_browser__has_filter(struct hist_browser *hb)
> >>  {
> >>@@ -57,6 +58,7 @@ static u32 hist_browser__nr_entries(struct hist_browser *hb)
> >>  	else
> >>  		nr_entries = hb->hists->nr_entries;
> >>+	hb->nr_callchain_rows = __hist_browser__get_folding(hb);
> >>  	return nr_entries + hb->nr_callchain_rows;
> >>  }
> >>@@ -353,6 +355,24 @@ static void hist_entry__set_folding(struct hist_entry *he, bool unfold)
> >>  		he->nr_rows = 0;
> >>  }
> >>+static int
> >>+__hist_browser__get_folding(struct hist_browser *browser)
> >>+{
> >>+	struct rb_node *nd;
> >>+	struct hists *hists = browser->hists;
> >>+	int unfolded_rows = 0;
> >>+
> >>+	for (nd = rb_first(&hists->entries);
> >>+	     (nd = hists__filter_entries(nd, browser->min_pcnt)) != NULL;
> >>+	     nd = rb_next(nd)) {
> >>+		struct hist_entry *he = rb_entry(nd, struct hist_entry, rb_node);
> >>+
> >>+		if (he->ms.unfolded)
> >>+			unfolded_rows += he->nr_rows;
> >>+	}
> >>+	return unfolded_rows;
> >>+}
> >>+
> >>  static void
> >>  __hist_browser__set_folding(struct hist_browser *browser, bool unfold)
> >>  {
> >>diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
> >>index 70b48a6..24aff7d 100644
> >>--- a/tools/perf/util/hist.c
> >>+++ b/tools/perf/util/hist.c
> >>@@ -1169,6 +1169,7 @@ static void hists__remove_entry_filter(struct hists *hists, struct hist_entry *h
> >>  	/* force fold unfiltered entry for simplicity */
> >>  	h->ms.unfolded = false;
> >>  	h->row_offset = 0;
> >>+	h->nr_rows = 0;
> >>  	hists->stats.nr_non_filtered_samples += h->stat.nr_events;
> >>-- 
> >>2.2.0.33.gc18b867
> >>
> >>--
> >>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> >>the body of a message to majordomo@...r.kernel.org
> >>More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >>Please read the FAQ at  http://www.tux.org/lkml/
> >
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ