linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Chandan Kumar <chandan.kumar@linux.vnet.ibm.com>
To: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org
Cc: acme@redhat.com, mpe@ellerman.id.au, jolsa@redhat.com,
	anju@linux.vnet.ibm.com, maddy@linux.vnet.ibm.com,
	naveen.n.rao@linux.vnet.ibm.com, hemant@linux.vnet.ibm.com
Subject: [PATCH 3/3] perf tools: Fix perf regs mask generation
Date: Thu, 28 Apr 2016 15:01:10 +0530	[thread overview]
Message-ID: <1461835870-67778-4-git-send-email-chandan.kumar@linux.vnet.ibm.com> (raw)
In-Reply-To: <1461835870-67778-1-git-send-email-chandan.kumar@linux.vnet.ibm.com>

From: "Naveen N. Rao" <naveen.n.rao@linux.vnet.ibm.com>

On some architectures (powerpc in particular), the number of registers
exceeds what can be represented in an integer bitmask. Ensure we
generate the proper bitmask on such platforms.

Fixes: 71ad0f5e4 ("perf tools: Support for DWARF CFI unwinding on post
processing")

Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
---
 tools/perf/util/perf_regs.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c
index 6b8eb13..c4023f2 100644
--- a/tools/perf/util/perf_regs.c
+++ b/tools/perf/util/perf_regs.c
@@ -12,18 +12,18 @@ int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
 	int i, idx = 0;
 	u64 mask = regs->mask;
 
-	if (regs->cache_mask & (1 << id))
+	if (regs->cache_mask & (1ULL << id))
 		goto out;
 
-	if (!(mask & (1 << id)))
+	if (!(mask & (1ULL << id)))
 		return -EINVAL;
 
 	for (i = 0; i < id; i++) {
-		if (mask & (1 << i))
+		if (mask & (1ULL << i))
 			idx++;
 	}
 
-	regs->cache_mask |= (1 << id);
+	regs->cache_mask |= (1ULL << id);
 	regs->cache_regs[id] = regs->regs[idx];
 
 out:
-- 
1.9.3

  parent reply	other threads:[~2016-04-28  9:31 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-28  9:31 [PATCH 0/3] Add support for perf user stack dump in powerpc Chandan Kumar
2016-04-28  9:31 ` [PATCH 1/3] powerpc: Add HAVE_PERF_USER_STACK_DUMP support Chandan Kumar
2016-05-08  3:59   ` [1/3] " Michael Ellerman
2016-04-28  9:31 ` [PATCH 2/3] powerpc/perf: Add support for unwinding perf-stackdump Chandan Kumar
2016-05-08  3:59   ` [2/3] " Michael Ellerman
2016-04-28  9:31 ` Chandan Kumar [this message]
2016-05-08  3:59   ` [3/3] perf tools: Fix perf regs mask generation Michael Ellerman
2016-04-28 14:23 ` [PATCH 0/3] Add support for perf user stack dump in powerpc Naveen N. Rao
2016-04-28 15:29   ` Arnaldo Carvalho de Melo
2016-04-28 16:14     ` Naveen N. Rao
2016-04-28 16:31       ` Arnaldo Carvalho de Melo

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=1461835870-67778-4-git-send-email-chandan.kumar@linux.vnet.ibm.com \
    --to=chandan.kumar@linux.vnet.ibm.com \
    --cc=acme@redhat.com \
    --cc=anju@linux.vnet.ibm.com \
    --cc=hemant@linux.vnet.ibm.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.vnet.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=naveen.n.rao@linux.vnet.ibm.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;
as well as URLs for NNTP newsgroup(s).