[tip:perf/core] perf record: Support aarch64 random socket_id assignment

2019-08-15 Thread tip-bot for Tan Xiaojun
Commit-ID:  0a4d8fb229dd78f9e0752817339e19e903b37a60
Gitweb: https://git.kernel.org/tip/0a4d8fb229dd78f9e0752817339e19e903b37a60
Author: Tan Xiaojun 
AuthorDate: Fri, 2 Aug 2019 11:48:57 +0800
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Wed, 14 Aug 2019 11:00:00 -0300

perf record: Support aarch64 random socket_id assignment

Same as in the commit 01766229533f ("perf record: Support s390 random
socket_id assignment"), aarch64 also have this problem.

Without this fix:

  [root@localhost perf]# ./perf report --header -I -v
  ...
  socket_id number is too big.You may need to upgrade the perf tool.

  # 
  # captured on: Thu Aug  1 22:58:38 2019
  # header version : 1
  ...
  # Core ID and Socket ID information is not available
  ...

With this fix:
  [root@localhost perf]# ./perf report --header -I -v
  ...
  cpumask list: 0-31
  cpumask list: 32-63
  cpumask list: 64-95
  cpumask list: 96-127

  # 
  # captured on: Thu Aug  1 22:58:38 2019
  # header version : 1
  ...
  # CPU 0: Core ID 0, Socket ID 36
  # CPU 1: Core ID 1, Socket ID 36
  ...
  # CPU 126: Core ID 126, Socket ID 8442
  # CPU 127: Core ID 127, Socket ID 8442
  ...

Signed-off-by: Tan Xiaojun 
Acked-by: Jiri Olsa 
Cc: Alexander Shishkin 
Cc: Alexey Budankov 
Cc: Kan Liang 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Cc: Song Liu 
Cc: Steven Rostedt (VMware) 
Cc: Tzvetomir Stoyanov (VMware) 
Link: 
http://lkml.kernel.org/r/1564717737-21602-1-git-send-email-tanxiao...@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/header.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index b04c2b6b28b3..1f2965a07bef 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -2252,8 +2252,10 @@ static int process_cpu_topology(struct feat_fd *ff, void 
*data __maybe_unused)
/* On s390 the socket_id number is not related to the numbers of cpus.
 * The socket_id number might be higher than the numbers of cpus.
 * This depends on the configuration.
+* AArch64 is the same.
 */
-   if (ph->env.arch && !strncmp(ph->env.arch, "s390", 4))
+   if (ph->env.arch && (!strncmp(ph->env.arch, "s390", 4)
+ || !strncmp(ph->env.arch, "aarch64", 7)))
do_core_id_test = false;
 
for (i = 0; i < (u32)cpu_nr; i++) {


[tip:perf/urgent] perf/core: Fix the perf_cpu_time_max_percent check

2017-02-24 Thread tip-bot for Tan Xiaojun
Commit-ID:  1572e45a924f254d9570093abde46430c3172e3d
Gitweb: http://git.kernel.org/tip/1572e45a924f254d9570093abde46430c3172e3d
Author: Tan Xiaojun 
AuthorDate: Thu, 23 Feb 2017 14:04:39 +0800
Committer:  Ingo Molnar 
CommitDate: Fri, 24 Feb 2017 08:56:33 +0100

perf/core: Fix the perf_cpu_time_max_percent check

Use "proc_dointvec_minmax" instead of "proc_dointvec" to check the input
value from user-space.

If not, we can set a big value and some vars will overflow like
"sysctl_perf_event_sample_rate" which will cause a lot of unexpected
problems.

Signed-off-by: Tan Xiaojun 
Signed-off-by: Peter Zijlstra (Intel) 
Cc: 
Cc: 
Cc: Alexander Shishkin 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: Thomas Gleixner 
Cc: Vince Weaver 
Link: 
http://lkml.kernel.org/r/1487829879-56237-1-git-send-email-tanxiao...@huawei.com
Signed-off-by: Ingo Molnar 
---
 kernel/events/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/events/core.c b/kernel/events/core.c
index d4e3f8d..c1c1cdf 100644
--- a/kernel/events/core.c
+++ b/kernel/events/core.c
@@ -455,7 +455,7 @@ int perf_cpu_time_max_percent_handler(struct ctl_table 
*table, int write,
void __user *buffer, size_t *lenp,
loff_t *ppos)
 {
-   int ret = proc_dointvec(table, write, buffer, lenp, ppos);
+   int ret = proc_dointvec_minmax(table, write, buffer, lenp, ppos);
 
if (ret || !write)
return ret;