Skip to contentSkip to conversation

perf/urgent fix

PATCH In review Arnaldo Carvalho de Melo 2 participants 3 messages Sep 13, 2015 – Sep 14, 2015 perf events

lore
Share & tools
lore

Arnaldo Carvalho de Melo

author maintainer
#0 lore raw

cover perf/urgent fix

Hi Ingo,

Please consider pulling,

- Arnaldo

The following changes since commit ebfb4988f0378e2ac3b4a0aa1ea20d724293f392:

perf/x86/intel: Fix constraint access (2015-09-13 09:37:10 +0200)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo

for you to fetch changes up to caa470475d9b59eeff093ae650800d34612c4379:

perf header: Fixup reading of HEADER_NRCPUS feature (2015-09-13 11:41:34 -0300)

----------------------------------------------------------------
perf/urgent fix:

User visible:

- The values of _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN (sysconf(3)) were being read from perf.data files in the inverse order they are written, fix it. (Arnaldo Carvalho de Melo)

----------------------------------------------------------------
Arnaldo Carvalho de Melo (1):
perf header: Fixup reading of HEADER_NRCPUS feature

 tools/perf/util/header.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
author maintainer
#1 lore raw

PATCH 1/1 perf header: Fixup reading of HEADER_NRCPUS feature

From: Arnaldo Carvalho de Melo <[email protected]>

The original patch introducing this header wrote the number of CPUs available and online in one order and then swapped those values when reading, fix it.

Before:

  # perf record usleep 1
  # perf report --header-only | grep 'nrcpus \(online\|avail\)'
  # nrcpus online : 4
  # nrcpus avail : 4
  # echo 0 > /sys/devices/system/cpu/cpu2/online
  # perf record usleep 1
  # perf report --header-only | grep 'nrcpus \(online\|avail\)'
  # nrcpus online : 4
  # nrcpus avail : 3
  # echo 0 > /sys/devices/system/cpu/cpu1/online
  # perf record usleep 1
  # perf report --header-only | grep 'nrcpus \(online\|avail\)'
  # nrcpus online : 4
  # nrcpus avail : 2

After the fix, bringing back the CPUs online:

  # perf report --header-only | grep 'nrcpus \(online\|avail\)'
  # nrcpus online : 2
  # nrcpus avail : 4
  # echo 1 > /sys/devices/system/cpu/cpu2/online
  # perf record usleep 1
  # perf report --header-only | grep 'nrcpus \(online\|avail\)'
  # nrcpus online : 3
  # nrcpus avail : 4
  # echo 1 > /sys/devices/system/cpu/cpu1/online
  # perf record usleep 1
  # perf report --header-only | grep 'nrcpus \(online\|avail\)'
  # nrcpus online : 4
  # nrcpus avail : 4
Cc Adrian Hunter <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc David Ahern <[email protected]>
Cc Frederic Weisbecker <[email protected]>
Cc Jiri Olsa <[email protected]>
Cc Kan Liang <[email protected]>
Cc Stephane Eranian <[email protected]>
Cc Wang Nan <[email protected]>
Fixes fbe96f29ce4b ("perf tools: Make perf.data more self-descriptive (v8)")
---
 tools/perf/util/header.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/perf/util/header.c +2 -2
index 41814547da15..fce6634aebe2 100644
@@ -1438,7 +1438,7 @@ static int process_nrcpus(struct perf_file_section *section __maybe_unused,
 	if (ph->needs_swap)
 		nr = bswap_32(nr);
 
-	ph->env.nr_cpus_online = nr;
+	ph->env.nr_cpus_avail = nr;
 
 	ret = readn(fd, &nr, sizeof(nr));
 	if (ret != sizeof(nr))
@@ -1447,7 +1447,7 @@ static int process_nrcpus(struct perf_file_section *section __maybe_unused,
 	if (ph->needs_swap)
 		nr = bswap_32(nr);
 
-	ph->env.nr_cpus_avail = nr;
+	ph->env.nr_cpus_online = nr;
 	return 0;
 }
 
Signature · 1 line
2.1.0
#2 lore raw
In reply to Arnaldo Carvalho de Melo
Quoted 27 lines · Arnaldo Carvalho de Melo

Hi Ingo,

Please consider pulling,

- Arnaldo

The following changes since commit ebfb4988f0378e2ac3b4a0aa1ea20d724293f392:

perf/x86/intel: Fix constraint access (2015-09-13 09:37:10 +0200)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux.git tags/perf-urgent-for-mingo

for you to fetch changes up to caa470475d9b59eeff093ae650800d34612c4379:

perf header: Fixup reading of HEADER_NRCPUS feature (2015-09-13 11:41:34 -0300)

----------------------------------------------------------------
perf/urgent fix:

User visible:

- The values of _SC_NPROCESSORS_CONF and _SC_NPROCESSORS_ONLN (sysconf(3)) were being read from perf.data files in the inverse order they are written, fix it. (Arnaldo Carvalho de Melo)

Quoted 8 lines

----------------------------------------------------------------
Arnaldo Carvalho de Melo (1):
perf header: Fixup reading of HEADER_NRCPUS feature

 tools/perf/util/header.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Pulled, thanks Arnaldo!

Ingo