From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3rWHvX3MC0zDqvY for ; Fri, 17 Jun 2016 21:24:08 +1000 (AEST) Date: Fri, 17 Jun 2016 13:24:01 +0200 From: Jiri Olsa To: Madhavan Srinivasan Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Yury Norov , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Kan Liang , Wang Nan , Michael Ellerman Subject: Re: [PATCH] tools/perf: Fix the mask in regs_dump__printf Message-ID: <20160617112401.GA3904@krava> References: <1466140958-1928-1-git-send-email-maddy@linux.vnet.ibm.com> <20160617063707.GA31475@krava> <7abb0f9a-dea0-de86-ba0b-cebce0f11744@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii In-Reply-To: <7abb0f9a-dea0-de86-ba0b-cebce0f11744@linux.vnet.ibm.com> List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On Fri, Jun 17, 2016 at 02:43:31PM +0530, Madhavan Srinivasan wrote: SNIP > > > if (data->user_regs.abi) { > - u64 mask = evsel->attr.sample_regs_user; > + u.val64 = evsel->attr.sample_regs_user; > > - sz = hweight_long(mask) * sizeof(u64); > + if (sizeof(u64) > sizeof(unsigned long)) { > + u64 mask = u.val64; > + u.val32[1] = mask >> 32; > + u.val32[0] = mask & ULONG_MAX; > + } > + > + sz = hweight_long(u.val64) * sizeof(u64); > OVERFLOW_CHECK(array, sz, max_size); > - data->user_regs.mask = mask; > + data->user_regs.mask = u.val64; > data->user_regs.regs = (u64 *)array; > > Issue I see is when printing the mask value in a 32bit perf > on a 64bit kernel (big endian). > > 442044948492 0xdc0 [0x188]: PERF_RECORD_SAMPLE(IP, 0x1): 7299/7299: > 0xc000000000059200 period: 12599 addr: 0 > ... intr regs: mask 0xffffffff000007ff ABI 32-bit > ^^^ shld have been 0x7ffffffffff > > I agree it is better to fix this when reading, but > we need to swap again when printing? hum, sample data should be swap at this point already.. see perf_session__process_event jirka