public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hemant Kumar <hkshaw@linux.vnet.ibm.com>
To: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: linux-kernel@vger.kernel.org, srikar@linux.vnet.ibm.com,
	peterz@infradead.org, oleg@redhat.com,
	hegdevasant@linux.vnet.ibm.com, mingo@redhat.com,
	anton@redhat.com, systemtap@sourceware.org, namhyung@kernel.org,
	aravinda@linux.vnet.ibm.com
Subject: Re: [PATCH v3 2/3] Support for perf to probe into SDT markers:
Date: Sun, 20 Oct 2013 13:20:28 +0530	[thread overview]
Message-ID: <52638B44.2030800@linux.vnet.ibm.com> (raw)
In-Reply-To: <5262A9C1.5030200@hitachi.com>

On 10/19/2013 09:18 PM, Masami Hiramatsu wrote:
> [...]
> +
> +	/*
> +	 * Find out the .stapsdt.base section.
> +	 * This scn will help us to handle prelinking (if present).
> +	 * Compare the retrieved file offset of the base section with the
> +	 * base address in the description of the SDT note. If its different,
> +	 * then accordingly, adjust the note location.
> +	 */
> +	if (elf_section_by_name(elf, &ehdr, &shdr, SDT_BASE_SCN, NULL))
> +		base_off = shdr.sh_offset;
> +	if (base_off) {
> +		if (tmp->bit32)
> +			key->addr.a32[0] = tmp->addr.a32[0] + base_off -
> +				tmp->addr.a32[1];
> +		else
> +			key->addr.a64[0] = tmp->addr.a64[0] + base_off -
> +				tmp->addr.a64[1];
> +	}
> +	key->bit32 = tmp->bit32;
> +}
> +
> +int search_sdt_note(struct sdt_note *key, struct list_head *sdt_notes,
> +		    const char *target)
> Hmm, this interface looks very odd.
>   - This just finds the first matched sdt_note entry instead of the list.
>     In that case, we don't need to pass the list_head.
>   - If the purpose is just counting the number of matched entries (or just
>     checking existence), we also don't need the list. Just returning the
>     number is enough.
>
> I recommend you to remove the "sdt_notes", and make the caller check
> key->addr is set.

Yeah, list isn't required in this case. Thanks for pointing that out. 
Will change that.

> [...]
>
-- 
Thanks
Hemant Kumar


  reply	other threads:[~2013-10-20  7:50 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-18 14:42 [PATCH v3 0/3] Perf support to SDT markers Hemant Kumar
2013-10-18 14:44 ` [PATCH v3 1/3] SDT markers listing by perf: Hemant Kumar
2013-10-19 15:27   ` Masami Hiramatsu
2013-10-20  7:47     ` Hemant Kumar
2013-10-18 14:44 ` [PATCH v3 2/3] Support for perf to probe into SDT markers: Hemant Kumar
2013-10-19 15:48   ` Masami Hiramatsu
2013-10-20  7:50     ` Hemant Kumar [this message]
2013-10-18 14:45 ` [PATCH v3 3/3] Documentation regarding perf/sdt Hemant Kumar
2013-10-18 14:49 ` [PATCH v3 0/3] Perf support to SDT markers Hemant

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=52638B44.2030800@linux.vnet.ibm.com \
    --to=hkshaw@linux.vnet.ibm.com \
    --cc=anton@redhat.com \
    --cc=aravinda@linux.vnet.ibm.com \
    --cc=hegdevasant@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=srikar@linux.vnet.ibm.com \
    --cc=systemtap@sourceware.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