From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751290AbdCPCYC convert rfc822-to-8bit (ORCPT ); Wed, 15 Mar 2017 22:24:02 -0400 Received: from ozlabs.org ([103.22.144.67]:43245 "EHLO ozlabs.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750877AbdCPCYA (ORCPT ); Wed, 15 Mar 2017 22:24:00 -0400 From: Michael Ellerman To: acme@kernel.org Cc: mingo@kernel.org, jolsa@kernel.org, linux-kernel@vger.kernel.org, Andi Kleen , Andi Kleen Subject: Re: [PATCH] perf, tools, script: Add brstackinsn for branch stacks In-Reply-To: <20170223234634.583-1-andi@firstfloor.org> References: <20170223234634.583-1-andi@firstfloor.org> User-Agent: Notmuch/0.21 (https://notmuchmail.org) Date: Thu, 16 Mar 2017 13:16:21 +1100 Message-ID: <87zigmt18q.fsf@concordia.ellerman.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi acme, Andi Kleen 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