Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1601879 > unrolled thread

Re: [PATCH] perf, tools, script: Add brstackinsn for branch stacks

Started byMichael Ellerman <mpe@ellerman.id.au>
First post2017-03-16 03:30 +0100
Last post2017-03-16 13:30 +0100
Articles 3 — 3 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH] perf, tools, script: Add brstackinsn for branch stacks Michael Ellerman <mpe@ellerman.id.au> - 2017-03-16 03:30 +0100
    Re: [PATCH] perf, tools, script: Add brstackinsn for branch stacks Andi Kleen <andi@firstfloor.org> - 2017-03-16 03:30 +0100
      Re: [PATCH] perf, tools, script: Add brstackinsn for branch stacks Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-03-16 13:30 +0100

#1601879 — Re: [PATCH] perf, tools, script: Add brstackinsn for branch stacks

FromMichael Ellerman <mpe@ellerman.id.au>
Date2017-03-16 03:30 +0100
SubjectRe: [PATCH] perf, tools, script: Add brstackinsn for branch stacks
Message-ID<tltkR-8jX-5@gated-at.bofh.it>
Hi acme,

Andi Kleen <andi@firstfloor.org> writes:

> diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
> index c0783b4f7b6c..b0fdb6c032a5 100644
> --- a/tools/perf/builtin-script.c
> +++ b/tools/perf/builtin-script.c
> @@ -546,6 +555,259 @@ static void print_sample_brstacksym(struct perf_sample *sample,
>  	}
>  }
>  
> +#define MAXBB 16384UL
> +
> +static int grab_bb(u8 *buffer, u64 start, u64 end,
> +		    struct machine *machine, struct thread *thread,
> +		    bool *is64bit, u8 *cpumode, bool last)
> +{
> +	long offset, len;
> +	struct addr_location al;
> +	bool kernel;
> +
> +	if (!start || !end)
> +		return 0;
> +
> +	kernel = machine__kernel_ip(machine, start);
> +	if (kernel)
> +		*cpumode = PERF_RECORD_MISC_KERNEL;
> +	else
> +		*cpumode = PERF_RECORD_MISC_USER;
> +
> +	/*
> +	 * Block overlaps between kernel and user.
> +	 * This can happen due to ring filtering
> +	 * On Intel CPUs the entry into the kernel is filtered,
> +	 * but the exit is not. Let the caller patch it up.
> +	 */
> +	if (kernel != machine__kernel_ip(machine, end)) {
> +		printf("\tblock %" PRIx64 "-%" PRIx64 " transfers between kernel and user\n",
> +				start, end);
> +		return -ENXIO;
> +	}
> +
> +	memset(&al, 0, sizeof(al));
> +	if (end - start > MAXBB - MAXINSN) {
> +		if (last)
> +			printf("\tbrstack does not reach to final jump (%" PRIx64 "-%" PRIx64 ")\n",
> +					start, end);
> +		else
> +			printf("\tblock %" PRIx64 "-%" PRIx64 " (%ld) too long to dump\n",
> +					start, end, end - start);

This looks to be breaking the build on ppc64:

  builtin-script.c: In function ‘grab_bb’:
  builtin-script.c:595:11: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘u64 {aka long long unsigned int}’ [-Werror=format=]
      printf("\tblock %" PRIx64 "-%" PRIx64 " (%ld) too long to dump\n", start, end, end - start);
             ^

cheers

[toc] | [next] | [standalone]


#1601882

FromAndi Kleen <andi@firstfloor.org>
Date2017-03-16 03:30 +0100
Message-ID<tltkS-8jX-13@gated-at.bofh.it>
In reply to#1601879
> > +	memset(&al, 0, sizeof(al));
> > +	if (end - start > MAXBB - MAXINSN) {
> > +		if (last)
> > +			printf("\tbrstack does not reach to final jump (%" PRIx64 "-%" PRIx64 ")\n",
> > +					start, end);
> > +		else
> > +			printf("\tblock %" PRIx64 "-%" PRIx64 " (%ld) too long to dump\n",

Thanks. Should be %" PRIu64 " of course.

Arnaldo, can you do the change or should I send a patch?

-Andi

> > +					start, end, end - start);
> 
> This looks to be breaking the build on ppc64:
> 
>   builtin-script.c: In function ‘grab_bb’:
>   builtin-script.c:595:11: error: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘u64 {aka long long unsigned int}’ [-Werror=format=]
>       printf("\tblock %" PRIx64 "-%" PRIx64 " (%ld) too long to dump\n", start, end, end - start);
>              ^
> 
> cheers
> 

[toc] | [prev] | [next] | [standalone]


#1602226

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2017-03-16 13:30 +0100
Message-ID<tlCHw-6I6-33@gated-at.bofh.it>
In reply to#1601882
Em Wed, Mar 15, 2017 at 07:22:18PM -0700, Andi Kleen escreveu:
> > > +	memset(&al, 0, sizeof(al));
> > > +	if (end - start > MAXBB - MAXINSN) {
> > > +		if (last)
> > > +			printf("\tbrstack does not reach to final jump (%" PRIx64 "-%" PRIx64 ")\n",
> > > +					start, end);
> > > +		else
> > > +			printf("\tblock %" PRIx64 "-%" PRIx64 " (%ld) too long to dump\n",
> 
> Thanks. Should be %" PRIu64 " of course.
> 
> Arnaldo, can you do the change 

Done.

> or should I send a patch?

- Arnaldo

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web