linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas-Mich Richter <tmricht@linux.ibm.com>
To: mpe@ellerman.id.au, linux-kernel@vger.kernel.org,
	linux-perf-users@vger.kernel.org, acme@kernel.org
Cc: brueckner@linux.vnet.ibm.com, schwidefsky@de.ibm.com,
	heiko.carstens@de.ibm.com
Subject: Re: [PATCH 2/3] perf report: Add raw report support for s390 auxiliary trace
Date: Wed, 8 Aug 2018 08:39:58 +0200	[thread overview]
Message-ID: <eda2632e-7919-5ffd-5f68-821e77d216fa@linux.ibm.com> (raw)
In-Reply-To: <87r2j9bkax.fsf@concordia.ellerman.id.au>

[-- Attachment #1: Type: text/plain, Size: 1853 bytes --]

On 08/08/2018 05:37 AM, mpe@ellerman.id.au wrote:
> Thomas Richter <tmricht@linux.ibm.com> writes:
>> Add support for s390 auxiliary trace support.
>> Use 'perf record -e rbd000' to create the perf.data file.
>> The event also has the symbolic name SF_CYCLES_BASIC_DIAG,
>> using 'perf record -e SF_CYCLES_BASIC_DIAG' is equivalent.
> ...
>>
>> Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
>> Reviewed-by: Hendrik Brueckner <brueckner@linux.ibm.com>
>> ---
>>  tools/perf/util/s390-cpumsf-kernel.h |  71 ++++++++
>>  tools/perf/util/s390-cpumsf.c        | 244 ++++++++++++++++++++++++++-
>>  2 files changed, 314 insertions(+), 1 deletion(-)
>>  create mode 100644 tools/perf/util/s390-cpumsf-kernel.h
> 
> 
> I'm seeing a build break on ppc64le which seems to be caused by this
> commit (I haven't bisected):
> 
>   util/s390-cpumsf.c: In function ‘trailer_timestamp’:
>   util/s390-cpumsf.c:222:2: error: dereferencing type-punned pointer will break strict-aliasing rules [-Werror=strict-aliasing]
>     return *((unsigned long long *) &te->timestamp[te->t]);
>     ^
> 
> 
> And on powerpc big endian:
>   In file included from util/cpumap.h:10:0,
>                    from util/s390-cpumsf.c:150:
>   util/s390-cpumsf.c: In function ‘s390_cpumsf_basic_show’:
>   util/s390-cpumsf.c:187:10: error: format ‘%lx’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘size_t {aka unsigned int}’ [-Werror=format=]
>      pr_err("Invalid AUX trace basic entry [%#08lx]\n", pos);
>             ^
> 
> cheers
> 

Can you please try this patch. Thanks a lot

-- 
Thomas Richter, Dept 3303, IBM s390 Linux Development, Boeblingen, Germany
--
Vorsitzende des Aufsichtsrats: Martina Koederitz 
Geschäftsführung: Dirk Wittkopp
Sitz der Gesellschaft: Böblingen / Registergericht: Amtsgericht Stuttgart, HRB 243294

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-perf-report-Fix-build-error-for-s390-auxiliary-trace.patch --]
[-- Type: text/x-patch; name="0001-perf-report-Fix-build-error-for-s390-auxiliary-trace.patch", Size: 2367 bytes --]

From add6a709f79e20e8b4eaa6ded2bd1af043f8a235 Mon Sep 17 00:00:00 2001
From: Thomas Richter <tmricht@linux.ibm.com>
Date: Wed, 8 Aug 2018 07:11:23 +0100
Subject: [PATCH] perf report: Fix build error for s390 auxiliary trace support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Commit 73eeeea48b7e ("perf report: Add raw report support for s390 auxiliary trace")
introduced a compile errors on powerpc:
  util/s390-cpumsf.c: In function ‘trailer_timestamp’:
  util/s390-cpumsf.c:222:2: error: dereferencing type-punned pointer will
	break strict-aliasing rules [-Werror=strict-aliasing]
	return *((unsigned long long *) &te->timestamp[te->t]);
	^

  In file included from util/cpumap.h:10:0,
                   from util/s390-cpumsf.c:150:
  util/s390-cpumsf.c: In function ‘s390_cpumsf_basic_show’:
  util/s390-cpumsf.c:187:10: error: format ‘%lx’ expects argument of type
	‘long unsigned int’, but argument 4 has type
	‘size_t {aka unsigned int}’ [-Werror=format=]
     pr_err("Invalid AUX trace basic entry [%#08lx]\n", pos);
            ^

Fix these errors:
1. Use memcpy to extract value from character array.
2. Use %zu as format string in pr_err

Fixes: 73eeeea48b7e
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
---
 tools/perf/util/s390-cpumsf.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/perf/util/s390-cpumsf.c b/tools/perf/util/s390-cpumsf.c
index 15555604ddb3..2bcb160a08f0 100644
--- a/tools/perf/util/s390-cpumsf.c
+++ b/tools/perf/util/s390-cpumsf.c
@@ -184,7 +184,7 @@ static bool s390_cpumsf_basic_show(const char *color, size_t pos,
 				   struct hws_basic_entry *basic)
 {
 	if (basic->def != 1) {
-		pr_err("Invalid AUX trace basic entry [%#08lx]\n", pos);
+		pr_err("Invalid AUX trace basic entry [%#08zx]\n", pos);
 		return false;
 	}
 	color_fprintf(stdout, color, "    [%#08x] Basic   Def:%04x Inst:%#04x"
@@ -219,7 +219,10 @@ static unsigned long long trailer_timestamp(struct hws_trailer_entry *te)
 	/* te->t set: TOD in STCKE format, bytes 8-15
 	 * to->t not set: TOD in STCK format, bytes 0-7
 	 */
-	return *((unsigned long long *) &te->timestamp[te->t]);
+	unsigned long long ts;
+
+	memcpy(&ts, &te->timestamp[te->t], sizeof(ts));
+	return ts;
 }
 
 /* Display s390 CPU measurement facility trailer entry */
-- 
2.14.3


  reply	other threads:[~2018-08-08  6:40 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-02  7:46 [PATCH 0/3] perf report: Add s390 auxiliary trace support Thomas Richter
2018-08-02  7:46 ` [PATCH 1/3] perf auxtrace: Support for perf report -D for s390 Thomas Richter
2018-08-02 12:49   ` Arnaldo Carvalho de Melo
2018-08-03 10:07     ` Hendrik Brueckner
2018-08-03 13:32       ` Arnaldo Carvalho de Melo
2018-08-18 11:22   ` [tip:perf/urgent] " tip-bot for Thomas Richter
2018-08-02  7:46 ` [PATCH 2/3] perf report: Add raw report support for s390 auxiliary trace Thomas Richter
2018-08-08  3:37   ` mpe
2018-08-08  6:39     ` Thomas-Mich Richter [this message]
2018-08-08 15:53       ` Arnaldo Carvalho de Melo
2018-08-08 15:59         ` Arnaldo Carvalho de Melo
2018-08-08 16:08           ` Arnaldo Carvalho de Melo
2018-08-08 16:14             ` Arnaldo Carvalho de Melo
2018-08-08 16:42               ` Arnaldo Carvalho de Melo
2018-08-09  4:35                 ` Thomas-Mich Richter
2018-08-09 15:14                   ` Arnaldo Carvalho de Melo
2018-08-10  5:41                     ` Michael Ellerman
2018-08-18 11:23       ` [tip:perf/urgent] " tip-bot for Thomas Richter
2018-08-02  7:46 ` [PATCH 3/3] perf report: Add GUI " Thomas Richter
2018-08-18 11:23   ` [tip:perf/urgent] " tip-bot for Thomas Richter

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=eda2632e-7919-5ffd-5f68-821e77d216fa@linux.ibm.com \
    --to=tmricht@linux.ibm.com \
    --cc=acme@kernel.org \
    --cc=brueckner@linux.vnet.ibm.com \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mpe@ellerman.id.au \
    --cc=schwidefsky@de.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).