mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Incomplete cherry-pick on linux-3.3.y branch
@ 2012-04-23 19:08 H.J. Lu
  2012-04-23 21:23 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: H.J. Lu @ 2012-04-23 19:08 UTC (permalink / raw)
  To: LKML; +Cc: David Miller

Hi,

This cherry-pick commit:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=commit;h=1cb41fe7e34a43a1d27dfdb6d65699786dd44c20

doesn't work on 3.3 branch since it misses other commits
required.  On 3.3 branch, there are

struct hist_entry *__hists__add_entry(struct hists *hists,
                                      struct addr_location *al,
                                      struct symbol *sym_parent, u64 period)
{
        struct rb_node **p;
        struct rb_node *parent = NULL;
        struct hist_entry *he;
        struct hist_entry entry = {
                .thread = al->thread,

It doesn't work with

diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
index e11e482..a47a6f1 100644
--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -230,6 +230,18 @@ struct hist_entry *__hists__add_entry(struct hists *hists,
 		if (!cmp) {
 			he->period += period;
 			++he->nr_events;
+
+			/* If the map of an existing hist_entry has
+			 * become out-of-date due to an exec() or
+			 * similar, update it.  Otherwise we will
+			 * mis-adjust symbol addresses when computing
+			 * the history counter to increment.
+			 */
+			if (he->ms.map != entry->ms.map) {
+				he->ms.map = entry->ms.map;
+				if (he->ms.map)
+					he->ms.map->referenced = true;
+			}
 			goto out;
 		}

since entry isn't a pointer on 3.3 branch.


-- 
H.J.

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

* Re: Incomplete cherry-pick on linux-3.3.y branch
  2012-04-23 19:08 Incomplete cherry-pick on linux-3.3.y branch H.J. Lu
@ 2012-04-23 21:23 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2012-04-23 21:23 UTC (permalink / raw)
  To: H.J. Lu; +Cc: LKML, David Miller

[-- Attachment #1: Type: text/plain, Size: 1667 bytes --]

On Mon, Apr 23, 2012 at 12:08:13PM -0700, H.J. Lu wrote:
> Hi,
> 
> This cherry-pick commit:
> 
> http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=commit;h=1cb41fe7e34a43a1d27dfdb6d65699786dd44c20
> 
> doesn't work on 3.3 branch since it misses other commits
> required.  On 3.3 branch, there are
> 
> struct hist_entry *__hists__add_entry(struct hists *hists,
>                                       struct addr_location *al,
>                                       struct symbol *sym_parent, u64 period)
> {
>         struct rb_node **p;
>         struct rb_node *parent = NULL;
>         struct hist_entry *he;
>         struct hist_entry entry = {
>                 .thread = al->thread,
> 
> It doesn't work with
> 
> diff --git a/tools/perf/util/hist.c b/tools/perf/util/hist.c
> index e11e482..a47a6f1 100644
> --- a/tools/perf/util/hist.c
> +++ b/tools/perf/util/hist.c
> @@ -230,6 +230,18 @@ struct hist_entry *__hists__add_entry(struct hists *hists,
>  		if (!cmp) {
>  			he->period += period;
>  			++he->nr_events;
> +
> +			/* If the map of an existing hist_entry has
> +			 * become out-of-date due to an exec() or
> +			 * similar, update it.  Otherwise we will
> +			 * mis-adjust symbol addresses when computing
> +			 * the history counter to increment.
> +			 */
> +			if (he->ms.map != entry->ms.map) {
> +				he->ms.map = entry->ms.map;
> +				if (he->ms.map)
> +					he->ms.map->referenced = true;
> +			}
>  			goto out;
>  		}
> 
> since entry isn't a pointer on 3.3 branch.

Already fixed in the stable-queue tree, and will show up in the next
kernel release.  If you need a fix now, use the one below.

thanks,

greg k-h

[-- Attachment #2: perf-fix-build-breakage.patch --]
[-- Type: text/x-patch, Size: 2067 bytes --]

>From zeev.tarantov@gmail.com Sun Apr 22 23:38:36 2012
From: Zeev Tarantov <zeev.tarantov@gmail.com>
Date: Mon, 23 Apr 2012 09:37:04 +0300
Subject: Perf: fix build breakage
To: "David S. Miller" <davem@davemloft.net>, Arnaldo Carvalho de Melo <acme@redhat.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Message-ID: <20120423063704.GA3465@myhost>
Content-Disposition: inline


From: Zeev Tarantov <zeev.tarantov@gmail.com>

[Patch not needed upstream as this is a backport build bugfix - gregkh

gcc correctly complains:

util/hist.c: In function ‘__hists__add_entry’:
util/hist.c:240:27: error: invalid type argument of ‘->’ (have ‘struct hist_entry’)
util/hist.c:241:23: error: invalid type argument of ‘->’ (have ‘struct hist_entry’)

for this new code:

+                       if (he->ms.map != entry->ms.map) {
+                               he->ms.map = entry->ms.map;
+                               if (he->ms.map)
+                                       he->ms.map->referenced = true;
+                       }

because "entry" is a "struct hist_entry", not a pointer to a struct.

In mainline, "entry" is a pointer to struct passed as argument to the function.
So this is broken during backporting. But obviously not compile tested.

Signed-off-by: Zeev Tarantov <zeev.tarantov@gmail.com>
Cc: Signed-off-by: David S. Miller <davem@davemloft.net>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 tools/perf/util/hist.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

--- a/tools/perf/util/hist.c
+++ b/tools/perf/util/hist.c
@@ -237,8 +237,8 @@ struct hist_entry *__hists__add_entry(st
 			 * mis-adjust symbol addresses when computing
 			 * the history counter to increment.
 			 */
-			if (he->ms.map != entry->ms.map) {
-				he->ms.map = entry->ms.map;
+			if (he->ms.map != entry.ms.map) {
+				he->ms.map = entry.ms.map;
 				if (he->ms.map)
 					he->ms.map->referenced = true;
 			}

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

end of thread, other threads:[~2012-04-23 21:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-23 19:08 Incomplete cherry-pick on linux-3.3.y branch H.J. Lu
2012-04-23 21:23 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®