mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@kernel.org>
To: David Ahern <dsahern@gmail.com>
Cc: acme@ghostprotocols.net, mingo@kernel.org,
	linux-kernel@vger.kernel.org,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Jiri Olsa <jolsa@redhat.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [PATCH 4/4] perf kvm: fix bug resolving guest kernel syms
Date: Wed, 11 Jul 2012 11:30:01 +0900	[thread overview]
Message-ID: <87zk776ndi.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <4FFCE1EF.7000602@gmail.com> (David Ahern's message of "Tue, 10 Jul 2012 20:16:15 -0600")

On Tue, 10 Jul 2012 20:16:15 -0600, David Ahern wrote:
> On 7/10/12 6:54 PM, Namhyung Kim wrote:
>> On Tue, 10 Jul 2012 15:48:14 -0600, David Ahern wrote:
>>> diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
>>> index 641377e..da3411b 100644
>>> --- a/tools/perf/util/map.c
>>> +++ b/tools/perf/util/map.c
>>> @@ -730,3 +730,27 @@ char *machine__mmap_name(struct machine *self, char *bf, size_t size)
>>>
>>>   	return bf;
>>>   }
>>> +
>>> +void machines__set_id_hdr_size(struct rb_root *self, u16 id_hdr_size)
>>> +{
>>> +	struct rb_node *p;
>>> +	struct machine *machine;
>>> +
>>> +    p = self->rb_node;
>>> +	while (p != NULL) {
>>> +		machine = rb_entry(p, struct machine, rb_node);
>>> +		machine->id_hdr_size = id_hdr_size;
>>> +        p = rb_next(p);
>>> +	}
>>> +
>>
>> Looks like white-space damaged. :(
>
> bleah, something on my dev server converted tabs to spaces. Will fix.
>
>>
>> The loop itself looks fine, or you might use this form:
>>
>> 	for (p = rb_first(self); p; p = rb_next(p))
>
> Doesn't work - I still see machines not updated.
>>
>>
>> Is there a something like rb_for_each_entry() ?
>
> Didn't see one.
>
>>
>>
>>> +    p = self->rb_node;
>>> +    if (p)
>>> +        p = rb_prev(p);
>>> +	while (p != NULL) {
>>> +		machine = rb_entry(p, struct machine, rb_node);
>>> +		machine->id_hdr_size = id_hdr_size;
>>> +        p = rb_prev(p);
>>> +	}
>>> +
>>
>> I don't see why this second loop is necessary?
>
> To get the left half of the tree I believe. First loop walks the root
> and all of the leaves to the right; this loop walks all of the leaves
> to the left.
>

Oh, I overlooked the initial setting. So you divided tree-traversal to
left and right part. It seems very odd to me. AFAIK a traversal from
rb_first through rb_next shouldn't miss any node in the tree.

Thanks,
Namhyung

      reply	other threads:[~2012-07-11  2:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-10 21:48 [PATCH 0/4] perf kvm: more bug fixes and cleanups David Ahern
2012-07-10 21:48 ` [PATCH 1/4] perf kvm: set name for VM process in guest machine David Ahern
2012-07-10 21:48 ` [PATCH 2/4] perf kvm: guest userspace samples should not be lumped with host uspace David Ahern
2012-07-10 21:48 ` [PATCH 3/4] perf kvm: limit repetitive guestmount message to once David Ahern
2012-07-10 21:48 ` [PATCH 4/4] perf kvm: fix bug resolving guest kernel syms David Ahern
2012-07-11  0:54   ` Namhyung Kim
2012-07-11  2:16     ` David Ahern
2012-07-11  2:30       ` Namhyung Kim [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87zk776ndi.fsf@sejong.aot.lge.com \
    --to=namhyung@kernel.org \
    --cc=acme@ghostprotocols.net \
    --cc=acme@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome