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


Groups > linux.kernel > #1583425 > unrolled thread

[PATCH 0/5] perf tools: Few fixes

Started byJiri Olsa <jolsa@kernel.org>
First post2017-02-17 15:10 +0100
Last post2017-02-21 09:20 +0100
Articles 8 on this page of 28 — 6 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/5] perf tools: Few fixes Jiri Olsa <jolsa@kernel.org> - 2017-02-17 15:10 +0100
    [PATCH 3/5] perf tools: Fail on using multiple bits long terms without value Jiri Olsa <jolsa@kernel.org> - 2017-02-17 15:10 +0100
      [tip:perf/urgent] perf tools: Fail on using multiple bits long  terms without value tip-bot for Jiri Olsa <tipbot@zytor.com> - 2017-02-21 09:20 +0100
    [PATCH 5/5] perf record: Add -a as a default target Jiri Olsa <jolsa@kernel.org> - 2017-02-17 15:10 +0100
      Re: [PATCH 5/5] perf record: Add -a as a default target Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-17 15:30 +0100
        Re: [PATCH 5/5] perf record: Add -a as a default target Jiri Olsa <jolsa@redhat.com> - 2017-02-17 18:10 +0100
          [tip:perf/urgent] perf record: Add -a as default target tip-bot for Jiri Olsa <tipbot@zytor.com> - 2017-02-21 09:20 +0100
    [PATCH 4/5] perf stat: Add -a as a default target Jiri Olsa <jolsa@kernel.org> - 2017-02-17 15:10 +0100
      Re: [PATCH 4/5] perf stat: Add -a as a default target Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-17 15:30 +0100
        Re: [PATCH 4/5] perf stat: Add -a as a default target Jiri Olsa <jolsa@redhat.com> - 2017-02-17 15:40 +0100
          Re: [PATCH 4/5] perf stat: Add -a as a default target Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-17 15:50 +0100
            Re: [PATCH 4/5] perf stat: Add -a as a default target Jiri Olsa <jolsa@redhat.com> - 2017-02-17 15:50 +0100
            [PATCHv2 4/5] perf stat: Add -a as a default target Jiri Olsa <jolsa@redhat.com> - 2017-02-17 18:10 +0100
              Re: [PATCHv2 4/5] perf stat: Add -a as a default target Boris Petkov <bp@alien8.de> - 2017-02-17 19:20 +0100
                Re: [PATCHv2 4/5] perf stat: Add -a as a default target Borislav Petkov <bp@alien8.de> - 2017-02-18 19:00 +0100
                  Re: [PATCHv2 4/5] perf stat: Add -a as a default target Jiri Olsa <jolsa@redhat.com> - 2017-02-20 08:20 +0100
                    Re: [PATCHv2 4/5] perf stat: Add -a as a default target Borislav Petkov <bp@alien8.de> - 2017-02-20 21:40 +0100
                      Re: [PATCHv2 4/5] perf stat: Add -a as a default target Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-20 22:30 +0100
                        Re: [PATCHv2 4/5] perf stat: Add -a as a default target Borislav Petkov <bp@alien8.de> - 2017-02-20 23:50 +0100
                          Re: [PATCHv2 4/5] perf stat: Add -a as a default target Jiri Olsa <jolsa@redhat.com> - 2017-02-21 09:00 +0100
                            Re: [PATCHv2 4/5] perf stat: Add -a as a default target Jiri Olsa <jolsa@redhat.com> - 2017-02-21 12:10 +0100
                              Re: [PATCHv2 4/5] perf stat: Add -a as a default target Borislav Petkov <bp@alien8.de> - 2017-02-21 12:30 +0100
                                Re: [PATCHv2 4/5] perf stat: Add -a as a default target Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-21 14:40 +0100
                                  Re: [PATCHv2 4/5] perf stat: Add -a as a default target Borislav Petkov <bp@alien8.de> - 2017-02-21 15:10 +0100
                                    Re: [PATCHv2 4/5] perf stat: Add -a as a default target Arnaldo Carvalho de Melo <acme@kernel.org> - 2017-02-21 15:30 +0100
              [tip:perf/urgent] perf stat: Add -a as default target tip-bot for Jiri Olsa <tipbot@zytor.com> - 2017-02-21 09:20 +0100
    [PATCH 1/5] perf build: Add special fixdep cleaning rule Jiri Olsa <jolsa@kernel.org> - 2017-02-17 15:10 +0100
      [tip:perf/urgent] perf build: Add special fixdep cleaning rule tip-bot for Jiri Olsa <tipbot@zytor.com> - 2017-02-21 09:20 +0100

Page 2 of 2 — ← Prev page 1 [2]


#1585223 — Re: [PATCHv2 4/5] perf stat: Add -a as a default target

FromJiri Olsa <jolsa@redhat.com>
Date2017-02-21 12:10 +0100
SubjectRe: [PATCHv2 4/5] perf stat: Add -a as a default target
Message-ID<tdguu-1L2-21@gated-at.bofh.it>
In reply to#1585095
On Tue, Feb 21, 2017 at 08:54:37AM +0100, Jiri Olsa wrote:
> On Mon, Feb 20, 2017 at 11:47:16PM +0100, Borislav Petkov wrote:
> > On Mon, Feb 20, 2017 at 06:22:54PM -0300, Arnaldo Carvalho de Melo wrote:
> > > Well, this one should be read (and written in the tool output as):
> > > 
> > > <not supported in workload only mode, try system wide, using -a>
> > 
> > Do you want to change that CNTR_NOT_SUPPORTED string unconditionally to
> > something like above?
> > 
> > Because perf_evsel.supported seems like it means that counter is not
> > supported but not necessarily only because of the missing -a for an
> > uncore event, AFAICT. I could be wrong.
> > 
> > > Right, the ENOTSUPP in this case needs to be properly expanded into
> > > something meaningful, as suggested above.
> > 
> > I dumped errno in __run_perf_stat():
> > 
> > ./perf stat -v -e amd_nb/event=0xe0,umask=0x1f/ sleep 1
> > Using CPUID AuthenticAMD-21-2
> > Warning:
> > amd_nb/event=0xe0,umask=0x1f/ event is not supported by the kernel: 22.
> > 
> > It is -EINVAL and the syscall returns -EINVAL in bunch of places so I'm
> > guessing this might not be a good way to match the retval to the proper
> > error message.
> > 
> > Peterz said something about scanning all events supplied by -e and if
> > all are uncore, to set -a automatically. Can we do that?
> 
> right, so that's different from what we actually did.. ;-)
> 
> I'll check on this one.. might not be as straight forward,
> because some uncore events might have already cpumask limit

could you please test this change?

thanks,
jirka


---
diff --git a/tools/perf/arch/x86/util/pmu.c b/tools/perf/arch/x86/util/pmu.c
index 79fe07158d00..424055bf32c9 100644
--- a/tools/perf/arch/x86/util/pmu.c
+++ b/tools/perf/arch/x86/util/pmu.c
@@ -14,5 +14,6 @@ struct perf_event_attr *perf_pmu__get_default_config(struct perf_pmu *pmu __mayb
 	if (!strcmp(pmu->name, INTEL_BTS_PMU_NAME))
 		pmu->selectable = true;
 #endif
+	pmu->system_wide = strcmp(pmu->name, "cpu");
 	return NULL;
 }
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 13b54999ad79..e924d56f3232 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -2339,6 +2339,27 @@ static int __cmd_report(int argc, const char **argv)
 	return 0;
 }
 
+static void setup_system_wide(int argc)
+{
+	/*
+	 * Make system wide (-a) the default target
+	 * or change the target to system_wide if
+	 * all the counters are system_ wide.
+	 */
+	if (!argc && target__none(&target))
+		target.system_wide = true;
+	else {
+		struct perf_evsel *counter;
+
+		evlist__for_each_entry(evsel_list, counter) {
+			if (!counter->system_wide)
+				return;
+		}
+
+		target.system_wide = true;
+	}
+}
+
 int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)
 {
 	const char * const stat_usage[] = {
@@ -2445,9 +2466,7 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)
 	} else if (big_num_opt == 0) /* User passed --no-big-num */
 		big_num = false;
 
-	/* Make system wide (-a) the default target. */
-	if (!argc && target__none(&target))
-		target.system_wide = true;
+	setup_system_wide(argc);
 
 	if (run_count < 0) {
 		pr_err("Run count must be a positive number\n");
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index 67a8aebc67ab..8b06b21f1bbc 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -1254,6 +1254,7 @@ int parse_events_add_pmu(struct parse_events_evlist *data,
 		evsel->scale = info.scale;
 		evsel->per_pkg = info.per_pkg;
 		evsel->snapshot = info.snapshot;
+		evsel->system_wide = pmu->system_wide;
 	}
 
 	return evsel ? 0 : -ENOMEM;
diff --git a/tools/perf/util/pmu.h b/tools/perf/util/pmu.h
index 00852ddc7741..0ce3ffacbf92 100644
--- a/tools/perf/util/pmu.h
+++ b/tools/perf/util/pmu.h
@@ -21,6 +21,7 @@ struct perf_pmu {
 	char *name;
 	__u32 type;
 	bool selectable;
+	bool system_wide;
 	struct perf_event_attr *default_config;
 	struct cpu_map *cpus;
 	struct list_head format;  /* HEAD struct perf_pmu_format -> list */

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


#1585237 — Re: [PATCHv2 4/5] perf stat: Add -a as a default target

FromBorislav Petkov <bp@alien8.de>
Date2017-02-21 12:30 +0100
SubjectRe: [PATCHv2 4/5] perf stat: Add -a as a default target
Message-ID<tdgNQ-1UC-13@gated-at.bofh.it>
In reply to#1585223
On Tue, Feb 21, 2017 at 12:04:51PM +0100, Jiri Olsa wrote:
> could you please test this change?

LGTM, thanks!

$ ./perf stat -v -e amd_nb/event=0xe0,umask=0x1f/ sleep 1
Using CPUID AuthenticAMD-21-2
amd_nb/event=0xe0,umask=0x1f/: 249356 1002053637 1002053637

 Performance counter stats for 'system wide':

           249,356      amd_nb/event=0xe0,umask=0x1f/

       1.002080419 seconds time elapsed

$ ./perf stat -v -e amd_nb/event=0xe0,umask=0x1f/,cycles sleep 1
Using CPUID AuthenticAMD-21-2
Warning:
amd_nb/event=0xe0,umask=0x1f/ event is not supported by the kernel.
failed to read counter amd_nb/event=0xe0,umask=0x1f/
amd_nb/event=0xe0,umask=0x1f/: 0 0 0
cycles: 1223719 815034 815034

 Performance counter stats for 'sleep 1':

   <not supported>      amd_nb/event=0xe0,umask=0x1f/
         1,223,719      cycles

       1.001679931 seconds time elapsed

$ ./perf stat -v -e amd_nb/event=0xe0,umask=0x1f/,amd_nb/event=0xe1,umask=0x3/ sleep 1
Using CPUID AuthenticAMD-21-2
amd_nb/event=0xe0,umask=0x1f/: 262994 1001697720 1001697720
amd_nb/event=0xe1,umask=0x3/: 0 1001701216 1001701216

 Performance counter stats for 'system wide':

           262,994      amd_nb/event=0xe0,umask=0x1f
                 0      amd_nb/event=0xe1,umask=0x3/

       1.001718951 seconds time elapsed

$ ./perf stat -v -e amd_nb/event=0xe0,umask=0x1f/,amd_nb/event=0xe1,umask=0x3/,amd_nb/event=0xe2,umask=0x3/ sleep 1
Using CPUID AuthenticAMD-21-2
amd_nb/event=0xe0,umask=0x1f/: 203936 1001654831 1001654831
amd_nb/event=0xe1,umask=0x3/: 0 1001657636 1001657636
amd_nb/event=0xe2,umask=0x3/: 988016 1001657991 1001657991

 Performance counter stats for 'system wide':

           203,936      amd_nb/event=0xe0,umask=0x1f/
                 0      amd_nb/event=0xe1,umask=0x3/
           988,016      amd_nb/event=0xe2,umask=0x3/

       1.001681434 seconds time elapsed

$ ./perf stat -v -a -e amd_nb/event=0xe0,umask=0x1f/,amd_nb/event=0xe1,umask=0x3/,amd_nb/event=0xe2,umask=0x3/,cycles sleep 1
Using CPUID AuthenticAMD-21-2
amd_nb/event=0xe0,umask=0x1f/: 365803 1001738673 1001738673
amd_nb/event=0xe1,umask=0x3/: 0 1001736790 1001736790
amd_nb/event=0xe2,umask=0x3/: 1884159 1001731876 1001731876
cycles: 156820391 8014227609 8014227609

 Performance counter stats for 'system wide':

           365,803      amd_nb/event=0xe0,umask=0x1f/
                 0      amd_nb/event=0xe1,umask=0x3/
         1,884,159      amd_nb/event=0xe2,umask=0x3/
       156,820,391      cycles

       1.001963906 seconds time elapsed

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

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


#1585337 — Re: [PATCHv2 4/5] perf stat: Add -a as a default target

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2017-02-21 14:40 +0100
SubjectRe: [PATCHv2 4/5] perf stat: Add -a as a default target
Message-ID<tdiPE-3ak-17@gated-at.bofh.it>
In reply to#1585237
Em Tue, Feb 21, 2017 at 12:20:28PM +0100, Borislav Petkov escreveu:
> On Tue, Feb 21, 2017 at 12:04:51PM +0100, Jiri Olsa wrote:
> > could you please test this change?
> 
> LGTM, thanks!

Only one remark about a misleading warning, that is not a warning, is an
error, as its mere presence prevents what was asked for from being
performed.
 
> $ ./perf stat -v -e amd_nb/event=0xe0,umask=0x1f/ sleep 1
> Using CPUID AuthenticAMD-21-2
> amd_nb/event=0xe0,umask=0x1f/: 249356 1002053637 1002053637
> 
>  Performance counter stats for 'system wide':
> 
>            249,356      amd_nb/event=0xe0,umask=0x1f/
> 
>        1.002080419 seconds time elapsed
> 
> $ ./perf stat -v -e amd_nb/event=0xe0,umask=0x1f/,cycles sleep 1
> Using CPUID AuthenticAMD-21-2
> Warning:
  ^^^^^^^
  ^^^^^^^
  Error:
  ^^^^^^^
  ^^^^^^^
> amd_nb/event=0xe0,umask=0x1f/ event is not supported by the kernel.
                                                                     in system wide mode.
                                                                     ^^^^^^^^^^^^^^^^^^^^
                                                                     ^^^^^^^^^^^^^^^^^^^^
                                                                     ^^^^^^^^^^^^^^^^^^^^

It _is_ supported by the kernel, and by the hardware, its just that it
is not supported in system wide mode, that BTW, in the case above, the
user doesn't even asked for (-a wasn't in the command line).

> failed to read counter amd_nb/event=0xe0,umask=0x1f/
> amd_nb/event=0xe0,umask=0x1f/: 0 0 0
> cycles: 1223719 815034 815034
> 
>  Performance counter stats for 'sleep 1':
> 
>    <not supported>      amd_nb/event=0xe0,umask=0x1f/
>          1,223,719      cycles
> 
>        1.001679931 seconds time elapsed
> 
> $ ./perf stat -v -e amd_nb/event=0xe0,umask=0x1f/,amd_nb/event=0xe1,umask=0x3/ sleep 1
> Using CPUID AuthenticAMD-21-2
> amd_nb/event=0xe0,umask=0x1f/: 262994 1001697720 1001697720
> amd_nb/event=0xe1,umask=0x3/: 0 1001701216 1001701216
> 
>  Performance counter stats for 'system wide':
> 
>            262,994      amd_nb/event=0xe0,umask=0x1f
>                  0      amd_nb/event=0xe1,umask=0x3/
> 
>        1.001718951 seconds time elapsed
> 
> $ ./perf stat -v -e amd_nb/event=0xe0,umask=0x1f/,amd_nb/event=0xe1,umask=0x3/,amd_nb/event=0xe2,umask=0x3/ sleep 1
> Using CPUID AuthenticAMD-21-2
> amd_nb/event=0xe0,umask=0x1f/: 203936 1001654831 1001654831
> amd_nb/event=0xe1,umask=0x3/: 0 1001657636 1001657636
> amd_nb/event=0xe2,umask=0x3/: 988016 1001657991 1001657991
> 
>  Performance counter stats for 'system wide':
> 
>            203,936      amd_nb/event=0xe0,umask=0x1f/
>                  0      amd_nb/event=0xe1,umask=0x3/
>            988,016      amd_nb/event=0xe2,umask=0x3/
> 
>        1.001681434 seconds time elapsed
> 
> $ ./perf stat -v -a -e amd_nb/event=0xe0,umask=0x1f/,amd_nb/event=0xe1,umask=0x3/,amd_nb/event=0xe2,umask=0x3/,cycles sleep 1
> Using CPUID AuthenticAMD-21-2
> amd_nb/event=0xe0,umask=0x1f/: 365803 1001738673 1001738673
> amd_nb/event=0xe1,umask=0x3/: 0 1001736790 1001736790
> amd_nb/event=0xe2,umask=0x3/: 1884159 1001731876 1001731876
> cycles: 156820391 8014227609 8014227609
> 
>  Performance counter stats for 'system wide':
> 
>            365,803      amd_nb/event=0xe0,umask=0x1f/
>                  0      amd_nb/event=0xe1,umask=0x3/
>          1,884,159      amd_nb/event=0xe2,umask=0x3/
>        156,820,391      cycles
> 
>        1.001963906 seconds time elapsed
> 
> -- 
> Regards/Gruss,
>     Boris.
> 
> Good mailing practices for 400: avoid top-posting and trim the reply.

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


#1585361 — Re: [PATCHv2 4/5] perf stat: Add -a as a default target

FromBorislav Petkov <bp@alien8.de>
Date2017-02-21 15:10 +0100
SubjectRe: [PATCHv2 4/5] perf stat: Add -a as a default target
Message-ID<tdjiG-3At-23@gated-at.bofh.it>
In reply to#1585337
On Tue, Feb 21, 2017 at 10:34:26AM -0300, Arnaldo Carvalho de Melo wrote:
> It _is_ supported by the kernel, and by the hardware, its just that it
> is not supported in system wide mode, that BTW, in the case above, the
> user doesn't even asked for (-a wasn't in the command line).

Well, that warning is issued for a bunch of errno's. Lumping them all
together is probably not what you want.

Also, EINVAL for example, as I noted earlier, can be issued for a
variety of conditions...

-- 
Regards/Gruss,
    Boris.

Good mailing practices for 400: avoid top-posting and trim the reply.

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


#1585376 — Re: [PATCHv2 4/5] perf stat: Add -a as a default target

FromArnaldo Carvalho de Melo <acme@kernel.org>
Date2017-02-21 15:30 +0100
SubjectRe: [PATCHv2 4/5] perf stat: Add -a as a default target
Message-ID<tdjC2-3LX-13@gated-at.bofh.it>
In reply to#1585361
Em Tue, Feb 21, 2017 at 03:05:44PM +0100, Borislav Petkov escreveu:
> On Tue, Feb 21, 2017 at 10:34:26AM -0300, Arnaldo Carvalho de Melo wrote:
> > It _is_ supported by the kernel, and by the hardware, its just that it
> > is not supported in system wide mode, that BTW, in the case above, the
> > user doesn't even asked for (-a wasn't in the command line).
> 
> Well, that warning is issued for a bunch of errno's. Lumping them all
> together is probably not what you want.
> 
> Also, EINVAL for example, as I noted earlier, can be issued for a
> variety of conditions...

That is well understood, but it doesn't prevents us from trying to, with
the context in mind, disambiguate that value into meaningful messages,
that ends up being possible to a great degree, see, for instance:

  perf_evsel__open_strerror()

It will take the errno and internal evsel state to try to provide a
better error message. So, if it is a uncore event and it the error
when trying to open it is EINVAL and it evsel->system_wide is not set...

- Arnaldo

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


#1585116 — [tip:perf/urgent] perf stat: Add -a as default target

Fromtip-bot for Jiri Olsa <tipbot@zytor.com>
Date2017-02-21 09:20 +0100
Subject[tip:perf/urgent] perf stat: Add -a as default target
Message-ID<tddPZ-8nM-39@gated-at.bofh.it>
In reply to#1583596
Commit-ID:  0d79f8b93187c771b6971acfaba67f4e2f1e0710
Gitweb:     http://git.kernel.org/tip/0d79f8b93187c771b6971acfaba67f4e2f1e0710
Author:     Jiri Olsa <jolsa@redhat.com>
AuthorDate: Fri, 17 Feb 2017 18:00:34 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 17 Feb 2017 17:31:10 -0300

perf stat: Add -a as default target

Boris asked for default -a option in case we monitor only uncore events.

While implementing that I thought it might be actually useful to make it
overall default.

Running 'perf stat' will now collect system wide data.

Committer note:

Testing it:

  # perf stat
  ^C
   Performance counter stats for 'system wide':

         3571.559178      cpu-clock (msec)          #    4.000 CPUs utilized
               3,346      context-switches          #    0.937 K/sec
                 277      cpu-migrations            #    0.078 K/sec
              57,271      page-faults               #    0.016 M/sec
       4,535,633,835      cycles                    #    1.270 GHz
       6,389,736,516      instructions              #    1.41  insn per cycle
       1,541,293,875      branches                  #  431.547 M/sec
          14,526,396      branch-misses             #    0.94% of all branches

         0.892950118 seconds time elapsed

  #

Requested-and-Acked-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20170217170034.GB15389@krava
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/Documentation/perf-stat.txt | 2 +-
 tools/perf/builtin-stat.c              | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/perf/Documentation/perf-stat.txt b/tools/perf/Documentation/perf-stat.txt
index d96ccd4..aecf2a8 100644
--- a/tools/perf/Documentation/perf-stat.txt
+++ b/tools/perf/Documentation/perf-stat.txt
@@ -63,7 +63,7 @@ report::
 
 -a::
 --all-cpus::
-        system-wide collection from all CPUs
+        system-wide collection from all CPUs (default if no target is specified)
 
 -c::
 --scale::
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index ca27a8a..9989b03 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -2445,8 +2445,9 @@ int cmd_stat(int argc, const char **argv, const char *prefix __maybe_unused)
 	} else if (big_num_opt == 0) /* User passed --no-big-num */
 		big_num = false;
 
+	/* Make system wide (-a) the default target. */
 	if (!argc && target__none(&target))
-		usage_with_options(stat_usage, stat_options);
+		target.system_wide = true;
 
 	if (run_count < 0) {
 		pr_err("Run count must be a positive number\n");

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


#1583433 — [PATCH 1/5] perf build: Add special fixdep cleaning rule

FromJiri Olsa <jolsa@kernel.org>
Date2017-02-17 15:10 +0100
Subject[PATCH 1/5] perf build: Add special fixdep cleaning rule
Message-ID<tbRov-5iA-29@gated-at.bofh.it>
In reply to#1583425
From: Jiri Olsa <jolsa@redhat.com>

Ingo reported following build failure:

On Sat, Feb 11, 2017 at 12:12:34PM +0100, Ingo Molnar wrote:
>
> So I had this oldish 32-bit 15.10 Ubuntu installation around (fully updated), and
> trying to build perf gave me:
>
> deimos:~/tip/tools/perf> make
>   BUILD:   Doing 'make -j4' parallel build
> make[3]: *** No rule to make target '/usr/include/x86_64-linux-gnu/sys/types.h', needed by 'fixdep.o'.  Stop.
> Makefile:42: recipe for target 'fixdep-in.o' failed
> make[2]: *** [fixdep-in.o] Error 2
> /home/mingo/tip/tools/build/Makefile.include:4: recipe for target 'fixdep' failed
> make[1]: *** [fixdep] Error 2
> Makefile:68: recipe for target 'all' failed
> make: *** [all] Error 2
>
> Now this got a bit better after I did a 'make mrproper' in the kernel tree:
>
> deimos:~/tip/tools/perf> make
>   BUILD:   Doing 'make -j4' parallel build
>   HOSTCC   fixdep.o
> /home/mingo/tip/tools/build/fixdep: 1: /home/mingo/tip/tools/build/fixdep: Syntax error: "(" unexpected
> /home/mingo/tip/tools/build/Makefile.build:101: recipe for target 'fixdep.o' failed
> make[3]: *** [fixdep.o] Error 2
> Makefile:42: recipe for target 'fixdep-in.o' failed
> make[2]: *** [fixdep-in.o] Error 2
> /home/mingo/tip/tools/build/Makefile.include:4: recipe for target 'fixdep' failed
> make[1]: *** [fixdep] Error 2
> Makefile:68: recipe for target 'all' failed
> make: *** [all] Error 2
>
> After some digging it turns out that my 'fixdep' binary was 64-bit:
>
> deimos:~/tip/tools/perf> file /home/mingo/tip/tools/build/fixdep
> /home/mingo/tip/tools/build/fixdep: ELF 64-bit LSB executable, x86-64, version 1
> (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux
> 2.6.32, BuildID[sha1]=d527f736b57b5ba47210fbcb562a3b52867d21c1, not stripped
>
> But it did not get cleaned out by 'make clean'.
>
> Only after I did a 'make clean' in tools/ itself, did it get built properly.

It shows we don't clean up properly the fixdep objects,
so adding special rule for that.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-0u41aa6z3t2vtodya7h3nom2@git.kernel.org
---
 tools/build/Makefile         | 4 ++--
 tools/build/Makefile.include | 3 +++
 tools/perf/Makefile.perf     | 4 ++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/build/Makefile b/tools/build/Makefile
index aaf7ed329a45..477f00eda591 100644
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -35,8 +35,8 @@ all: $(OUTPUT)fixdep
 
 clean:
 	$(call QUIET_CLEAN, fixdep)
-	$(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
-	$(Q)rm -f fixdep
+	$(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
+	$(Q)rm -f $(OUTPUT)fixdep
 
 $(OUTPUT)fixdep-in.o: FORCE
 	$(Q)$(MAKE) $(build)=fixdep
diff --git a/tools/build/Makefile.include b/tools/build/Makefile.include
index ad22e4e7bc59..d360f39a445b 100644
--- a/tools/build/Makefile.include
+++ b/tools/build/Makefile.include
@@ -3,4 +3,7 @@ build := -f $(srctree)/tools/build/Makefile.build dir=. obj
 fixdep:
 	$(Q)$(MAKE) -C $(srctree)/tools/build CFLAGS= LDFLAGS= $(OUTPUT)fixdep
 
+fixdep-clean:
+	$(Q)$(MAKE) -C $(srctree)/tools/build clean
+
 .PHONY: fixdep
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 4da19b6ba94a..79fe31f20a17 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -726,13 +726,13 @@ config-clean:
 	$(call QUIET_CLEAN, config)
 	$(Q)$(MAKE) -C $(srctree)/tools/build/feature/ $(if $(OUTPUT),OUTPUT=$(OUTPUT)feature/,) clean >/dev/null
 
-clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean config-clean
+clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean config-clean fixdep-clean
 	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(LANG_BINDINGS)
 	$(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
 	$(Q)$(RM) $(OUTPUT).config-detected
 	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32 $(OUTPUT)pmu-events/jevents $(OUTPUT)$(LIBJVMTI).so
 	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \
-		$(OUTPUT)util/intel-pt-decoder/inat-tables.c $(OUTPUT)fixdep \
+		$(OUTPUT)util/intel-pt-decoder/inat-tables.c \
 		$(OUTPUT)tests/llvm-src-{base,kbuild,prologue,relocation}.c \
 		$(OUTPUT)pmu-events/pmu-events.c
 	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean
-- 
2.7.4

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


#1585113 — [tip:perf/urgent] perf build: Add special fixdep cleaning rule

Fromtip-bot for Jiri Olsa <tipbot@zytor.com>
Date2017-02-21 09:20 +0100
Subject[tip:perf/urgent] perf build: Add special fixdep cleaning rule
Message-ID<tddPZ-8nM-29@gated-at.bofh.it>
In reply to#1583433
Commit-ID:  85e0d509654c2e2e58b29e50a883acd4c4e8807d
Gitweb:     http://git.kernel.org/tip/85e0d509654c2e2e58b29e50a883acd4c4e8807d
Author:     Jiri Olsa <jolsa@redhat.com>
AuthorDate: Fri, 17 Feb 2017 15:00:54 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Fri, 17 Feb 2017 16:04:38 -0300

perf build: Add special fixdep cleaning rule

Ingo reported following build failure:

On Sat, Feb 11, 2017 at 12:12:34PM +0100, Ingo Molnar wrote:
>
> So I had this oldish 32-bit 15.10 Ubuntu installation around (fully updated), and
> trying to build perf gave me:
>
> deimos:~/tip/tools/perf> make
>   BUILD:   Doing 'make -j4' parallel build
> make[3]: *** No rule to make target '/usr/include/x86_64-linux-gnu/sys/types.h', needed by 'fixdep.o'.  Stop.
> Makefile:42: recipe for target 'fixdep-in.o' failed
> make[2]: *** [fixdep-in.o] Error 2
> /home/mingo/tip/tools/build/Makefile.include:4: recipe for target 'fixdep' failed
> make[1]: *** [fixdep] Error 2
> Makefile:68: recipe for target 'all' failed
> make: *** [all] Error 2
>
> Now this got a bit better after I did a 'make mrproper' in the kernel tree:
>
> deimos:~/tip/tools/perf> make
>   BUILD:   Doing 'make -j4' parallel build
>   HOSTCC   fixdep.o
> /home/mingo/tip/tools/build/fixdep: 1: /home/mingo/tip/tools/build/fixdep: Syntax error: "(" unexpected
> /home/mingo/tip/tools/build/Makefile.build:101: recipe for target 'fixdep.o' failed
> make[3]: *** [fixdep.o] Error 2
> Makefile:42: recipe for target 'fixdep-in.o' failed
> make[2]: *** [fixdep-in.o] Error 2
> /home/mingo/tip/tools/build/Makefile.include:4: recipe for target 'fixdep' failed
> make[1]: *** [fixdep] Error 2
> Makefile:68: recipe for target 'all' failed
> make: *** [all] Error 2
>
> After some digging it turns out that my 'fixdep' binary was 64-bit:
>
> deimos:~/tip/tools/perf> file /home/mingo/tip/tools/build/fixdep
> /home/mingo/tip/tools/build/fixdep: ELF 64-bit LSB executable, x86-64, version 1
> (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux
> 2.6.32, BuildID[sha1]=d527f736b57b5ba47210fbcb562a3b52867d21c1, not stripped
>
> But it did not get cleaned out by 'make clean'.
>
> Only after I did a 'make clean' in tools/ itself, did it get built properly.

It shows we don't clean up properly the fixdep objects, so adding
special rule for that.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Reported-by: Ingo Molnar <mingo@kernel.org>
Cc: David Ahern <dsahern@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/1487340058-10496-2-git-send-email-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/build/Makefile         | 4 ++--
 tools/build/Makefile.include | 3 +++
 tools/perf/Makefile.perf     | 4 ++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/tools/build/Makefile b/tools/build/Makefile
index aaf7ed3..477f00e 100644
--- a/tools/build/Makefile
+++ b/tools/build/Makefile
@@ -35,8 +35,8 @@ all: $(OUTPUT)fixdep
 
 clean:
 	$(call QUIET_CLEAN, fixdep)
-	$(Q)find . -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
-	$(Q)rm -f fixdep
+	$(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
+	$(Q)rm -f $(OUTPUT)fixdep
 
 $(OUTPUT)fixdep-in.o: FORCE
 	$(Q)$(MAKE) $(build)=fixdep
diff --git a/tools/build/Makefile.include b/tools/build/Makefile.include
index ad22e4e..d360f39a4 100644
--- a/tools/build/Makefile.include
+++ b/tools/build/Makefile.include
@@ -3,4 +3,7 @@ build := -f $(srctree)/tools/build/Makefile.build dir=. obj
 fixdep:
 	$(Q)$(MAKE) -C $(srctree)/tools/build CFLAGS= LDFLAGS= $(OUTPUT)fixdep
 
+fixdep-clean:
+	$(Q)$(MAKE) -C $(srctree)/tools/build clean
+
 .PHONY: fixdep
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 4da19b6..79fe31f 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -726,13 +726,13 @@ config-clean:
 	$(call QUIET_CLEAN, config)
 	$(Q)$(MAKE) -C $(srctree)/tools/build/feature/ $(if $(OUTPUT),OUTPUT=$(OUTPUT)feature/,) clean >/dev/null
 
-clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean config-clean
+clean:: $(LIBTRACEEVENT)-clean $(LIBAPI)-clean $(LIBBPF)-clean $(LIBSUBCMD)-clean config-clean fixdep-clean
 	$(call QUIET_CLEAN, core-objs)  $(RM) $(LIB_FILE) $(OUTPUT)perf-archive $(OUTPUT)perf-with-kcore $(LANG_BINDINGS)
 	$(Q)find $(if $(OUTPUT),$(OUTPUT),.) -name '*.o' -delete -o -name '\.*.cmd' -delete -o -name '\.*.d' -delete
 	$(Q)$(RM) $(OUTPUT).config-detected
 	$(call QUIET_CLEAN, core-progs) $(RM) $(ALL_PROGRAMS) perf perf-read-vdso32 perf-read-vdsox32 $(OUTPUT)pmu-events/jevents $(OUTPUT)$(LIBJVMTI).so
 	$(call QUIET_CLEAN, core-gen)   $(RM)  *.spec *.pyc *.pyo */*.pyc */*.pyo $(OUTPUT)common-cmds.h TAGS tags cscope* $(OUTPUT)PERF-VERSION-FILE $(OUTPUT)FEATURE-DUMP $(OUTPUT)util/*-bison* $(OUTPUT)util/*-flex* \
-		$(OUTPUT)util/intel-pt-decoder/inat-tables.c $(OUTPUT)fixdep \
+		$(OUTPUT)util/intel-pt-decoder/inat-tables.c \
 		$(OUTPUT)tests/llvm-src-{base,kbuild,prologue,relocation}.c \
 		$(OUTPUT)pmu-events/pmu-events.c
 	$(QUIET_SUBDIR0)Documentation $(QUIET_SUBDIR1) clean

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | linux.kernel


csiph-web