public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: "Jin, Yao" <yao.jin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>,
	jolsa@kernel.org, peterz@infradead.org, mingo@redhat.com,
	alexander.shishkin@linux.intel.com, Linux-kernel@vger.kernel.org,
	ak@linux.intel.com, kan.liang@intel.com, yao.jin@intel.com
Subject: Re: [PATCH 1/2] perf script: Support filtering by hex address
Date: Thu, 28 Jan 2021 09:43:10 -0300	[thread overview]
Message-ID: <20210128124310.GC775562@kernel.org> (raw)
In-Reply-To: <60d102fa-d98a-6182-0a1d-b78122fed574@linux.intel.com>

Em Thu, Jan 28, 2021 at 11:31:26AM +0800, Jin, Yao escreveu:
> On 1/28/2021 7:13 AM, Jiri Olsa wrote:
> > > @@ -709,6 +725,26 @@ int machine__resolve(struct machine *machine, struct addr_location *al,
> > >   			ret = strlist__has_entry(symbol_conf.sym_list, al_addr_str);
> > >   		}
> > > +		if (!ret && al->map) {
> > > +			snprintf(al_addr_str, sz, "0x%"PRIx64,
> > > +				al->map->unmap_ip(al->map, al->addr));
> > > +			ret = strlist__has_entry(symbol_conf.sym_list,
> > > +						 al_addr_str);
> > > +			if (!ret) {
> > > +				/* Check for hex without "0x" prefix */
> > > +				snprintf(al_addr_str, sz, "%"PRIx64,
> > > +					al->map->unmap_ip(al->map, al->addr));
> > > +				ret = strlist__has_entry(symbol_conf.sym_list,
> > > +							 al_addr_str);
> > > +			}
> > that seems tricky.. what if user specify more leading zeros,
> > I think it'd be better to search intlist instead

> > we could move all 'address' entries from sym_list to
> > new intlist (in symbol__init) and use it for this search

> intlist now only supports 'int' type.

> I'm considering to use 'long' to replace original 'int' in struct int_node.

> struct int_node {
> 	struct rb_node rb_node;
> -	int i;
> +	long i;
> 	void *priv;
> };

> On 32 bits platform, sizeof(long) is 4, and on 64 bits platform,
> sizeof(long) is 8. So that should be OK for storing the values such as
> pid/tid and address.

> I'm not very clear why currently it uses 'int' for i in struct int_node,
> maybe something I don't understand correctly. Please correct me if my
> understanding is wrong.

I think its ok to make it a long, it won't even enlarge the struct
because:

[acme@quaco pahole]$ pahole -C int_node ~/bin/perf
struct int_node {
	struct rb_node             rb_node __attribute__((__aligned__(8))); /*     0    24 */
	int                        i;                                       /*    24     4 */

	/* XXX 4 bytes hole, try to pack */

	void *                     priv;                                    /*    32     8 */

	/* size: 40, cachelines: 1, members: 3 */
	/* sum members: 36, holes: 1, sum holes: 4 */
	/* forced alignments: 1 */
	/* last cacheline: 40 bytes */
} __attribute__((__aligned__(8)));
[acme@quaco pahole]$

:-)

- Arnaldo

  reply	other threads:[~2021-01-28 12:44 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-24 23:27 [PATCH 1/2] perf script: Support filtering by hex address Jin Yao
2021-01-24 23:27 ` [PATCH 2/2] perf script: Support dso filter Jin Yao
2021-01-27 22:15   ` Jiri Olsa
2021-01-28 13:12   ` Arnaldo Carvalho de Melo
2021-01-29  0:37     ` Jin, Yao
2021-01-27 23:13 ` [PATCH 1/2] perf script: Support filtering by hex address Jiri Olsa
2021-01-28  3:31   ` Jin, Yao
2021-01-28 12:43     ` Arnaldo Carvalho de Melo [this message]
2021-01-29  0:42       ` Jin, Yao

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=20210128124310.GC775562@kernel.org \
    --to=acme@kernel.org \
    --cc=Linux-kernel@vger.kernel.org \
    --cc=ak@linux.intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=jolsa@kernel.org \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@intel.com \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=yao.jin@intel.com \
    --cc=yao.jin@linux.intel.com \
    /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