All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] Increase MAX_NR_CPUS and MAX_CACHES
@ 2019-06-20 19:36 Kyle Meyer
  2019-06-24 18:50 ` Arnaldo Carvalho de Melo
  2019-07-03 14:03 ` [tip:perf/core] perf tools: " tip-bot for Kyle Meyer
  0 siblings, 2 replies; 4+ messages in thread
From: Kyle Meyer @ 2019-06-20 19:36 UTC (permalink / raw)
  Cc: Kyle Meyer, Peter Zijlstra, Ingo Molnar,
	Arnaldo Carvalho de Melo, Alexander Shishkin, Jiri Olsa,
	Namhyung Kim, linux-kernel

From: Kyle Meyer <kyle.meyer@hpe.com>

Attempting to profile 1024 or more CPUs with perf causes two errors:

perf record -a
[ perf record: Woken up X times to write data ]
way too many cpu caches..
[ perf record: Captured and wrote X MB perf.data (X samples) ]

perf report -C 1024
Error: failed to set  cpu bitmap
Requested CPU 1024 too large. Consider raising MAX_NR_CPUS

Increasing MAX_NR_CPUS from 1024 to 2048 and redefining MAX_CACHES as
MAX_NR_CPUS * 4 returns normal functionality to perf:

perf record -a
[ perf record: Woken up X times to write data ]
[ perf record: Captured and wrote X MB perf.data (X samples) ]

perf report -C 1024
...

Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Kyle Meyer <kyle.meyer@hpe.com>
---
 samples/bpf/map_perf_test_kern.c | 2 +-
 samples/bpf/map_perf_test_user.c | 2 +-
 tools/perf/perf.h                | 2 +-
 tools/perf/util/header.c         | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/samples/bpf/map_perf_test_kern.c b/samples/bpf/map_perf_test_kern.c
index 2b2ffb97018b..342738a1e386 100644
--- a/samples/bpf/map_perf_test_kern.c
+++ b/samples/bpf/map_perf_test_kern.c
@@ -11,7 +11,7 @@
 #include "bpf_helpers.h"
 
 #define MAX_ENTRIES 1000
-#define MAX_NR_CPUS 1024
+#define MAX_NR_CPUS 2048
 
 struct bpf_map_def SEC("maps") hash_map = {
 	.type = BPF_MAP_TYPE_HASH,
diff --git a/samples/bpf/map_perf_test_user.c b/samples/bpf/map_perf_test_user.c
index fe5564bff39b..da3c101ca776 100644
--- a/samples/bpf/map_perf_test_user.c
+++ b/samples/bpf/map_perf_test_user.c
@@ -22,7 +22,7 @@
 #include "bpf_load.h"
 
 #define TEST_BIT(t) (1U << (t))
-#define MAX_NR_CPUS 1024
+#define MAX_NR_CPUS 2048
 
 static __u64 time_get_ns(void)
 {
diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 711e009381ec..74d0124d38f3 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -26,7 +26,7 @@ static inline unsigned long long rdclock(void)
 }
 
 #ifndef MAX_NR_CPUS
-#define MAX_NR_CPUS			1024
+#define MAX_NR_CPUS			2048
 #endif
 
 extern const char *input_name;
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 06ddb6618ef3..abc9c2145efe 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1121,7 +1121,7 @@ static int build_caches(struct cpu_cache_level caches[], u32 size, u32 *cntp)
 	return 0;
 }
 
-#define MAX_CACHES 2000
+#define MAX_CACHES (MAX_NR_CPUS * 4)
 
 static int write_cache(struct feat_fd *ff,
 		       struct perf_evlist *evlist __maybe_unused)
-- 
2.12.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] Increase MAX_NR_CPUS and MAX_CACHES
  2019-06-20 19:36 [PATCH v1] Increase MAX_NR_CPUS and MAX_CACHES Kyle Meyer
@ 2019-06-24 18:50 ` Arnaldo Carvalho de Melo
  2019-06-24 19:04   ` Jiri Olsa
  2019-07-03 14:03 ` [tip:perf/core] perf tools: " tip-bot for Kyle Meyer
  1 sibling, 1 reply; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2019-06-24 18:50 UTC (permalink / raw)
  To: Kyle Meyer
  Cc: Kyle Meyer, Peter Zijlstra, Ingo Molnar, Alexander Shishkin,
	Jiri Olsa, Namhyung Kim, linux-kernel, Daniel Borkmann

Em Thu, Jun 20, 2019 at 02:36:30PM -0500, Kyle Meyer escreveu:
> From: Kyle Meyer <kyle.meyer@hpe.com>
> 
> Attempting to profile 1024 or more CPUs with perf causes two errors:
> 
> perf record -a
> [ perf record: Woken up X times to write data ]
> way too many cpu caches..
> [ perf record: Captured and wrote X MB perf.data (X samples) ]
> 
> perf report -C 1024
> Error: failed to set  cpu bitmap
> Requested CPU 1024 too large. Consider raising MAX_NR_CPUS
> 
> Increasing MAX_NR_CPUS from 1024 to 2048 and redefining MAX_CACHES as
> MAX_NR_CPUS * 4 returns normal functionality to perf:
> 
> perf record -a
> [ perf record: Woken up X times to write data ]
> [ perf record: Captured and wrote X MB perf.data (X samples) ]
> 
> perf report -C 1024

So, I'm applying the tools/perf/ part, leaving the rest for Daniel do
consider, ok?

- Arnaldo

> ...
> 
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
> Cc: Jiri Olsa <jolsa@redhat.com>
> Cc: Namhyung Kim <namhyung@kernel.org>
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Kyle Meyer <kyle.meyer@hpe.com>
> ---
>  samples/bpf/map_perf_test_kern.c | 2 +-
>  samples/bpf/map_perf_test_user.c | 2 +-
>  tools/perf/perf.h                | 2 +-
>  tools/perf/util/header.c         | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/samples/bpf/map_perf_test_kern.c b/samples/bpf/map_perf_test_kern.c
> index 2b2ffb97018b..342738a1e386 100644
> --- a/samples/bpf/map_perf_test_kern.c
> +++ b/samples/bpf/map_perf_test_kern.c
> @@ -11,7 +11,7 @@
>  #include "bpf_helpers.h"
>  
>  #define MAX_ENTRIES 1000
> -#define MAX_NR_CPUS 1024
> +#define MAX_NR_CPUS 2048
>  
>  struct bpf_map_def SEC("maps") hash_map = {
>  	.type = BPF_MAP_TYPE_HASH,
> diff --git a/samples/bpf/map_perf_test_user.c b/samples/bpf/map_perf_test_user.c
> index fe5564bff39b..da3c101ca776 100644
> --- a/samples/bpf/map_perf_test_user.c
> +++ b/samples/bpf/map_perf_test_user.c
> @@ -22,7 +22,7 @@
>  #include "bpf_load.h"
>  
>  #define TEST_BIT(t) (1U << (t))
> -#define MAX_NR_CPUS 1024
> +#define MAX_NR_CPUS 2048
>  
>  static __u64 time_get_ns(void)
>  {
> diff --git a/tools/perf/perf.h b/tools/perf/perf.h
> index 711e009381ec..74d0124d38f3 100644
> --- a/tools/perf/perf.h
> +++ b/tools/perf/perf.h
> @@ -26,7 +26,7 @@ static inline unsigned long long rdclock(void)
>  }
>  
>  #ifndef MAX_NR_CPUS
> -#define MAX_NR_CPUS			1024
> +#define MAX_NR_CPUS			2048
>  #endif
>  
>  extern const char *input_name;
> diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> index 06ddb6618ef3..abc9c2145efe 100644
> --- a/tools/perf/util/header.c
> +++ b/tools/perf/util/header.c
> @@ -1121,7 +1121,7 @@ static int build_caches(struct cpu_cache_level caches[], u32 size, u32 *cntp)
>  	return 0;
>  }
>  
> -#define MAX_CACHES 2000
> +#define MAX_CACHES (MAX_NR_CPUS * 4)
>  
>  static int write_cache(struct feat_fd *ff,
>  		       struct perf_evlist *evlist __maybe_unused)
> -- 
> 2.12.3

-- 

- Arnaldo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1] Increase MAX_NR_CPUS and MAX_CACHES
  2019-06-24 18:50 ` Arnaldo Carvalho de Melo
@ 2019-06-24 19:04   ` Jiri Olsa
  0 siblings, 0 replies; 4+ messages in thread
From: Jiri Olsa @ 2019-06-24 19:04 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Kyle Meyer, Kyle Meyer, Peter Zijlstra, Ingo Molnar,
	Alexander Shishkin, Namhyung Kim, linux-kernel, Daniel Borkmann

On Mon, Jun 24, 2019 at 03:50:58PM -0300, Arnaldo Carvalho de Melo wrote:

SNIP

> > diff --git a/samples/bpf/map_perf_test_user.c b/samples/bpf/map_perf_test_user.c
> > index fe5564bff39b..da3c101ca776 100644
> > --- a/samples/bpf/map_perf_test_user.c
> > +++ b/samples/bpf/map_perf_test_user.c
> > @@ -22,7 +22,7 @@
> >  #include "bpf_load.h"
> >  
> >  #define TEST_BIT(t) (1U << (t))
> > -#define MAX_NR_CPUS 1024
> > +#define MAX_NR_CPUS 2048
> >  
> >  static __u64 time_get_ns(void)
> >  {
> > diff --git a/tools/perf/perf.h b/tools/perf/perf.h
> > index 711e009381ec..74d0124d38f3 100644
> > --- a/tools/perf/perf.h
> > +++ b/tools/perf/perf.h
> > @@ -26,7 +26,7 @@ static inline unsigned long long rdclock(void)
> >  }
> >  
> >  #ifndef MAX_NR_CPUS
> > -#define MAX_NR_CPUS			1024
> > +#define MAX_NR_CPUS			2048
> >  #endif
> >  
> >  extern const char *input_name;
> > diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
> > index 06ddb6618ef3..abc9c2145efe 100644
> > --- a/tools/perf/util/header.c
> > +++ b/tools/perf/util/header.c
> > @@ -1121,7 +1121,7 @@ static int build_caches(struct cpu_cache_level caches[], u32 size, u32 *cntp)
> >  	return 0;
> >  }
> >  
> > -#define MAX_CACHES 2000
> > +#define MAX_CACHES (MAX_NR_CPUS * 4)

maybe we should re-do this via dynamic allocation ;-)
but for now it's ok

would be nice to have perf change separated, anyway for perf part:

Acked-by: Jiri Olsa <jolsa@kernel.org>

thanks,
jirka

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:perf/core] perf tools: Increase MAX_NR_CPUS and MAX_CACHES
  2019-06-20 19:36 [PATCH v1] Increase MAX_NR_CPUS and MAX_CACHES Kyle Meyer
  2019-06-24 18:50 ` Arnaldo Carvalho de Melo
@ 2019-07-03 14:03 ` tip-bot for Kyle Meyer
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Kyle Meyer @ 2019-07-03 14:03 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: jolsa, alexander.shishkin, linux-kernel, tglx, peterz, mingo,
	acme, namhyung, hpa, kyle.meyer

Commit-ID:  9f94c7f947e919c343b30f080285af53d0fa9902
Gitweb:     https://git.kernel.org/tip/9f94c7f947e919c343b30f080285af53d0fa9902
Author:     Kyle Meyer <kyle.meyer@hpe.com>
AuthorDate: Thu, 20 Jun 2019 14:36:30 -0500
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 25 Jun 2019 08:47:10 -0300

perf tools: Increase MAX_NR_CPUS and MAX_CACHES

Attempting to profile 1024 or more CPUs with perf causes two errors:

  perf record -a
  [ perf record: Woken up X times to write data ]
  way too many cpu caches..
  [ perf record: Captured and wrote X MB perf.data (X samples) ]

  perf report -C 1024
  Error: failed to set  cpu bitmap
  Requested CPU 1024 too large. Consider raising MAX_NR_CPUS

  Increasing MAX_NR_CPUS from 1024 to 2048 and redefining MAX_CACHES as
  MAX_NR_CPUS * 4 returns normal functionality to perf:

  perf record -a
  [ perf record: Woken up X times to write data ]
  [ perf record: Captured and wrote X MB perf.data (X samples) ]

  perf report -C 1024
  ...

Signed-off-by: Kyle Meyer <kyle.meyer@hpe.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190620193630.154025-1-meyerk@stormcage.eag.rdlabs.hpecorp.net
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/perf.h        | 2 +-
 tools/perf/util/header.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/perf.h b/tools/perf/perf.h
index 711e009381ec..74d0124d38f3 100644
--- a/tools/perf/perf.h
+++ b/tools/perf/perf.h
@@ -26,7 +26,7 @@ static inline unsigned long long rdclock(void)
 }
 
 #ifndef MAX_NR_CPUS
-#define MAX_NR_CPUS			1024
+#define MAX_NR_CPUS			2048
 #endif
 
 extern const char *input_name;
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 06ddb6618ef3..abc9c2145efe 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -1121,7 +1121,7 @@ static int build_caches(struct cpu_cache_level caches[], u32 size, u32 *cntp)
 	return 0;
 }
 
-#define MAX_CACHES 2000
+#define MAX_CACHES (MAX_NR_CPUS * 4)
 
 static int write_cache(struct feat_fd *ff,
 		       struct perf_evlist *evlist __maybe_unused)

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-07-03 14:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-20 19:36 [PATCH v1] Increase MAX_NR_CPUS and MAX_CACHES Kyle Meyer
2019-06-24 18:50 ` Arnaldo Carvalho de Melo
2019-06-24 19:04   ` Jiri Olsa
2019-07-03 14:03 ` [tip:perf/core] perf tools: " tip-bot for Kyle Meyer

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.