From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@vger.kernel.org>
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
	id S1753748Ab3AaMyp (ORCPT <rfc822;w@1wt.eu>);
	Thu, 31 Jan 2013 07:54:45 -0500
Received: from mail-wg0-f51.google.com ([74.125.82.51]:60730 "EHLO
	mail-wg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
	with ESMTP id S1751766Ab3AaMyn (ORCPT
	<rfc822;linux-kernel@vger.kernel.org>);
	Thu, 31 Jan 2013 07:54:43 -0500
Date: Thu, 31 Jan 2013 13:54:37 +0100
From: Stephane Eranian <eranian@google.com>
To: linux-kernel@vger.kernel.org
Cc: acme@redhat.com, mingo@elte.hu, peterz@infradead.org, jolsa@redhat.com,
        namhyung.kim@lge.com
Subject: [PATCH] perf tools: fix set event list leader
Message-ID: <20130131125437.GA3656@quad>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.21 (2010-09-15)
Sender: linux-kernel-owner@vger.kernel.org
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org


The __perf_evlist__set_leader() was setting the leader for all events
in the list except the first. Which means it assumed the first event
already had event->leader = event. Seems like this should be the role
of the function to also do this. This is a requirement for an upcoming
patch set.

Signed-off-by: Stephane Eranian <eranian@google.com>
---

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index dc8aee9..050d5bc 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -119,8 +119,7 @@ void __perf_evlist__set_leader(struct list_head *list)
 	leader = list_entry(list->next, struct perf_evsel, node);
 
 	list_for_each_entry(evsel, list, node) {
-		if (evsel != leader)
-			evsel->leader = leader;
+		evsel->leader = leader;
 	}
 }
 

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@vger.kernel.org>
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
	id S1754896Ab3AaNNA (ORCPT <rfc822;w@1wt.eu>);
	Thu, 31 Jan 2013 08:13:00 -0500
Received: from mx1.redhat.com ([209.132.183.28]:9414 "EHLO mx1.redhat.com"
	rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP
	id S1753547Ab3AaNM6 (ORCPT <rfc822;linux-kernel@vger.kernel.org>);
	Thu, 31 Jan 2013 08:12:58 -0500
Date: Thu, 31 Jan 2013 14:12:43 +0100
From: Jiri Olsa <jolsa@redhat.com>
To: Stephane Eranian <eranian@google.com>
Cc: linux-kernel@vger.kernel.org, acme@redhat.com, mingo@elte.hu,
        peterz@infradead.org, namhyung.kim@lge.com
Subject: Re: [PATCH] perf tools: fix set event list leader
Message-ID: <20130131131243.GB1091@krava.brq.redhat.com>
References: <20130131125437.GA3656@quad>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20130131125437.GA3656@quad>
User-Agent: Mutt/1.5.21 (2010-09-15)
Sender: linux-kernel-owner@vger.kernel.org
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

On Thu, Jan 31, 2013 at 01:54:37PM +0100, Stephane Eranian wrote:
> 
> The __perf_evlist__set_leader() was setting the leader for all events
> in the list except the first. Which means it assumed the first event
> already had event->leader = event. Seems like this should be the role
> of the function to also do this. This is a requirement for an upcoming
> patch set.

agreed, 

Acked/Tested-by Jiri Olsa <jolsa@redhat.com>


> 
> Signed-off-by: Stephane Eranian <eranian@google.com>
> ---
> 
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index dc8aee9..050d5bc 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -119,8 +119,7 @@ void __perf_evlist__set_leader(struct list_head *list)
>  	leader = list_entry(list->next, struct perf_evsel, node);
>  
>  	list_for_each_entry(evsel, list, node) {
> -		if (evsel != leader)
> -			evsel->leader = leader;
> +		evsel->leader = leader;
>  	}

that's leftover from the times when leader has 'leader' set to NULL

we made the change here:

perf evsel: Set leader evsel's ->leader to itself
commit 2cfda562da7b0b1e0575507ef3efe782d4e218e4
Author: Namhyung Kim <namhyung.kim@lge.com>
Date:   Thu Nov 29 15:38:29 2012 +0900

the leader is set properly in perf_evsel__init and when
reading perf.data, so there was no harm in current code

thanks,
jirka

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@vger.kernel.org>
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
	id S1754544Ab3BABuu (ORCPT <rfc822;w@1wt.eu>);
	Thu, 31 Jan 2013 20:50:50 -0500
Received: from LGEMRELSE6Q.lge.com ([156.147.1.121]:50569 "EHLO
	LGEMRELSE6Q.lge.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
	with ESMTP id S1753601Ab3BABur (ORCPT
	<rfc822;linux-kernel@vger.kernel.org>);
	Thu, 31 Jan 2013 20:50:47 -0500
X-AuditID: 9c930179-b7c24ae00000119c-3a-510b1f74fae1
From: Namhyung Kim <namhyung@kernel.org>
To: Stephane Eranian <eranian@google.com>
Cc: linux-kernel@vger.kernel.org, acme@redhat.com, mingo@elte.hu,
        peterz@infradead.org, jolsa@redhat.com, namhyung.kim@lge.com
Subject: Re: [PATCH] perf tools: fix set event list leader
References: <20130131125437.GA3656@quad>
Date: Fri, 01 Feb 2013 10:50:44 +0900
In-Reply-To: <20130131125437.GA3656@quad> (Stephane Eranian's message of "Thu,
	31 Jan 2013 13:54:37 +0100")
Message-ID: <87lib8u7ij.fsf@sejong.aot.lge.com>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Brightmail-Tracker: AAAAAA==
Sender: linux-kernel-owner@vger.kernel.org
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

Hi Stephane,

On Thu, 31 Jan 2013 13:54:37 +0100, Stephane Eranian wrote:
> The __perf_evlist__set_leader() was setting the leader for all events
> in the list except the first. Which means it assumed the first event
> already had event->leader = event. Seems like this should be the role
> of the function to also do this. This is a requirement for an upcoming
> patch set.
>
> Signed-off-by: Stephane Eranian <eranian@google.com>

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung


> ---
>
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
> index dc8aee9..050d5bc 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -119,8 +119,7 @@ void __perf_evlist__set_leader(struct list_head *list)
>  	leader = list_entry(list->next, struct perf_evsel, node);
>  
>  	list_for_each_entry(evsel, list, node) {
> -		if (evsel != leader)
> -			evsel->leader = leader;
> +		evsel->leader = leader;
>  	}
>  }
>  

From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <linux-kernel-owner@vger.kernel.org>
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
	id S932153Ab3BFWBp (ORCPT <rfc822;w@1wt.eu>);
	Wed, 6 Feb 2013 17:01:45 -0500
Received: from terminus.zytor.com ([198.137.202.10]:37201 "EHLO
	terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
	with ESMTP id S932165Ab3BFWBm (ORCPT
	<rfc822;linux-kernel@vger.kernel.org>);
	Wed, 6 Feb 2013 17:01:42 -0500
Date: Wed, 6 Feb 2013 14:01:14 -0800
From: tip-bot for Stephane Eranian <eranian@google.com>
Message-ID: <tip-74b2133d19e776924b2773e27dd9d6940f1cc594@git.kernel.org>
Cc: acme@redhat.com, linux-kernel@vger.kernel.org, eranian@google.com,
        hpa@zytor.com, mingo@kernel.org, peterz@infradead.org,
        namhyung.kim@lge.com, namhyung@kernel.org, jolsa@redhat.com,
        tglx@linutronix.de, mingo@elte.hu
Reply-To: mingo@kernel.org, hpa@zytor.com, eranian@google.com,
        linux-kernel@vger.kernel.org, acme@redhat.com, peterz@infradead.org,
        namhyung.kim@lge.com, namhyung@kernel.org, jolsa@redhat.com,
        tglx@linutronix.de, mingo@elte.hu
In-Reply-To: <20130131125437.GA3656@quad>
References: <20130131125437.GA3656@quad>
To: linux-tip-commits@vger.kernel.org
Subject: [tip:perf/core] perf evlist: Fix set event list leader
Git-Commit-ID: 74b2133d19e776924b2773e27dd9d6940f1cc594
X-Mailer: tip-git-log-daemon
Robot-ID: <tip-bot.git.kernel.org>
Robot-Unsubscribe: Contact <mailto:hpa@kernel.org>
  to get blacklisted from these emails
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset=UTF-8
Content-Disposition: inline
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.7 (terminus.zytor.com [127.0.0.1]); Wed, 06 Feb 2013 14:01:20 -0800 (PST)
Sender: linux-kernel-owner@vger.kernel.org
List-ID: <linux-kernel.vger.kernel.org>
X-Mailing-List: linux-kernel@vger.kernel.org

Commit-ID:  74b2133d19e776924b2773e27dd9d6940f1cc594
Gitweb:     http://git.kernel.org/tip/74b2133d19e776924b2773e27dd9d6940f1cc594
Author:     Stephane Eranian <eranian@google.com>
AuthorDate: Thu, 31 Jan 2013 13:54:37 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Wed, 6 Feb 2013 18:09:25 -0300

perf evlist: Fix set event list leader

The __perf_evlist__set_leader() was setting the leader for all events in
the list except the first. Which means it assumed the first event
already had event->leader = event.

Seems like this should be the role of the function to also do this. This
is a requirement for an upcoming patch set.

Signed-off-by: Stephane Eranian <eranian@google.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Jiri Olsa <jolsa@redhat.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung.kim@lge.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20130131125437.GA3656@quad
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/util/evlist.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c
index eddd5eb..ecf123e 100644
--- a/tools/perf/util/evlist.c
+++ b/tools/perf/util/evlist.c
@@ -122,8 +122,7 @@ void __perf_evlist__set_leader(struct list_head *list)
 	leader->nr_members = evsel->idx - leader->idx + 1;
 
 	list_for_each_entry(evsel, list, node) {
-		if (evsel != leader)
-			evsel->leader = leader;
+		evsel->leader = leader;
 	}
 }
 

