[PATCH 11/15] tools lib api: Add mount support for fs

2015-09-02 Thread Jiri Olsa
Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs)
interface that tries to mount the filesystem in case no mount is found.

Link: http://lkml.kernel.org/n/tip-ja49vwfiq2qqkmoxx9yk2...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/lib/api/fs/fs.c | 44 +++-
 tools/lib/api/fs/fs.h | 15 +++
 2 files changed, 50 insertions(+), 9 deletions(-)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index ef16d2a83a27..bc93baf33fff 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -9,6 +9,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include "debugfs.h"
 #include "fs.h"
@@ -215,16 +216,49 @@ static const char *fs__mountpoint(int idx)
return fs__get_mountpoint(fs);
 }
 
-#define FS__MOUNTPOINT(name, idx)  \
+static const char *mount_overload(struct fs *fs)
+{
+   size_t name_len = strlen(fs->name);
+   /* "PERF_" + name + "_ENVIRONMENT" + '\0' */
+   char upper_name[5 + name_len + 12 + 1];
+
+   snprintf(upper_name, name_len, "PERF_%s_ENVIRONMENT", fs->name);
+   mem_toupper(upper_name, name_len);
+
+   return getenv(upper_name) ?: *fs->mounts;
+}
+
+static const char *fs__mount(int idx)
+{
+   struct fs *fs = &fs__entries[idx];
+   const char *mountpoint;
+
+   if (fs__mountpoint(idx))
+   return (const char *)fs->path;
+
+   mountpoint = mount_overload(fs);
+
+   if (mount(NULL, mountpoint, fs->name, 0, NULL) < 0)
+   return NULL;
+
+   return fs__check_mounts(fs) ? fs->path : NULL;
+}
+
+#define FS(name, idx)  \
 const char *name##__mountpoint(void)   \
 {  \
return fs__mountpoint(idx); \
+}  \
+   \
+const char *name##__mount(void)\
+{  \
+   return fs__mount(idx);  \
 }
 
-FS__MOUNTPOINT(sysfs,   FS__SYSFS);
-FS__MOUNTPOINT(procfs,  FS__PROCFS);
-FS__MOUNTPOINT(debugfs, FS__DEBUGFS);
-FS__MOUNTPOINT(tracefs, FS__TRACEFS);
+FS(sysfs,   FS__SYSFS);
+FS(procfs,  FS__PROCFS);
+FS(debugfs, FS__DEBUGFS);
+FS(tracefs, FS__TRACEFS);
 
 int filename__read_int(const char *filename, int *value)
 {
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
index 9013227ae0d1..a9627ea5e6ae 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -9,10 +9,17 @@
 #define PATH_MAX 4096
 #endif
 
-const char *sysfs__mountpoint(void);
-const char *procfs__mountpoint(void);
-const char *debugfs__mountpoint(void);
-const char *tracefs__mountpoint(void);
+#define FS(name)   \
+   const char *name##__mountpoint(void);   \
+   const char *name##__mount(void);
+
+FS(sysfs)
+FS(procfs)
+FS(debugfs)
+FS(tracefs)
+
+#undef FS
+
 
 int filename__read_int(const char *filename, int *value);
 int sysctl__read_int(const char *sysctl, int *value);
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] arm64: dts: add dts files for Hisilicon Hip05-D02 Development Board

2015-09-02 Thread Marc Zyngier
[Don't top-post, this is very annoying]

On 02/09/15 05:28, Ding Tianhong wrote:
> Hi,Marc:
> 
> Can you check this, I am not sure whether the GIC_CPU_MASK_SIMPLE(xx)
> is used for gic-v3, maybe we should remove it, thanks.

The binding documentation
(Documentation/devicetree/bindings/arm/gic-v3.txt) is very clear:

  The 3rd cell is the flags, encoded as follows:
bits[3:0] trigger type and level flags.
1 = edge triggered
4 = level triggered

There is no mask whatsoever, because that would restrict the interrupt
to only 32 CPUs at most.

So please remove this, this is just wrong.

Thanks,

M.

> Ding
> 
> On 2015/8/31 21:44, Ding Tianhong wrote:
>> On 2015/8/31 21:12, Leo Yan wrote:
>>> On Sat, Aug 29, 2015 at 04:52:41PM +0800, Ding Tianhong wrote:
 Add initial dtsi file to support Hisilicon Hip05-D02 Board with
 support of CPUs in four clusters and each cluster has quard Cortex-A57.

 Also add dts file to support Hip05-D02 development board.

 Signed-off-by: Ding Tianhong 
 Signed-off-by: Kefeng Wang 
 ---
  arch/arm64/boot/dts/hisilicon/Makefile  |   2 +-
  arch/arm64/boot/dts/hisilicon/hip05-d02.dts |  36 
  arch/arm64/boot/dts/hisilicon/hip05.dtsi| 271 
 
  3 files changed, 308 insertions(+), 1 deletion(-)
  create mode 100644 arch/arm64/boot/dts/hisilicon/hip05-d02.dts
  create mode 100644 arch/arm64/boot/dts/hisilicon/hip05.dtsi

 diff --git a/arch/arm64/boot/dts/hisilicon/Makefile 
 b/arch/arm64/boot/dts/hisilicon/Makefile
 index fa81a6e..cd158b8 100644
 --- a/arch/arm64/boot/dts/hisilicon/Makefile
 +++ b/arch/arm64/boot/dts/hisilicon/Makefile
 @@ -1,4 +1,4 @@
 -dtb-$(CONFIG_ARCH_HISI) += hi6220-hikey.dtb
 +dtb-$(CONFIG_ARCH_HISI) += hi6220-hikey.dtb hip05-d02.dtb
  
  always:= $(dtb-y)
  subdir-y  := $(dts-dirs)
 diff --git a/arch/arm64/boot/dts/hisilicon/hip05-d02.dts 
 b/arch/arm64/boot/dts/hisilicon/hip05-d02.dts
 new file mode 100644
 index 000..ae34e25
 --- /dev/null
 +++ b/arch/arm64/boot/dts/hisilicon/hip05-d02.dts
 @@ -0,0 +1,36 @@
 +/**
 + * dts file for Hisilicon D02 Development Board
 + *
 + * Copyright (C) 2014,2015 Hisilicon Ltd.
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * publishhed by the Free Software Foundation.
 + *
 + */
 +
 +/dts-v1/;
 +
 +#include "hip05.dtsi"
 +
 +/ {
 +  model = "Hisilicon Hip05 D02 Development Board";
 +  compatible = "hisilicon,hip05-d02";
 +
 +  memory@ {
 +  device_type = "memory";
 +  reg = <0x0 0x 0x0 0x8000>;
 +  };
 +
 +  aliases {
 +  serial0 = &uart0;
 +  };
 +
 +  chosen {
 +  stdout-path = "serial0:115200n8";
 +  };
 +};
 +
 +&uart0 {
 +  status = "ok";
 +};
 diff --git a/arch/arm64/boot/dts/hisilicon/hip05.dtsi 
 b/arch/arm64/boot/dts/hisilicon/hip05.dtsi
 new file mode 100644
 index 000..da12d94
 --- /dev/null
 +++ b/arch/arm64/boot/dts/hisilicon/hip05.dtsi
 @@ -0,0 +1,271 @@
 +/**
 + * dts file for Hisilicon D02 Development Board
 + *
 + * Copyright (C) 2014,2015 Hisilicon Ltd.
 + *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License version 2 as
 + * publishhed by the Free Software Foundation.
 + *
 + */
 +
 +#include 
 +
 +/ {
 +  compatible = "hisilicon,hip05-d02";
 +  interrupt-parent = <&gic>;
 +  #address-cells = <2>;
 +  #size-cells = <2>;
 +
 +  psci {
 +  compatible = "arm,psci-0.2";
 +  method = "smc";
 +  };
 +
 +  cpus {
 +  #address-cells = <1>;
 +  #size-cells = <0>;
 +
 +  cpu-map {
 +  cluster0 {
 +  core0 {
 +  cpu = <&cpu0>;
 +  };
 +  core1 {
 +  cpu = <&cpu1>;
 +  };
 +  core2 {
 +  cpu = <&cpu2>;
 +  };
 +  core3 {
 +  cpu = <&cpu3>;
 +  };
 +  };
 +  cluster1 {
 +  core0 {
 +  cpu = <&cpu4>;
 +  };
 +  core1 {
 +  cpu = <&cpu5>;
 +

[PATCH 09/15] tools lib api: Add debugfs into fs.c object

2015-09-02 Thread Jiri Olsa
Adding debugfs support into fs.c framework. It'll replace
the debugfs object functionality in following patches.

Link: http://lkml.kernel.org/n/tip-6n8d5bxn47oqcvlhzqw09...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/lib/api/fs/fs.c | 31 +--
 tools/lib/api/fs/fs.h |  1 +
 2 files changed, 26 insertions(+), 6 deletions(-)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 0700eb953495..798052cbc7c0 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -1,5 +1,3 @@
-/* TODO merge/factor in debugfs.c here */
-
 #include 
 #include 
 #include 
@@ -26,6 +24,10 @@
 #define PROC_SUPER_MAGIC   0x9fa0
 #endif
 
+#ifndef DEBUGFS_MAGIC
+#define DEBUGFS_MAGIC  0x64626720
+#endif
+
 static const char * const sysfs__fs_known_mountpoints[] = {
"/sys",
0,
@@ -36,6 +38,16 @@ static const char * const procfs__known_mountpoints[] = {
0,
 };
 
+#ifndef DEBUGFS_DEFAULT_PATH
+#define DEBUGFS_DEFAULT_PATH "/sys/kernel/debug"
+#endif
+
+static const char * const debugfs__known_mountpoints[] = {
+   DEBUGFS_DEFAULT_PATH,
+   "/debug",
+   0,
+};
+
 struct fs {
const char  *name;
const char * const  *mounts;
@@ -45,8 +57,9 @@ struct fs {
 };
 
 enum {
-   FS__SYSFS  = 0,
-   FS__PROCFS = 1,
+   FS__SYSFS   = 0,
+   FS__PROCFS  = 1,
+   FS__DEBUGFS = 2,
 };
 
 static struct fs fs__entries[] = {
@@ -60,6 +73,11 @@ static struct fs fs__entries[] = {
.mounts = procfs__known_mountpoints,
.magic  = PROC_SUPER_MAGIC,
},
+   [FS__DEBUGFS] = {
+   .name   = "debugfs",
+   .mounts = debugfs__known_mountpoints,
+   .magic  = DEBUGFS_MAGIC,
+   },
 };
 
 static bool fs__read_mounts(struct fs *fs)
@@ -176,8 +194,9 @@ const char *name##__mountpoint(void)\
return fs__mountpoint(idx); \
 }
 
-FS__MOUNTPOINT(sysfs,  FS__SYSFS);
-FS__MOUNTPOINT(procfs, FS__PROCFS);
+FS__MOUNTPOINT(sysfs,   FS__SYSFS);
+FS__MOUNTPOINT(procfs,  FS__PROCFS);
+FS__MOUNTPOINT(debugfs, FS__DEBUGFS);
 
 int filename__read_int(const char *filename, int *value)
 {
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
index 674efc8dfd9b..a4e6b1d93d2f 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -11,6 +11,7 @@
 
 const char *sysfs__mountpoint(void);
 const char *procfs__mountpoint(void);
+const char *debugfs__mountpoint(void);
 
 int filename__read_int(const char *filename, int *value);
 int sysctl__read_int(const char *sysctl, int *value);
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 12/15] tools lib api: Add configured support for fs

2015-09-02 Thread Jiri Olsa
Adding name__mount (where name is in sysfs,procfs,debugfs,tracefs)
interface that returns bool state of the filesystem mount:
  true - mounted, false - not mounted

It will not try to mount the filesystem.

Link: http://lkml.kernel.org/n/tip-csvlq2hr43ys3u7nfs2up...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/lib/api/fs/fs.c | 23 ++-
 tools/lib/api/fs/fs.h |  5 -
 2 files changed, 18 insertions(+), 10 deletions(-)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index bc93baf33fff..8afe08a99bc6 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -244,15 +244,20 @@ static const char *fs__mount(int idx)
return fs__check_mounts(fs) ? fs->path : NULL;
 }
 
-#define FS(name, idx)  \
-const char *name##__mountpoint(void)   \
-{  \
-   return fs__mountpoint(idx); \
-}  \
-   \
-const char *name##__mount(void)\
-{  \
-   return fs__mount(idx);  \
+#define FS(name, idx)  \
+const char *name##__mountpoint(void)   \
+{  \
+   return fs__mountpoint(idx); \
+}  \
+   \
+const char *name##__mount(void)\
+{  \
+   return fs__mount(idx);  \
+}  \
+   \
+bool name##__configured(void)  \
+{  \
+   return name##__mountpoint() != NULL;\
 }
 
 FS(sysfs,   FS__SYSFS);
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
index a9627ea5e6ae..f654bcb99d1e 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -1,6 +1,8 @@
 #ifndef __API_FS__
 #define __API_FS__
 
+#include 
+
 /*
  * On most systems  would have given us this, but  not on some 
systems
  * (e.g. GNU/Hurd).
@@ -11,7 +13,8 @@
 
 #define FS(name)   \
const char *name##__mountpoint(void);   \
-   const char *name##__mount(void);
+   const char *name##__mount(void);\
+   bool name##__configured(void);  \
 
 FS(sysfs)
 FS(procfs)
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 13/15] tools lib api: Replace debugfs/tracefs objects interface with fs.c

2015-09-02 Thread Jiri Olsa
Switching to the fs.c related filesystem framework.

Link: http://lkml.kernel.org/n/tip-csvlq2hr43ys3u7nfs2up...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/lib/api/fs/fs.c  |  1 -
 tools/lib/api/fs/tracing_path.c| 15 +++
 tools/perf/builtin-kvm.c   |  1 -
 tools/perf/builtin-probe.c |  1 -
 tools/perf/tests/openat-syscall-all-cpus.c |  5 +++--
 tools/perf/tests/openat-syscall.c  |  5 +++--
 tools/perf/tests/parse-events.c|  7 +++
 tools/perf/util/evsel.c|  2 +-
 tools/perf/util/probe-event.c  |  5 ++---
 tools/perf/util/probe-file.c   |  7 +++
 tools/perf/util/util.h |  3 +--
 11 files changed, 23 insertions(+), 29 deletions(-)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 8afe08a99bc6..791509346178 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -11,7 +11,6 @@
 #include 
 #include 
 
-#include "debugfs.h"
 #include "fs.h"
 
 #define _STR(x) #x
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
index b0ee3b3acef0..b53aa9c8d1c8 100644
--- a/tools/lib/api/fs/tracing_path.c
+++ b/tools/lib/api/fs/tracing_path.c
@@ -7,8 +7,7 @@
 #include 
 #include 
 #include 
-#include "debugfs.h"
-#include "tracefs.h"
+#include "fs.h"
 
 #include "tracing_path.h"
 
@@ -29,7 +28,7 @@ static const char *tracing_path_tracefs_mount(void)
 {
const char *mnt;
 
-   mnt = tracefs_mount(NULL);
+   mnt = tracefs__mount();
if (!mnt)
return NULL;
 
@@ -42,7 +41,7 @@ static const char *tracing_path_debugfs_mount(void)
 {
const char *mnt;
 
-   mnt = debugfs_mount(NULL);
+   mnt = debugfs__mount();
if (!mnt)
return NULL;
 
@@ -90,7 +89,7 @@ static int strerror_open(int err, char *buf, size_t size, 
const char *filename)
 
switch (err) {
case ENOENT:
-   if (debugfs_configured() || tracefs_configured()) {
+   if (debugfs__configured() || tracefs__configured()) {
snprintf(buf, size,
 "Error:\tFile %s/%s not found.\n"
 "Hint:\tPerhaps this kernel misses some 
CONFIG_ setting to enable this feature?.\n",
@@ -104,13 +103,13 @@ static int strerror_open(int err, char *buf, size_t size, 
const char *filename)
 "Hint:\tTry 'sudo mount -t debugfs nodev 
/sys/kernel/debug'");
break;
case EACCES: {
-   const char *mountpoint = debugfs_find_mountpoint();
+   const char *mountpoint = debugfs__mountpoint();
 
if (!access(mountpoint, R_OK) && strncmp(filename, "tracing/", 
8) == 0) {
-   const char *tracefs_mntpoint = 
tracefs_find_mountpoint();
+   const char *tracefs_mntpoint = tracefs__mountpoint();
 
if (tracefs_mntpoint)
-   mountpoint = tracefs_find_mountpoint();
+   mountpoint = tracefs__mountpoint();
}
 
snprintf(buf, size,
diff --git a/tools/perf/builtin-kvm.c b/tools/perf/builtin-kvm.c
index fc1cffb1b7a2..dd94b4ca2213 100644
--- a/tools/perf/builtin-kvm.c
+++ b/tools/perf/builtin-kvm.c
@@ -13,7 +13,6 @@
 #include "util/parse-options.h"
 #include "util/trace-event.h"
 #include "util/debug.h"
-#include 
 #include "util/tool.h"
 #include "util/stat.h"
 #include "util/top.h"
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index b81cec33b4b2..310aba2756a8 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -37,7 +37,6 @@
 #include "util/strfilter.h"
 #include "util/symbol.h"
 #include "util/debug.h"
-#include 
 #include "util/parse-options.h"
 #include "util/probe-finder.h"
 #include "util/probe-event.h"
diff --git a/tools/perf/tests/openat-syscall-all-cpus.c 
b/tools/perf/tests/openat-syscall-all-cpus.c
index a572f87e9c8d..a38adf94c731 100644
--- a/tools/perf/tests/openat-syscall-all-cpus.c
+++ b/tools/perf/tests/openat-syscall-all-cpus.c
@@ -1,3 +1,4 @@
+#include 
 #include "evsel.h"
 #include "tests.h"
 #include "thread_map.h"
@@ -30,9 +31,9 @@ int test__openat_syscall_event_on_all_cpus(void)
 
evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
if (evsel == NULL) {
-   if (tracefs_configured())
+   if (tracefs__configured())
pr_debug("is tracefs mounted on 
/sys/kernel/tracing?\n");
-   else if (debugfs_configured())
+   else if (debugfs__configured())
pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
else
pr_debug("Neither tracefs or debugfs is enabled in this 
kernel\n");
diff --git a/tools/perf/tests/openat-syscall.c 
b/tools/perf/tests/openat-syscall.c
inde

[PATCH 07/15] tools lib api: Add STR and PATH_MAX macros to fs object

2015-09-02 Thread Jiri Olsa
We're going to get rid of findfs.h in following patches,
but we'll still need these macros.

Link: http://lkml.kernel.org/n/tip-mrjj0llsem9pjakkrx9o0...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/lib/api/fs/fs.c | 3 +++
 tools/lib/api/fs/fs.h | 8 
 2 files changed, 11 insertions(+)

diff --git a/tools/lib/api/fs/fs.c b/tools/lib/api/fs/fs.c
index 128ef6332a6b..5e838d3c419d 100644
--- a/tools/lib/api/fs/fs.c
+++ b/tools/lib/api/fs/fs.c
@@ -15,6 +15,9 @@
 #include "debugfs.h"
 #include "fs.h"
 
+#define _STR(x) #x
+#define STR(x) _STR(x)
+
 static const char * const sysfs__fs_known_mountpoints[] = {
"/sys",
0,
diff --git a/tools/lib/api/fs/fs.h b/tools/lib/api/fs/fs.h
index 6caa2bbc6cec..fd6288d73383 100644
--- a/tools/lib/api/fs/fs.h
+++ b/tools/lib/api/fs/fs.h
@@ -1,6 +1,14 @@
 #ifndef __API_FS__
 #define __API_FS__
 
+/*
+ * On most systems  would have given us this, but  not on some 
systems
+ * (e.g. GNU/Hurd).
+ */
+#ifndef PATH_MAX
+#define PATH_MAX 4096
+#endif
+
 #ifndef SYSFS_MAGIC
 #define SYSFS_MAGIC0x62656572
 #endif
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 15/15] perf tools: Switch to tracing_path interface on appropriate places

2015-09-02 Thread Jiri Olsa
Using tracing_path interface on several places, that more or less
copy the functionality of tracing_path interface.

Link: http://lkml.kernel.org/n/tip-nvxvjo2bpsjf3hhz3ylul...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/perf/tests/openat-syscall-all-cpus.c |  9 +++--
 tools/perf/tests/openat-syscall.c  | 11 ---
 tools/perf/tests/parse-events.c| 16 ++--
 tools/perf/util/probe-file.c   | 14 ++
 4 files changed, 11 insertions(+), 39 deletions(-)

diff --git a/tools/perf/tests/openat-syscall-all-cpus.c 
b/tools/perf/tests/openat-syscall-all-cpus.c
index a38adf94c731..495d8126b722 100644
--- a/tools/perf/tests/openat-syscall-all-cpus.c
+++ b/tools/perf/tests/openat-syscall-all-cpus.c
@@ -15,6 +15,7 @@ int test__openat_syscall_event_on_all_cpus(void)
cpu_set_t cpu_set;
struct thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX);
char sbuf[STRERR_BUFSIZE];
+   char errbuf[BUFSIZ];
 
if (threads == NULL) {
pr_debug("thread_map__new\n");
@@ -31,12 +32,8 @@ int test__openat_syscall_event_on_all_cpus(void)
 
evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
if (evsel == NULL) {
-   if (tracefs__configured())
-   pr_debug("is tracefs mounted on 
/sys/kernel/tracing?\n");
-   else if (debugfs__configured())
-   pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
-   else
-   pr_debug("Neither tracefs or debugfs is enabled in this 
kernel\n");
+   tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), 
"syscalls", "sys_enter_openat");
+   pr_err("%s\n", errbuf);
goto out_thread_map_delete;
}
 
diff --git a/tools/perf/tests/openat-syscall.c 
b/tools/perf/tests/openat-syscall.c
index 8048c7d7cd67..08ac9d94a050 100644
--- a/tools/perf/tests/openat-syscall.c
+++ b/tools/perf/tests/openat-syscall.c
@@ -1,4 +1,4 @@
-#include 
+#include 
 #include "thread_map.h"
 #include "evsel.h"
 #include "debug.h"
@@ -11,6 +11,7 @@ int test__openat_syscall_event(void)
unsigned int nr_openat_calls = 111, i;
struct thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX);
char sbuf[STRERR_BUFSIZE];
+   char errbuf[BUFSIZ];
 
if (threads == NULL) {
pr_debug("thread_map__new\n");
@@ -19,12 +20,8 @@ int test__openat_syscall_event(void)
 
evsel = perf_evsel__newtp("syscalls", "sys_enter_openat");
if (evsel == NULL) {
-   if (tracefs__configured())
-   pr_debug("is tracefs mounted on 
/sys/kernel/tracing?\n");
-   else if (debugfs__configured())
-   pr_debug("is debugfs mounted on /sys/kernel/debug?\n");
-   else
-   pr_debug("Neither tracefs or debugfs is enabled in this 
kernel\n");
+   tracing_path__strerror_open_tp(errno, errbuf, sizeof(errbuf), 
"syscalls", "sys_enter_openat");
+   pr_err("%s\n", errbuf);
goto out_thread_map_delete;
}
 
diff --git a/tools/perf/tests/parse-events.c b/tools/perf/tests/parse-events.c
index 91fbfd593c4a..3a2ebe666192 100644
--- a/tools/perf/tests/parse-events.c
+++ b/tools/perf/tests/parse-events.c
@@ -1261,23 +1261,11 @@ test__checkevent_breakpoint_len_rw_modifier(struct 
perf_evlist *evlist)
 
 static int count_tracepoints(void)
 {
-   char events_path[PATH_MAX];
struct dirent *events_ent;
-   const char *mountpoint;
DIR *events_dir;
int cnt = 0;
 
-   mountpoint = tracefs__mountpoint();
-   if (mountpoint) {
-   scnprintf(events_path, PATH_MAX, "%s/events",
- mountpoint);
-   } else {
-   mountpoint = debugfs__mountpoint();
-   scnprintf(events_path, PATH_MAX, "%s/tracing/events",
- mountpoint);
-   }
-
-   events_dir = opendir(events_path);
+   events_dir = opendir(tracing_events_path);
 
TEST_ASSERT_VAL("Can't open events dir", events_dir);
 
@@ -1294,7 +1282,7 @@ static int count_tracepoints(void)
continue;
 
scnprintf(sys_path, PATH_MAX, "%s/%s",
- events_path, events_ent->d_name);
+ tracing_events_path, events_ent->d_name);
 
sys_dir = opendir(sys_path);
TEST_ASSERT_VAL("Can't open sys dir", sys_dir);
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c
index de0df1e6222a..cbc5783389f8 100644
--- a/tools/perf/util/probe-file.c
+++ b/tools/perf/util/probe-file.c
@@ -22,7 +22,7 @@
 #include "color.h"
 #include "symbol.h"
 #include "thread.h"
-#include 
+#include 
 #include "probe-event.h"
 #include "probe-file.h"
 #include "session.h"
@@ -72,21 +72,11 @@ static void print_both_open_warning(int kerr,

[PATCH 01/15] perf tools: Fix parse_events_add_pmu caller

2015-09-02 Thread Jiri Olsa
Following commit changed parse_events_add_pmu interface:
  36adec85a86f perf tools: Change parse_events_add_pmu interface

but forgot to change one caller. Because of lessen compilation
rules for the bison parser, the compiler did not warn on that.

Link: http://lkml.kernel.org/n/tip-fda5a524tfapmpb85bmai...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/perf/util/parse-events.y | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/util/parse-events.y b/tools/perf/util/parse-events.y
index 591905a02b92..9cd70819c795 100644
--- a/tools/perf/util/parse-events.y
+++ b/tools/perf/util/parse-events.y
@@ -255,7 +255,7 @@ PE_PMU_EVENT_PRE '-' PE_PMU_EVENT_SUF sep_dc
list_add_tail(&term->list, head);
 
ALLOC_LIST(list);
-   ABORT_ON(parse_events_add_pmu(list, &data->idx, "cpu", head));
+   ABORT_ON(parse_events_add_pmu(data, list, "cpu", head));
parse_events__free_terms(head);
$$ = list;
 }
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 02/15] perf tools: Remove mountpoint arg from perf_debugfs_mount

2015-09-02 Thread Jiri Olsa
It's not used by any caller. We either detect the mountpoint
or use hardcoded one.

Link: http://lkml.kernel.org/n/tip-7bbr92o7gwv5bkpancqoy...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/perf/perf.c  |  2 +-
 tools/perf/util/util.c | 14 +++---
 tools/perf/util/util.h |  2 +-
 3 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 07dbff5c0e60..f500a4b40722 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -518,7 +518,7 @@ int main(int argc, const char **argv)
if (!cmd)
cmd = "perf-help";
/* get debugfs mount point from /proc/mounts */
-   perf_debugfs_mount(NULL);
+   perf_debugfs_mount();
/*
 * "perf-" is the same as "perf ", but we obviously:
 *
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
index 7acafb3c5592..74f71f8afcc2 100644
--- a/tools/perf/util/util.c
+++ b/tools/perf/util/util.c
@@ -398,11 +398,11 @@ static void set_tracing_events_path(const char *tracing, 
const char *mountpoint)
 mountpoint, tracing, "events");
 }
 
-static const char *__perf_tracefs_mount(const char *mountpoint)
+static const char *__perf_tracefs_mount(void)
 {
const char *mnt;
 
-   mnt = tracefs_mount(mountpoint);
+   mnt = tracefs_mount(NULL);
if (!mnt)
return NULL;
 
@@ -411,11 +411,11 @@ static const char *__perf_tracefs_mount(const char 
*mountpoint)
return mnt;
 }
 
-static const char *__perf_debugfs_mount(const char *mountpoint)
+static const char *__perf_debugfs_mount(void)
 {
const char *mnt;
 
-   mnt = debugfs_mount(mountpoint);
+   mnt = debugfs_mount(NULL);
if (!mnt)
return NULL;
 
@@ -424,15 +424,15 @@ static const char *__perf_debugfs_mount(const char 
*mountpoint)
return mnt;
 }
 
-const char *perf_debugfs_mount(const char *mountpoint)
+const char *perf_debugfs_mount(void)
 {
const char *mnt;
 
-   mnt = __perf_tracefs_mount(mountpoint);
+   mnt = __perf_tracefs_mount();
if (mnt)
return mnt;
 
-   mnt = __perf_debugfs_mount(mountpoint);
+   mnt = __perf_debugfs_mount();
 
return mnt;
 }
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h
index 291be1d84bc3..184d40048faa 100644
--- a/tools/perf/util/util.h
+++ b/tools/perf/util/util.h
@@ -86,7 +86,7 @@ extern char buildid_dir[];
 extern char tracing_path[];
 extern char tracing_events_path[];
 extern void perf_debugfs_set_path(const char *mountpoint);
-const char *perf_debugfs_mount(const char *mountpoint);
+const char *perf_debugfs_mount(void);
 char *get_tracing_file(const char *name);
 void put_tracing_file(char *file);
 
-- 
2.4.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 04/15] perf tools: Move tracing_path interface into api/fs/tracing_path.c

2015-09-02 Thread Jiri Olsa
Moving tracing_path interface into api/fs/tracing_path.c
out of util.c. It seems generic enough to be used by
others, and I couldn't think of better place.

Link: http://lkml.kernel.org/n/tip-xqvrud2e3z4uynvnu3iml...@git.kernel.org
Signed-off-by: Jiri Olsa 
---
 tools/lib/api/fs/Build |  1 +
 tools/lib/api/fs/tracing_path.c| 83 ++
 tools/lib/api/fs/tracing_path.h| 13 ++
 tools/perf/perf.c  |  2 +-
 tools/perf/util/parse-events.c |  2 +-
 tools/perf/util/trace-event-info.c |  2 +-
 tools/perf/util/trace-event.c  |  1 +
 tools/perf/util/util.c | 70 
 tools/perf/util/util.h |  6 ---
 9 files changed, 101 insertions(+), 79 deletions(-)
 create mode 100644 tools/lib/api/fs/tracing_path.c
 create mode 100644 tools/lib/api/fs/tracing_path.h

diff --git a/tools/lib/api/fs/Build b/tools/lib/api/fs/Build
index 6de5a4f0b501..fa726f679b29 100644
--- a/tools/lib/api/fs/Build
+++ b/tools/lib/api/fs/Build
@@ -1,4 +1,5 @@
 libapi-y += fs.o
+libapi-y += tracing_path.o
 libapi-y += debugfs.o
 libapi-y += findfs.o
 libapi-y += tracefs.o
diff --git a/tools/lib/api/fs/tracing_path.c b/tools/lib/api/fs/tracing_path.c
new file mode 100644
index ..1fd6e1f99234
--- /dev/null
+++ b/tools/lib/api/fs/tracing_path.c
@@ -0,0 +1,83 @@
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE
+#endif
+
+#include 
+#include 
+#include 
+#include "debugfs.h"
+#include "tracefs.h"
+
+#include "tracing_path.h"
+
+
+char tracing_path[PATH_MAX + 1]= "/sys/kernel/debug/tracing";
+char tracing_events_path[PATH_MAX + 1] = "/sys/kernel/debug/tracing/events";
+
+
+static void __tracing_path_set(const char *tracing, const char *mountpoint)
+{
+   snprintf(tracing_path, sizeof(tracing_path), "%s/%s",
+mountpoint, tracing);
+   snprintf(tracing_events_path, sizeof(tracing_events_path), "%s/%s%s",
+mountpoint, tracing, "events");
+}
+
+static const char *tracing_path_tracefs_mount(void)
+{
+   const char *mnt;
+
+   mnt = tracefs_mount(NULL);
+   if (!mnt)
+   return NULL;
+
+   __tracing_path_set("", mnt);
+
+   return mnt;
+}
+
+static const char *tracing_path_debugfs_mount(void)
+{
+   const char *mnt;
+
+   mnt = debugfs_mount(NULL);
+   if (!mnt)
+   return NULL;
+
+   __tracing_path_set("tracing/", mnt);
+
+   return mnt;
+}
+
+const char *tracing_path_mount(void)
+{
+   const char *mnt;
+
+   mnt = tracing_path_tracefs_mount();
+   if (mnt)
+   return mnt;
+
+   mnt = tracing_path_debugfs_mount();
+
+   return mnt;
+}
+
+void tracing_path_set(const char *mntpt)
+{
+   __tracing_path_set("tracing/", mntpt);
+}
+
+char *get_tracing_file(const char *name)
+{
+   char *file;
+
+   if (asprintf(&file, "%s/%s", tracing_path, name) < 0)
+   return NULL;
+
+   return file;
+}
+
+void put_tracing_file(char *file)
+{
+   free(file);
+}
diff --git a/tools/lib/api/fs/tracing_path.h b/tools/lib/api/fs/tracing_path.h
new file mode 100644
index ..b132dc599fe5
--- /dev/null
+++ b/tools/lib/api/fs/tracing_path.h
@@ -0,0 +1,13 @@
+#ifndef __API_FS_TRACING_PATH_H
+#define __API_FS_TRACING_PATH_H
+
+extern char tracing_path[];
+extern char tracing_events_path[];
+
+void tracing_path_set(const char *mountpoint);
+const char *tracing_path_mount(void);
+
+char *get_tracing_file(const char *name);
+void put_tracing_file(char *file);
+
+#endif /* __API_FS_TRACING_PATH_H */
diff --git a/tools/perf/perf.c b/tools/perf/perf.c
index 0e99cd1de9dd..f2fc019b3671 100644
--- a/tools/perf/perf.c
+++ b/tools/perf/perf.c
@@ -15,7 +15,7 @@
 #include "util/parse-events.h"
 #include "util/parse-options.h"
 #include "util/debug.h"
-#include 
+#include 
 #include 
 
 const char perf_usage_string[] =
diff --git a/tools/perf/util/parse-events.c b/tools/perf/util/parse-events.c
index d826e6f515db..3840176642f8 100644
--- a/tools/perf/util/parse-events.c
+++ b/tools/perf/util/parse-events.c
@@ -11,7 +11,7 @@
 #include "cache.h"
 #include "header.h"
 #include "debug.h"
-#include 
+#include 
 #include "parse-events-bison.h"
 #define YY_EXTRA_TYPE int
 #include "parse-events-flex.h"
diff --git a/tools/perf/util/trace-event-info.c 
b/tools/perf/util/trace-event-info.c
index 22245986e59e..d995743cb673 100644
--- a/tools/perf/util/trace-event-info.c
+++ b/tools/perf/util/trace-event-info.c
@@ -38,7 +38,7 @@
 
 #include "../perf.h"
 #include "trace-event.h"
-#include 
+#include 
 #include "evsel.h"
 #include "debug.h"
 
diff --git a/tools/perf/util/trace-event.c b/tools/perf/util/trace-event.c
index b90e646c7a91..2f4996ab313d 100644
--- a/tools/perf/util/trace-event.c
+++ b/tools/perf/util/trace-event.c
@@ -8,6 +8,7 @@
 #include 
 #include 
 #include 
+#include 
 #include "trace-event.h"
 #include "machine.h"
 #include "util.h"
diff --git a/tools/perf/util/util.c b/tools/perf/ut

[PATCH 00/15] perf tools: Cleanup filesystem api

2015-09-02 Thread Jiri Olsa
hi,
this patchset moves all filesystem we use under
api/fs/fs.c framework and adds new tracing_path
object to get tracing area (path).

It unifies the way we use debugfs/tracefs paths
and removes some redundant code.

It's base for the tracepoint parsing error reporting
I posted recently.

jirka


---
Jiri Olsa (15):
  perf tools: Fix parse_events_add_pmu caller
  perf tools: Remove mountpoint arg from perf_debugfs_mount
  perf tools: Move tracing_path stuff under same namespace
  perf tools: Move tracing_path interface into api/fs/tracing_path.c
  tools lib api: Move debugfs__strerror_open into tracing_path.c object
  tools lib api: Make tracing_path_strerror_open message generic
  tools lib api: Add STR and PATH_MAX macros to fs object
  tools lib api: Move SYSFS_MAGIC PROC_SUPER_MAGIC into fs.c
  tools lib api: Add debugfs into fs.c object
  tools lib api: Add tracefs into fs.c object
  tools lib api: Add mount support for fs
  tools lib api: Add configured support for fs
  tools lib api: Replace debugfs/tracefs objects interface with fs.c
  tools lib api: Remove debugfs, tracefs and findfs objects
  perf tools: Switch to tracing_path interface on appropriate places

 tools/lib/api/fs/Build |   4 +--
 tools/lib/api/fs/debugfs.c | 129 
---
 tools/lib/api/fs/debugfs.h |  23 ---
 tools/lib/api/fs/findfs.c  |  63 
-
 tools/lib/api/fs/findfs.h  |  23 ---
 tools/lib/api/fs/fs.c  | 118 

 tools/lib/api/fs/fs.h  |  26 -
 tools/lib/api/fs/tracefs.c |  78 
--
 tools/lib/api/fs/tracefs.h |  21 --
 tools/lib/api/fs/tracing_path.c| 136 

 tools/lib/api/fs/tracing_path.h|  16 +++
 tools/perf/builtin-kvm.c   |   1 -
 tools/perf/builtin-probe.c |   1 -
 tools/perf/builtin-trace.c |   5 ++--
 tools/perf/perf.c  |  12 
 tools/perf/tests/openat-syscall-all-cpus.c |  10 +++
 tools/perf/tests/openat-syscall.c  |  10 +++
 tools/perf/tests/parse-events.c|  19 ++---
 tools/perf/util/evsel.c|   2 +-
 tools/perf/util/parse-events.c |   2 +-
 tools/perf/util/parse-events.y |   2 +-
 tools/perf/util/probe-event.c  |   5 ++--
 tools/perf/util/probe-file.c   |  15 ++
 tools/perf/util/trace-event-info.c |   2 +-
 tools/perf/util/trace-event.c  |   1 +
 tools/perf/util/util.c |  70 
-
 tools/perf/util/util.h |   9 +-
 27 files changed, 310 insertions(+), 493 deletions(-)
 delete mode 100644 tools/lib/api/fs/debugfs.c
 delete mode 100644 tools/lib/api/fs/debugfs.h
 delete mode 100644 tools/lib/api/fs/findfs.c
 delete mode 100644 tools/lib/api/fs/findfs.h
 delete mode 100644 tools/lib/api/fs/tracefs.c
 delete mode 100644 tools/lib/api/fs/tracefs.h
 create mode 100644 tools/lib/api/fs/tracing_path.c
 create mode 100644 tools/lib/api/fs/tracing_path.h
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2 1/2] ARM: dts: Split audio configuration to separate exynos5422-odroidxu3-audio

2015-09-02 Thread Javier Martinez Canillas
Hello Krzysztof,

On 09/02/2015 03:30 AM, Krzysztof Kozlowski wrote:
> The Odroid XU4 board does not have audio codec so before adding DTS for
> new board split the audio codec to separate DTSI file. Include the audio codec
> DTSI in Odroid XU3 and XU3-Lite boards.
> 
> Signed-off-by: Krzysztof Kozlowski 
> 

Looks good to me.

Reviewed-by: Javier Martinez Canillas 

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v6 3/3] KVM: trace kvm_halt_poll_ns grow/shrink

2015-09-02 Thread Wanpeng Li
Tracepoint for dynamic halt_pool_ns, fired on every potential change.

Signed-off-by: Wanpeng Li 
---
 include/trace/events/kvm.h | 30 ++
 virt/kvm/kvm_main.c|  8 ++--
 2 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/include/trace/events/kvm.h b/include/trace/events/kvm.h
index a44062d..75ddf80 100644
--- a/include/trace/events/kvm.h
+++ b/include/trace/events/kvm.h
@@ -356,6 +356,36 @@ TRACE_EVENT(
  __entry->address)
 );
 
+TRACE_EVENT(kvm_halt_poll_ns,
+   TP_PROTO(bool grow, unsigned int vcpu_id, int new, int old),
+   TP_ARGS(grow, vcpu_id, new, old),
+
+   TP_STRUCT__entry(
+   __field(bool, grow)
+   __field(unsigned int, vcpu_id)
+   __field(int, new)
+   __field(int, old)
+   ),
+
+   TP_fast_assign(
+   __entry->grow   = grow;
+   __entry->vcpu_id= vcpu_id;
+   __entry->new= new;
+   __entry->old= old;
+   ),
+
+   TP_printk("vcpu %u: halt_pool_ns %d (%s %d)",
+   __entry->vcpu_id,
+   __entry->new,
+   __entry->grow ? "grow" : "shrink",
+   __entry->old)
+);
+
+#define trace_kvm_halt_poll_ns_grow(vcpu_id, new, old) \
+   trace_kvm_halt_poll_ns(true, vcpu_id, new, old)
+#define trace_kvm_halt_poll_ns_shrink(vcpu_id, new, old) \
+   trace_kvm_halt_poll_ns(false, vcpu_id, new, old)
+
 #endif
 
 #endif /* _TRACE_KVM_MAIN_H */
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 3cff02f..fee339e 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -1918,8 +1918,9 @@ EXPORT_SYMBOL_GPL(kvm_vcpu_mark_page_dirty);
 
 static void grow_halt_poll_ns(struct kvm_vcpu *vcpu)
 {
-   int val = vcpu->halt_poll_ns;
+   int old, val;
 
+   old = val = vcpu->halt_poll_ns;
/* 10us base */
if (val == 0 && halt_poll_ns_grow)
val = 1;
@@ -1927,18 +1928,21 @@ static void grow_halt_poll_ns(struct kvm_vcpu *vcpu)
val *= halt_poll_ns_grow;
 
vcpu->halt_poll_ns = val;
+   trace_kvm_halt_poll_ns_grow(vcpu->vcpu_id, val, old);
 }
 
 static void shrink_halt_poll_ns(struct kvm_vcpu *vcpu)
 {
-   int val = vcpu->halt_poll_ns;
+   int old, val;
 
+   old = val = vcpu->halt_poll_ns;
if (halt_poll_ns_shrink == 0)
val = 0;
else
val /= halt_poll_ns_shrink;
 
vcpu->halt_poll_ns = val;
+   trace_kvm_halt_poll_ns_shrink(vcpu->vcpu_id, val, old);
 }
 
 static int kvm_vcpu_check_block(struct kvm_vcpu *vcpu)
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 0/4] x86/insn: perf tools: Add a few new x86 instructions

2015-09-02 Thread Ingo Molnar

* 平松雅巳 / HIRAMATU,MASAMI  wrote:

> > sure, np you can use my ack
> 
> I'm also OK for this patch. I just concern that is OK for Adrian too? 
> Since this ensures all the copied code should be dead copy (not modified 
> anymore),
> if we want a different instruction decoding routine, we have to break the test
> anyway.

So the idea would be to not break anything, only warn in a non-fatal question. 
This protects against unbisectable universes being created via simple git 
merges 
where updates meet but testing of tooling isn't done.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 1/2] mmc: sdhci-pxav3: Fix tabbing issue

2015-09-02 Thread Vaibhav Hiremath



On Wednesday 02 September 2015 12:24 PM, Jisheng Zhang wrote:

On Wed, 2 Sep 2015 00:54:13 +0530
Vaibhav Hiremath  wrote:


There were some coding style issues where spaces have been used instead
of tabs, for example, in macro definitions, alignment of function
declarations/definitions, etc...

This patch fixes all such occurrences in the code.
And also use BIT for bit definitions.

Signed-off-by: Vaibhav Hiremath 
---
  drivers/mmc/host/sdhci-pxav3.c | 63 ++
  1 file changed, 33 insertions(+), 30 deletions(-)

diff --git a/drivers/mmc/host/sdhci-pxav3.c b/drivers/mmc/host/sdhci-pxav3.c
index 946d37f..d02bc37 100644
--- a/drivers/mmc/host/sdhci-pxav3.c
+++ b/drivers/mmc/host/sdhci-pxav3.c
@@ -39,24 +39,29 @@
  #include "sdhci.h"
  #include "sdhci-pltfm.h"

-#define PXAV3_RPM_DELAY_MS 50
+#define PXAV3_RPM_DELAY_MS 50

-#define SD_CLOCK_BURST_SIZE_SETUP  0x10A
-#define SDCLK_SEL  0x100
-#define SDCLK_DELAY_SHIFT  9
-#define SDCLK_DELAY_MASK   0x1f
+#define SD_CLOCK_BURST_SIZE_SETUP  0x10A
+#define SDCLK_SEL  0x100
+#define  SDCLK_DELAY_SHIFT 9
+#define  SDCLK_DELAY_MASK  0x1f

-#define SD_CFG_FIFO_PARAM   0x100
-#define SDCFG_GEN_PAD_CLK_ON   (1<<6)
-#define SDCFG_GEN_PAD_CLK_CNT_MASK 0xFF
-#define SDCFG_GEN_PAD_CLK_CNT_SHIFT24
+#define SD_CFG_FIFO_PARAM  0x100
+#define  SDCFG_GEN_PAD_CLK_ON  BIT(6)
+#define  SDCFG_GEN_PAD_CLK_CNT_MASK0xFF
+#define  SDCFG_GEN_PAD_CLK_CNT_SHIFT   24

-#define SD_SPI_MODE  0x108
-#define SD_CE_ATA_1  0x10C
+#define SD_SPI_MODE0x108
+#define SD_CE_ATA_10x10C

-#define SD_CE_ATA_2  0x10E
-#define SDCE_MISC_INT  (1<<2)
-#define SDCE_MISC_INT_EN   (1<<1)
+#define SD_CE_ATA_20x10E
+#define  SDCE_MISC_INT BIT(2)
+#define  SDCE_MISC_INT_EN  BIT(1)


BIT or (1 << y) are both fine, is there any reason to change to BIT?
If so, there will be lots of source code need such changes.



I have received comments for my other patches (PMIC/Regulator/mfd),
so applying same here as well before doing any real
functionality/coding changes to the driver.



+
+/* IO Power control */
+#define IO_PWR_AKEY_ASFAR  0xbaba
+#define IO_PWR_AKEY_ASSAR  0xeb10
+#define IO_PWR_MMC1_PAD_1V8BIT(2)

  struct sdhci_pxa {
struct clk *clk_core;
@@ -128,7 +133,7 @@ static int mv_conf_mbus_windows(struct platform_device 
*pdev,
  }

  static int armada_38x_quirks(struct platform_device *pdev,
-struct sdhci_host *host)
+   struct sdhci_host *host)
  {
struct device_node *np = pdev->dev.of_node;
struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
@@ -136,8 +141,7 @@ static int armada_38x_quirks(struct platform_device *pdev,
struct resource *res;

host->quirks |= SDHCI_QUIRK_MISSING_CAPS;
-   res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
-  "conf-sdio3");
+   res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "conf-sdio3");
if (res) {
pxa->sdio3_conf_reg = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(pxa->sdio3_conf_reg))
@@ -284,10 +288,10 @@ static void pxav3_set_uhs_signaling(struct sdhci_host 
*host, unsigned int uhs)
 * FE-2946959
 */
if (pxa->sdio3_conf_reg) {
-   u8 reg_val  = readb(pxa->sdio3_conf_reg);
+   u8 reg_val = readb(pxa->sdio3_conf_reg);

if (uhs == MMC_TIMING_UHS_SDR50 ||
-   uhs == MMC_TIMING_UHS_DDR50) {
+   uhs == MMC_TIMING_UHS_DDR50) {
reg_val &= ~SDIO3_CONF_CLK_INV;
reg_val |= SDIO3_CONF_SD_FB_CLK;
} else {
@@ -304,20 +308,20 @@ static void pxav3_set_uhs_signaling(struct sdhci_host 
*host, unsigned int uhs)
  }

  static const struct sdhci_ops pxav3_sdhci_ops = {
-   .set_clock = sdhci_set_clock,
-   .platform_send_init_74_clocks = pxav3_gen_init_74_clocks,
-   .get_max_clock = sdhci_pltfm_clk_get_max_clock,
-   .set_bus_width = sdhci_set_bus_width,
-   .reset = pxav3_reset,
-   .set_uhs_signaling = pxav3_set_uhs_signaling,
+   .set_clock  = sdhci_set_clock,
+   .platform_send_init_74_clocks   = pxav3_gen_init_74_clocks,
+   .get_max_clock  = sdhci_pltfm_clk_get_max_clock,
+   .set_bus_width  = sdhci_set_bus_width,
+   .reset  = pxav3_reset,
+   .set_uhs_signaling  = pxav3_set_uhs_signaling,
  };


IMHO these two styles are both fine. For example, the mmc_sd_ops structure in
drivers/mmc/core/sd.c also follows the sdhci-pxav3's original coding style





Ditto here.

I did

Re: Regression: can't apply frequency offsets above 1000ppm.

2015-09-02 Thread Miroslav Lichvar
On Wed, Sep 02, 2015 at 02:14:21AM +0100, Nuno Gonçalves wrote:
> On Wed, Sep 2, 2015 at 2:03 AM, John Stultz  wrote:
> > On Tue, Sep 1, 2015 at 5:36 PM, Nuno Gonçalves  wrote:
> >> http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=dc491596f6394382fbc74ad331156207d619fa0a
> >>
> >> I've triple checked it this time. Not sure where I did the mistake to
> >> get it wrong by 3 commits.
> >
> > This commit is much more believable (though surprising as that change
> > was found to greatly improve results for most uses).
> >
> > Can you provide any more details about how the problem is reproduced
> > (kernel config, what userland images are you using, etc)?  I've got a
> > BBB myself so I can try to see whats going on.

> And just installing chrony from the feeds. With any kernel from 3.17
> you'll have wrong estimates at chronyc sourcestats.

Another reproducer is to disable chronyd, set the adjtimex tick to
9000 (e.g. by the adjtimex utility) and observe how is the offset of
the clock changing over time, e.g. by running periodically ntpdate -q
or chronyd -Q. It should be losing about 0.1 second per second, but
the actual frequency offset seems to be much smaller.

> Miroslav also dismissed this being related to nohz after some tests.

Yeah, the problem didn't disappear when the kernel was booted with
nohz=off, so I thought it was something else. Now that it seems it
indeed is related to nohz, I guess it's not a problem with the clock
update interval being too long (which the referenced commit
addressed).

Anyone knows what values (mask, mult, shift, maxadj) has the
clocksource in this case? I'd like to try to reproduce the problem in
the simulator.

-- 
Miroslav Lichvar
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:x86/urgent] x86/mm/srat: Print non-volatile flag in SRAT

2015-09-02 Thread tip-bot for Linda Knippers
Commit-ID:  31e09b18c863718939e3e9c30eee55f9011d85ee
Gitweb: http://git.kernel.org/tip/31e09b18c863718939e3e9c30eee55f9011d85ee
Author: Linda Knippers 
AuthorDate: Tue, 1 Sep 2015 15:41:55 -0400
Committer:  Ingo Molnar 
CommitDate: Wed, 2 Sep 2015 09:33:25 +0200

x86/mm/srat: Print non-volatile flag in SRAT

With the addition of NVDIMM support, a question came up as to
whether NVDIMM ranges should be in the SRAT with this bit set.
I think the consensus was no because the ranges are in the NFIT
with proximity domain information there.

ACPI is not clear on the meaning of this bit in the SRAT.
If someone is setting it, we might want to ask them what they
expect to happen with it.

Right now this bit is only printed if all the ACPI debug
information is turned on.

Signed-off-by: Linda Knippers 
Acked-by: Thomas Gleixner 
Cc: Peter Zijlstra 
Link: http://lkml.kernel.org/r/20150901194154.GA4939@ljkz400
Signed-off-by: Ingo Molnar 
---
 arch/x86/mm/srat.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/arch/x86/mm/srat.c b/arch/x86/mm/srat.c
index 66338a6..c2aea63 100644
--- a/arch/x86/mm/srat.c
+++ b/arch/x86/mm/srat.c
@@ -192,10 +192,11 @@ acpi_numa_memory_affinity_init(struct 
acpi_srat_mem_affinity *ma)
 
node_set(node, numa_nodes_parsed);
 
-   pr_info("SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]%s\n",
+   pr_info("SRAT: Node %u PXM %u [mem %#010Lx-%#010Lx]%s%s\n",
node, pxm,
(unsigned long long) start, (unsigned long long) end - 1,
-   hotpluggable ? " hotplug" : "");
+   hotpluggable ? " hotplug" : "",
+   ma->flags & ACPI_SRAT_MEM_NON_VOLATILE ? " non-volatile" : "");
 
/* Mark hotplug range in memblock. */
if (hotpluggable && memblock_mark_hotplug(start, ma->length))
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v6 1/3] KVM: make halt_poll_ns per-vCPU

2015-09-02 Thread Wanpeng Li
Change halt_poll_ns into per-vCPU variable, seeded from module parameter,
to allow greater flexibility.

Signed-off-by: Wanpeng Li 
---
 include/linux/kvm_host.h | 1 +
 virt/kvm/kvm_main.c  | 5 +++--
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/linux/kvm_host.h b/include/linux/kvm_host.h
index 81089cf..1bef9e2 100644
--- a/include/linux/kvm_host.h
+++ b/include/linux/kvm_host.h
@@ -242,6 +242,7 @@ struct kvm_vcpu {
int sigset_active;
sigset_t sigset;
struct kvm_vcpu_stat stat;
+   unsigned int halt_poll_ns;
 
 #ifdef CONFIG_HAS_IOMEM
int mmio_needed;
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index d8db2f8f..c06e57c 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -217,6 +217,7 @@ int kvm_vcpu_init(struct kvm_vcpu *vcpu, struct kvm *kvm, 
unsigned id)
vcpu->kvm = kvm;
vcpu->vcpu_id = id;
vcpu->pid = NULL;
+   vcpu->halt_poll_ns = 0;
init_waitqueue_head(&vcpu->wq);
kvm_async_pf_vcpu_init(vcpu);
 
@@ -1930,8 +1931,8 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
bool waited = false;
 
start = cur = ktime_get();
-   if (halt_poll_ns) {
-   ktime_t stop = ktime_add_ns(ktime_get(), halt_poll_ns);
+   if (vcpu->halt_poll_ns) {
+   ktime_t stop = ktime_add_ns(ktime_get(), vcpu->halt_poll_ns);
 
do {
/*
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v6 2/3] KVM: dynamic halt_poll_ns adjustment

2015-09-02 Thread Wanpeng Li
There is a downside of always-poll since poll is still happened for idle 
vCPUs which can waste cpu usage. This patch adds the ability to adjust 
halt_poll_ns dynamically, to grow halt_poll_ns when shot halt is detected,  
and to shrink halt_poll_ns when long halt is detected.

There are two new kernel parameters for changing the halt_poll_ns:
halt_poll_ns_grow and halt_poll_ns_shrink. 

no-poll  always-polldynamic-poll
---
Idle (nohz) vCPU %c0 0.15%0.3%0.2%  
Idle (250HZ) vCPU %c01.1% 4.6%~14%1.2%
TCP_RR latency   34us 27us26.7us

"Idle (X) vCPU %c0" is the percent of time the physical cpu spent in
c0 over 60 seconds (each vCPU is pinned to a pCPU). (nohz) means the
guest was tickless. (250HZ) means the guest was ticking at 250HZ.

The big win is with ticking operating systems. Running the linux guest
with nohz=off (and HZ=250), we save 3.4%~12.8% CPUs/second and get close 
to no-polling overhead levels by using the dynamic-poll. The savings
should be even higher for higher frequency ticks.

Suggested-by: David Matlack 
Signed-off-by: Wanpeng Li 
---
 virt/kvm/kvm_main.c | 61 ++---
 1 file changed, 58 insertions(+), 3 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index c06e57c..3cff02f 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -66,9 +66,18 @@
 MODULE_AUTHOR("Qumranet");
 MODULE_LICENSE("GPL");
 
-static unsigned int halt_poll_ns;
+/* halt polling only reduces halt latency by 5-7 us, 500us is enough */
+static unsigned int halt_poll_ns = 50;
 module_param(halt_poll_ns, uint, S_IRUGO | S_IWUSR);
 
+/* Default doubles per-vcpu halt_poll_ns. */
+static unsigned int halt_poll_ns_grow = 2;
+module_param(halt_poll_ns_grow, int, S_IRUGO);
+
+/* Default resets per-vcpu halt_poll_ns . */
+static unsigned int halt_poll_ns_shrink;
+module_param(halt_poll_ns_shrink, int, S_IRUGO);
+
 /*
  * Ordering of locks:
  *
@@ -1907,6 +1916,31 @@ void kvm_vcpu_mark_page_dirty(struct kvm_vcpu *vcpu, 
gfn_t gfn)
 }
 EXPORT_SYMBOL_GPL(kvm_vcpu_mark_page_dirty);
 
+static void grow_halt_poll_ns(struct kvm_vcpu *vcpu)
+{
+   int val = vcpu->halt_poll_ns;
+
+   /* 10us base */
+   if (val == 0 && halt_poll_ns_grow)
+   val = 1;
+   else
+   val *= halt_poll_ns_grow;
+
+   vcpu->halt_poll_ns = val;
+}
+
+static void shrink_halt_poll_ns(struct kvm_vcpu *vcpu)
+{
+   int val = vcpu->halt_poll_ns;
+
+   if (halt_poll_ns_shrink == 0)
+   val = 0;
+   else
+   val /= halt_poll_ns_shrink;
+
+   vcpu->halt_poll_ns = val;
+}
+
 static int kvm_vcpu_check_block(struct kvm_vcpu *vcpu)
 {
if (kvm_arch_vcpu_runnable(vcpu)) {
@@ -1929,6 +1963,7 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
ktime_t start, cur;
DEFINE_WAIT(wait);
bool waited = false;
+   u64 poll_ns = 0, wait_ns = 0, block_ns = 0;
 
start = cur = ktime_get();
if (vcpu->halt_poll_ns) {
@@ -1941,10 +1976,15 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
 */
if (kvm_vcpu_check_block(vcpu) < 0) {
++vcpu->stat.halt_successful_poll;
-   goto out;
+   break;
}
cur = ktime_get();
} while (single_task_running() && ktime_before(cur, stop));
+
+   if (ktime_before(cur, stop)) {
+   poll_ns = ktime_to_ns(cur) - ktime_to_ns(start);
+   goto out;
+   }
}
 
for (;;) {
@@ -1959,9 +1999,24 @@ void kvm_vcpu_block(struct kvm_vcpu *vcpu)
 
finish_wait(&vcpu->wq, &wait);
cur = ktime_get();
+   wait_ns = ktime_to_ns(cur) - ktime_to_ns(start);
 
 out:
-   trace_kvm_vcpu_wakeup(ktime_to_ns(cur) - ktime_to_ns(start), waited);
+   block_ns = poll_ns + wait_ns;
+
+   if (halt_poll_ns) {
+   if (block_ns <= vcpu->halt_poll_ns)
+   ;
+   /* we had a long block, shrink polling */
+   else if (vcpu->halt_poll_ns && block_ns > halt_poll_ns)
+   shrink_halt_poll_ns(vcpu);
+   /* we had a short halt and our poll time is too small */
+   else if (vcpu->halt_poll_ns < halt_poll_ns &&
+   block_ns < halt_poll_ns)
+   grow_halt_poll_ns(vcpu);
+   }
+
+   trace_kvm_vcpu_wakeup(block_ns, waited);
 }
 EXPORT_SYMBOL_GPL(kvm_vcpu_block);
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  htt

[PATCH v6 0/3] KVM: Dynamic Halt-Polling

2015-09-02 Thread Wanpeng Li
v5 -> v6:
 * fix wait_ns and poll_ns 

v4 -> v5:
 * set base case 10us and max poll time 500us
 * handle short/long halt, idea from David, many thanks David ;-)

v3 -> v4:
 * bring back grow vcpu->halt_poll_ns when interrupt arrives and shrinks
   when idle VCPU is detected 

v2 -> v3:
 * grow/shrink vcpu->halt_poll_ns by *halt_poll_ns_grow or /halt_poll_ns_shrink
 * drop the macros and hard coding the numbers in the param definitions
 * update the comments "5-7 us"
 * remove halt_poll_ns_max and use halt_poll_ns as the max halt_poll_ns time,
   vcpu->halt_poll_ns start at zero
 * drop the wrappers 
 * move the grow/shrink logic before "out:" w/ "if (waited)"

v1 -> v2:
 * change kvm_vcpu_block to read halt_poll_ns from the vcpu instead of 
   the module parameter
 * use the shrink/grow matrix which is suggested by David
 * set halt_poll_ns_max to 2ms

There is a downside of always-poll since poll is still happened for idle 
vCPUs which can waste cpu usage. This patchset add the ability to adjust 
halt_poll_ns dynamically, to grow halt_poll_ns when shot halt is detected,  
and to shrink halt_poll_ns when long halt is detected.

There are two new kernel parameters for changing the halt_poll_ns:
halt_poll_ns_grow and halt_poll_ns_shrink. 

no-poll  always-polldynamic-poll
---
Idle (nohz) vCPU %c0 0.15%0.3%0.2%  
Idle (250HZ) vCPU %c01.1% 4.6%~14%1.2%
TCP_RR latency   34us 27us26.7us

"Idle (X) vCPU %c0" is the percent of time the physical cpu spent in
c0 over 60 seconds (each vCPU is pinned to a pCPU). (nohz) means the
guest was tickless. (250HZ) means the guest was ticking at 250HZ.

The big win is with ticking operating systems. Running the linux guest
with nohz=off (and HZ=250), we save 3.4%~12.8% CPUs/second and get close 
to no-polling overhead levels by using the dynamic-poll. The savings
should be even higher for higher frequency ticks.


Wanpeng Li (3):
  KVM: make halt_poll_ns per-vCPU
  KVM: dynamic halt_poll_ns adjustment
  KVM: trace kvm_halt_poll_ns grow/shrink

 include/linux/kvm_host.h   |  1 +
 include/trace/events/kvm.h | 30 
 virt/kvm/kvm_main.c| 70 ++
 3 files changed, 96 insertions(+), 5 deletions(-)

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux-next: build failure after merge of the rcu tree

2015-09-02 Thread Ingo Molnar

* Paul E. McKenney  wrote:

> On Tue, Sep 01, 2015 at 11:40:51PM -0700, Davidlohr Bueso wrote:
> > On Tue, 2015-09-01 at 22:26 -0700, Paul E. McKenney wrote:
> > > Davidlohr, the error is due to sched_setscheduler_nocheck() not being
> > > exported, so that Stephen gets this failure when building modules.
> > > This is 04be76a9b067 (locktorture: Support rtmutex torturing) in -rcu.
> > > 
> > > Thoughts?
> > 
> > Right, the below should take care of it. Although I think it makes sense
> > to get this into at least 4.3 even if we won't use it until 4.4. Simply
> > because we already export sched_setscheduler(). If you agree I guess we
> > could route via -tip.
> 
> Given an ack from Peter or Ingo, I would happy to queue it.  But we are
> talking 4.4 rather than 4.3, sorry!

The export looks good to me:

Acked-by: Ingo Molnar 

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/urgent] perf tools: Fix link time error with sample_reg_masks on non x86

2015-09-02 Thread tip-bot for Stephane Eranian
Commit-ID:  af4aeadd8c04303c0aa2d112145c3627e2ebd026
Gitweb: http://git.kernel.org/tip/af4aeadd8c04303c0aa2d112145c3627e2ebd026
Author: Stephane Eranian 
AuthorDate: Tue, 1 Sep 2015 11:30:14 +0200
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 1 Sep 2015 13:04:41 -0300

perf tools: Fix link time error with sample_reg_masks on non x86

This patch makes perf compile on non x86 platforms by defining a weak
symbol for sample_reg_masks[] in util/perf_regs.c.

The patch also moves the REG() and REG_END() macros into the
util/per_regs.h header file. The macros are renamed to
SMPL_REG/SMPL_REG_END to avoid clashes with other header files.

Signed-off-by: Stephane Eranian 
Acked-by: Jiri Olsa 
Cc: Adrian Hunter 
Cc: Andi Kleen 
Cc: David Ahern 
Cc: Kan Liang 
Cc: Namhyung Kim 
Cc: Peter Zijlstra 
Link: 
http://lkml.kernel.org/r/1441099814-26783-1-git-send-email-eran...@google.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/arch/x86/util/perf_regs.c | 44 +---
 tools/perf/util/perf_regs.c  |  4 
 tools/perf/util/perf_regs.h  |  2 ++
 3 files changed, 27 insertions(+), 23 deletions(-)

diff --git a/tools/perf/arch/x86/util/perf_regs.c 
b/tools/perf/arch/x86/util/perf_regs.c
index 087c84e..c5db14f 100644
--- a/tools/perf/arch/x86/util/perf_regs.c
+++ b/tools/perf/arch/x86/util/perf_regs.c
@@ -1,30 +1,28 @@
 #include "../../perf.h"
 #include "../../util/perf_regs.h"
 
-#define REG(n, b) { .name = #n, .mask = 1ULL << (b) }
-#define REG_END { .name = NULL }
 const struct sample_reg sample_reg_masks[] = {
-   REG(AX, PERF_REG_X86_AX),
-   REG(BX, PERF_REG_X86_BX),
-   REG(CX, PERF_REG_X86_CX),
-   REG(DX, PERF_REG_X86_DX),
-   REG(SI, PERF_REG_X86_SI),
-   REG(DI, PERF_REG_X86_DI),
-   REG(BP, PERF_REG_X86_BP),
-   REG(SP, PERF_REG_X86_SP),
-   REG(IP, PERF_REG_X86_IP),
-   REG(FLAGS, PERF_REG_X86_FLAGS),
-   REG(CS, PERF_REG_X86_CS),
-   REG(SS, PERF_REG_X86_SS),
+   SMPL_REG(AX, PERF_REG_X86_AX),
+   SMPL_REG(BX, PERF_REG_X86_BX),
+   SMPL_REG(CX, PERF_REG_X86_CX),
+   SMPL_REG(DX, PERF_REG_X86_DX),
+   SMPL_REG(SI, PERF_REG_X86_SI),
+   SMPL_REG(DI, PERF_REG_X86_DI),
+   SMPL_REG(BP, PERF_REG_X86_BP),
+   SMPL_REG(SP, PERF_REG_X86_SP),
+   SMPL_REG(IP, PERF_REG_X86_IP),
+   SMPL_REG(FLAGS, PERF_REG_X86_FLAGS),
+   SMPL_REG(CS, PERF_REG_X86_CS),
+   SMPL_REG(SS, PERF_REG_X86_SS),
 #ifdef HAVE_ARCH_X86_64_SUPPORT
-   REG(R8, PERF_REG_X86_R8),
-   REG(R9, PERF_REG_X86_R9),
-   REG(R10, PERF_REG_X86_R10),
-   REG(R11, PERF_REG_X86_R11),
-   REG(R12, PERF_REG_X86_R12),
-   REG(R13, PERF_REG_X86_R13),
-   REG(R14, PERF_REG_X86_R14),
-   REG(R15, PERF_REG_X86_R15),
+   SMPL_REG(R8, PERF_REG_X86_R8),
+   SMPL_REG(R9, PERF_REG_X86_R9),
+   SMPL_REG(R10, PERF_REG_X86_R10),
+   SMPL_REG(R11, PERF_REG_X86_R11),
+   SMPL_REG(R12, PERF_REG_X86_R12),
+   SMPL_REG(R13, PERF_REG_X86_R13),
+   SMPL_REG(R14, PERF_REG_X86_R14),
+   SMPL_REG(R15, PERF_REG_X86_R15),
 #endif
-   REG_END
+   SMPL_REG_END
 };
diff --git a/tools/perf/util/perf_regs.c b/tools/perf/util/perf_regs.c
index 43168fb..885e8ac 100644
--- a/tools/perf/util/perf_regs.c
+++ b/tools/perf/util/perf_regs.c
@@ -2,6 +2,10 @@
 #include "perf_regs.h"
 #include "event.h"
 
+const struct sample_reg __weak sample_reg_masks[] = {
+   SMPL_REG_END
+};
+
 int perf_reg_value(u64 *valp, struct regs_dump *regs, int id)
 {
int i, idx = 0;
diff --git a/tools/perf/util/perf_regs.h b/tools/perf/util/perf_regs.h
index 92c1fff..2984dcc 100644
--- a/tools/perf/util/perf_regs.h
+++ b/tools/perf/util/perf_regs.h
@@ -9,6 +9,8 @@ struct sample_reg {
const char *name;
uint64_t mask;
 };
+#define SMPL_REG(n, b) { .name = #n, .mask = 1ULL << (b) }
+#define SMPL_REG_END { .name = NULL }
 
 extern const struct sample_reg sample_reg_masks[];
 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/urgent] perf build: Fix Intel PT instruction decoder dependency problem

2015-09-02 Thread tip-bot for Wang Nan
Commit-ID:  04aa90b529ee45c5ee88997bc214202e07b26979
Gitweb: http://git.kernel.org/tip/04aa90b529ee45c5ee88997bc214202e07b26979
Author: Wang Nan 
AuthorDate: Tue, 1 Sep 2015 05:56:45 +
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 1 Sep 2015 13:03:46 -0300

perf build: Fix Intel PT instruction decoder dependency problem

I hit following building error randomly:

...
  /bin/sh: /path/to/kernel/buildperf/util/intel-pt-decoder/inat-tables.c: No 
such file or directory
...
LINK /path/to/kernel/buildperf/plugin_mac80211.so
LINK /path/to/kernel/buildperf/plugin_kmem.so
LINK /path/to/kernel/buildperf/plugin_xen.so
LINK /path/to/kernel/buildperf/plugin_hrtimer.so
  In file included from util/intel-pt-decoder/intel-pt-insn-decoder.c:25:0:
  util/intel-pt-decoder/inat.c:24:25: fatal error: inat-tables.c: No such file 
or directory
   #include "inat-tables.c"
   ^
  compilation terminated.
  make[4]: *** 
[/path/to/kernel/buildperf/util/intel-pt-decoder/intel-pt-insn-decoder.o] Error 
1
  make[4]: *** Waiting for unfinished jobs
LINK /path/to/kernel/buildperf/plugin_function.so

This is caused by tools/perf/util/intel-pt-decoder/Build that, it tries
to generate $(OUTPUT)util/intel-pt-decoder/inat-tables.c atomatically
but forget to ensure the existance of $(OUTPUT)util/intel-pt-decoder
directory.

This patch fixes it by adding $(call rule_mkdir) like other similar rules.

Signed-off-by: Wang Nan 
Acked-by: Adrian Hunter 
Acked-by: Jiri Olsa 
Cc: Zefan Li 
Cc: pi3or...@163.com
Link: 
http://lkml.kernel.org/r/1441087005-107540-1-git-send-email-wangn...@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/util/intel-pt-decoder/Build | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tools/perf/util/intel-pt-decoder/Build 
b/tools/perf/util/intel-pt-decoder/Build
index 240730d..2386322 100644
--- a/tools/perf/util/intel-pt-decoder/Build
+++ b/tools/perf/util/intel-pt-decoder/Build
@@ -4,6 +4,7 @@ inat_tables_script = util/intel-pt-decoder/gen-insn-attr-x86.awk
 inat_tables_maps = util/intel-pt-decoder/x86-opcode-map.txt
 
 $(OUTPUT)util/intel-pt-decoder/inat-tables.c: $(inat_tables_script) 
$(inat_tables_maps)
+   $(call rule_mkdir)
@$(call echo-cmd,gen)$(AWK) -f $(inat_tables_script) 
$(inat_tables_maps) > $@ || rm -f $@
 
 $(OUTPUT)util/intel-pt-decoder/intel-pt-insn-decoder.o: 
util/intel-pt-decoder/inat.c $(OUTPUT)util/intel-pt-decoder/inat-tables.c
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[tip:perf/urgent] perf dwarf: Fix potential array out of bounds access

2015-09-02 Thread tip-bot for Wang Nan
Commit-ID:  3b27d13940c3710a1128527c43719cb0bb05d73b
Gitweb: http://git.kernel.org/tip/3b27d13940c3710a1128527c43719cb0bb05d73b
Author: Wang Nan 
AuthorDate: Tue, 1 Sep 2015 03:29:44 +
Committer:  Arnaldo Carvalho de Melo 
CommitDate: Tue, 1 Sep 2015 11:33:48 -0300

perf dwarf: Fix potential array out of bounds access

There is a problem in the dwarf-regs.c files for sh, sparc and x86 where
it is possible to make an out-of-bounds array access when searching for
register names.

This patch fixes it by replacing '<=' to '<', so when register (number
== XXX_MAX_REGS), get_arch_regstr() will return NULL.

Signed-off-by: Wang Nan 
Reviewed-by: Matt Fleming 
Acked-by: Jiri Olsa 
Acked-by: Masami Hiramatsu 
Cc: David S. Miller 
Cc: Zefan Li 
Cc: pi3or...@huawei.com
Link: 
http://lkml.kernel.org/r/1441078184-105038-1-git-send-email-wangn...@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo 
---
 tools/perf/arch/sh/util/dwarf-regs.c| 2 +-
 tools/perf/arch/sparc/util/dwarf-regs.c | 2 +-
 tools/perf/arch/x86/util/dwarf-regs.c   | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/perf/arch/sh/util/dwarf-regs.c 
b/tools/perf/arch/sh/util/dwarf-regs.c
index 0d0897f..f8dfa89 100644
--- a/tools/perf/arch/sh/util/dwarf-regs.c
+++ b/tools/perf/arch/sh/util/dwarf-regs.c
@@ -51,5 +51,5 @@ const char *sh_regs_table[SH_MAX_REGS] = {
 /* Return architecture dependent register string (for kprobe-tracer) */
 const char *get_arch_regstr(unsigned int n)
 {
-   return (n <= SH_MAX_REGS) ? sh_regs_table[n] : NULL;
+   return (n < SH_MAX_REGS) ? sh_regs_table[n] : NULL;
 }
diff --git a/tools/perf/arch/sparc/util/dwarf-regs.c 
b/tools/perf/arch/sparc/util/dwarf-regs.c
index 92eda41..b704fdb 100644
--- a/tools/perf/arch/sparc/util/dwarf-regs.c
+++ b/tools/perf/arch/sparc/util/dwarf-regs.c
@@ -39,5 +39,5 @@ const char *sparc_regs_table[SPARC_MAX_REGS] = {
  */
 const char *get_arch_regstr(unsigned int n)
 {
-   return (n <= SPARC_MAX_REGS) ? sparc_regs_table[n] : NULL;
+   return (n < SPARC_MAX_REGS) ? sparc_regs_table[n] : NULL;
 }
diff --git a/tools/perf/arch/x86/util/dwarf-regs.c 
b/tools/perf/arch/x86/util/dwarf-regs.c
index be22dd4..a08de0a 100644
--- a/tools/perf/arch/x86/util/dwarf-regs.c
+++ b/tools/perf/arch/x86/util/dwarf-regs.c
@@ -71,5 +71,5 @@ const char *x86_64_regs_table[X86_64_MAX_REGS] = {
 /* Return architecture dependent register string (for kprobe-tracer) */
 const char *get_arch_regstr(unsigned int n)
 {
-   return (n <= ARCH_MAX_REGS) ? arch_regs_table[n] : NULL;
+   return (n < ARCH_MAX_REGS) ? arch_regs_table[n] : NULL;
 }
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V2 Resend 2/5] PM / OPP: Prefix exported opp routines with dev_pm_opp_

2015-09-02 Thread Viresh Kumar
On 02-09-15, 12:52, Viresh Kumar wrote:
> On 01-09-15, 21:03, Pavel Machek wrote:
> > Is ..._free_table opposite of ..._init_opp? If so, you might want to
> > name them such that it is clear...
> 
> Yes, it is opposite of that. Okay, so here is a new patch for this,
> lemme know if this looks fine. I will then resend the whole series
> again..
> 
> @Stephen: Thanks for your reviews, just few more to go (in this
> series) :).
> 
> 
> Message-Id: 
> 
> From: Viresh Kumar 
> Date: Wed, 2 Sep 2015 11:23:44 +0530
> Subject: [PATCH 1/3] PM / OPP: Rename opp init/free table routines

And here is the new updated version of $SUBJECT patch rebased over
above commit:

@Stephen: I have dropped your Reviewed-by tag as this patch got
updated. Please give it again.

8<-

From: Viresh Kumar 
Date: Mon, 3 Aug 2015 14:34:23 +0530
Subject: [PATCH 2/3] PM / OPP: Prefix exported opp routines with dev_pm_opp_

That's the naming convention followed in most of opp core, but few
routines didn't follow this, fix them.

Signed-off-by: Viresh Kumar 
---
 arch/arm/mach-imx/mach-imx6q.c   |  2 +-
 drivers/base/power/opp.c | 41 ++--
 drivers/cpufreq/arm_big_little.h |  2 +-
 drivers/cpufreq/arm_big_little_dt.c  |  4 ++--
 drivers/cpufreq/cpufreq-dt.c | 10 -
 drivers/cpufreq/exynos5440-cpufreq.c |  6 +++---
 drivers/cpufreq/imx6q-cpufreq.c  |  6 +++---
 drivers/cpufreq/mt8173-cpufreq.c |  6 +++---
 include/linux/pm_opp.h   | 24 ++---
 9 files changed, 51 insertions(+), 50 deletions(-)

diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 3286eec91d92..3878494bd118 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -350,7 +350,7 @@ static void __init imx6q_opp_init(void)
return;
}
 
-   if (of_add_opp_table(cpu_dev)) {
+   if (dev_pm_opp_of_add_table(cpu_dev)) {
pr_warn("failed to init OPP table\n");
goto put_node;
}
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index 1515c05bc579..f42ffa517156 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -800,8 +800,8 @@ static int _opp_add(struct device *dev, struct dev_pm_opp 
*new_opp,
  * The opp is made available by default and it can be controlled using
  * dev_pm_opp_enable/disable functions and may be removed by dev_pm_opp_remove.
  *
- * NOTE: "dynamic" parameter impacts OPPs added by the of_add_opp_table and
- * freed by of_remove_opp_table.
+ * NOTE: "dynamic" parameter impacts OPPs added by the dev_pm_opp_of_add_table
+ * and freed by dev_pm_opp_of_remove_table.
  *
  * Locking: The internal device_opp and opp structures are RCU protected.
  * Hence this function internally uses RCU updater strategy with mutex locks
@@ -1185,7 +1185,8 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_notifier);
 
 #ifdef CONFIG_OF
 /**
- * of_remove_opp_table() - Free OPP table entries created from static DT 
entries
+ * dev_pm_opp_of_remove_table() - Free OPP table entries created from static DT
+ *   entries
  * @dev:   device pointer used to lookup device OPPs.
  *
  * Free OPPs created using static entries present in DT.
@@ -1196,7 +1197,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_notifier);
  * that this function is *NOT* called under RCU protection or in contexts where
  * mutex cannot be locked.
  */
-void of_remove_opp_table(struct device *dev)
+void dev_pm_opp_of_remove_table(struct device *dev)
 {
struct device_opp *dev_opp;
struct dev_pm_opp *opp, *tmp;
@@ -1231,9 +1232,9 @@ void of_remove_opp_table(struct device *dev)
 unlock:
mutex_unlock(&dev_opp_list_lock);
 }
-EXPORT_SYMBOL_GPL(of_remove_opp_table);
+EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table);
 
-void of_cpumask_remove_opp_table(cpumask_var_t cpumask)
+void dev_pm_opp_of_cpumask_remove_table(cpumask_var_t cpumask)
 {
struct device *cpu_dev;
int cpu;
@@ -1248,10 +1249,10 @@ void of_cpumask_remove_opp_table(cpumask_var_t cpumask)
continue;
}
 
-   of_remove_opp_table(cpu_dev);
+   dev_pm_opp_of_remove_table(cpu_dev);
}
 }
-EXPORT_SYMBOL_GPL(of_cpumask_remove_opp_table);
+EXPORT_SYMBOL_GPL(dev_pm_opp_of_cpumask_remove_table);
 
 /* Returns opp descriptor node for a device, caller must do of_node_put() */
 static struct device_node *_of_get_opp_desc_node(struct device *dev)
@@ -1309,7 +1310,7 @@ static int _of_add_opp_table_v2(struct device *dev, 
struct device_node *opp_np)
return 0;
 
 free_table:
-   of_remove_opp_table(dev);
+   dev_pm_opp_of_remove_table(dev);
 
return ret;
 }
@@ -1352,7 +1353,7 @@ static int _of_add_opp_table_v1(struct device *dev)
 }
 
 /**
- * of_add_opp_table() - Initialize opp table from device tree
+ * dev_pm_opp_of_add_table() - Initialize opp tabl

Re: [GIT PULL 0/3] perf/urgent fixes

2015-09-02 Thread Ingo Molnar

* Arnaldo Carvalho de Melo  wrote:

> Hi Ingo,
> 
>   Please consider pulling,
> 
> - Arnaldo
> 
> The following changes since commit 532026612455a4a6fd27c1b2e7111263f63218a2:
> 
>   Merge tag 'perf-core-for-mingo' of 
> git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent 
> (2015-09-01 10:25:57 +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 af4aeadd8c04303c0aa2d112145c3627e2ebd026:
> 
>   perf tools: Fix link time error with sample_reg_masks on non x86 
> (2015-09-01 13:04:41 -0300)
> 
> 
> perf/urgent fixes:
> 
> - Fix link time error with sample_reg_masks on non x86 (Stephane Eranian)
> 
> - Fix potential array out of bounds access (Wang Nan)
> 
> - Fix Intel PT instruction decoder dependency problem (Wang Nan)
> 
> Signed-off-by: Arnaldo Carvalho de Melo 
> 
> 
> Stephane Eranian (1):
>   perf tools: Fix link time error with sample_reg_masks on non x86
> 
> Wang Nan (2):
>   perf dwarf: Fix potential array out of bounds access
>   perf build: Fix Intel PT instruction decoder dependency problem
> 
>  tools/perf/arch/sh/util/dwarf-regs.c|  2 +-
>  tools/perf/arch/sparc/util/dwarf-regs.c |  2 +-
>  tools/perf/arch/x86/util/dwarf-regs.c   |  2 +-
>  tools/perf/arch/x86/util/perf_regs.c| 44 
> -
>  tools/perf/util/intel-pt-decoder/Build  |  1 +
>  tools/perf/util/perf_regs.c |  4 +++
>  tools/perf/util/perf_regs.h |  2 ++
>  7 files changed, 31 insertions(+), 26 deletions(-)

Pulled, thanks a lot Arnaldo!

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V2 Resend 2/5] PM / OPP: Prefix exported opp routines with dev_pm_opp_

2015-09-02 Thread Viresh Kumar
On 01-09-15, 21:03, Pavel Machek wrote:
> Is ..._free_table opposite of ..._init_opp? If so, you might want to
> name them such that it is clear...

Yes, it is opposite of that. Okay, so here is a new patch for this,
lemme know if this looks fine. I will then resend the whole series
again..

@Stephen: Thanks for your reviews, just few more to go (in this
series) :).


Message-Id: 

From: Viresh Kumar 
Date: Wed, 2 Sep 2015 11:23:44 +0530
Subject: [PATCH 1/3] PM / OPP: Rename opp init/free table routines

free-table routines are opposite of init-table ones, and must be named
to make that clear. Opposite of 'init' is 'exit', but those doesn't suit
really well.

Replace 'init' with 'add' and 'free' with 'remove'.

Reported-by: Pavel Machek 
Signed-off-by: Viresh Kumar 
---
 arch/arm/mach-imx/mach-imx6q.c   |  2 +-
 drivers/base/power/opp.c | 41 ++--
 drivers/cpufreq/arm_big_little.h |  2 +-
 drivers/cpufreq/arm_big_little_dt.c  |  4 ++--
 drivers/cpufreq/cpufreq-dt.c |  6 +++---
 drivers/cpufreq/exynos5440-cpufreq.c |  6 +++---
 drivers/cpufreq/imx6q-cpufreq.c  |  6 +++---
 drivers/cpufreq/mt8173-cpufreq.c |  6 +++---
 include/linux/pm_opp.h   | 16 +++---
 9 files changed, 44 insertions(+), 45 deletions(-)

diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 9602cc12d2f1..3286eec91d92 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -350,7 +350,7 @@ static void __init imx6q_opp_init(void)
return;
}
 
-   if (of_init_opp_table(cpu_dev)) {
+   if (of_add_opp_table(cpu_dev)) {
pr_warn("failed to init OPP table\n");
goto put_node;
}
diff --git a/drivers/base/power/opp.c b/drivers/base/power/opp.c
index 4741fdc13e83..1515c05bc579 100644
--- a/drivers/base/power/opp.c
+++ b/drivers/base/power/opp.c
@@ -800,8 +800,8 @@ static int _opp_add(struct device *dev, struct dev_pm_opp 
*new_opp,
  * The opp is made available by default and it can be controlled using
  * dev_pm_opp_enable/disable functions and may be removed by dev_pm_opp_remove.
  *
- * NOTE: "dynamic" parameter impacts OPPs added by the of_init_opp_table and
- * freed by of_free_opp_table.
+ * NOTE: "dynamic" parameter impacts OPPs added by the of_add_opp_table and
+ * freed by of_remove_opp_table.
  *
  * Locking: The internal device_opp and opp structures are RCU protected.
  * Hence this function internally uses RCU updater strategy with mutex locks
@@ -1185,7 +1185,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_notifier);
 
 #ifdef CONFIG_OF
 /**
- * of_free_opp_table() - Free OPP table entries created from static DT entries
+ * of_remove_opp_table() - Free OPP table entries created from static DT 
entries
  * @dev:   device pointer used to lookup device OPPs.
  *
  * Free OPPs created using static entries present in DT.
@@ -1196,7 +1196,7 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_get_notifier);
  * that this function is *NOT* called under RCU protection or in contexts where
  * mutex cannot be locked.
  */
-void of_free_opp_table(struct device *dev)
+void of_remove_opp_table(struct device *dev)
 {
struct device_opp *dev_opp;
struct dev_pm_opp *opp, *tmp;
@@ -1231,9 +1231,9 @@ void of_free_opp_table(struct device *dev)
 unlock:
mutex_unlock(&dev_opp_list_lock);
 }
-EXPORT_SYMBOL_GPL(of_free_opp_table);
+EXPORT_SYMBOL_GPL(of_remove_opp_table);
 
-void of_cpumask_free_opp_table(cpumask_var_t cpumask)
+void of_cpumask_remove_opp_table(cpumask_var_t cpumask)
 {
struct device *cpu_dev;
int cpu;
@@ -1248,10 +1248,10 @@ void of_cpumask_free_opp_table(cpumask_var_t cpumask)
continue;
}
 
-   of_free_opp_table(cpu_dev);
+   of_remove_opp_table(cpu_dev);
}
 }
-EXPORT_SYMBOL_GPL(of_cpumask_free_opp_table);
+EXPORT_SYMBOL_GPL(of_cpumask_remove_opp_table);
 
 /* Returns opp descriptor node for a device, caller must do of_node_put() */
 static struct device_node *_of_get_opp_desc_node(struct device *dev)
@@ -1267,8 +1267,7 @@ static struct device_node *_of_get_opp_desc_node(struct 
device *dev)
 }
 
 /* Initializes OPP tables based on new bindings */
-static int _of_init_opp_table_v2(struct device *dev,
-struct device_node *opp_np)
+static int _of_add_opp_table_v2(struct device *dev, struct device_node *opp_np)
 {
struct device_node *np;
struct device_opp *dev_opp;
@@ -1310,13 +1309,13 @@ static int _of_init_opp_table_v2(struct device *dev,
return 0;
 
 free_table:
-   of_free_opp_table(dev);
+   of_remove_opp_table(dev);
 
return ret;
 }
 
 /* Initializes OPP tables based on old-deprecated bindings */
-static int _of_init_opp_table_v1(struct device *dev)
+static int _of_add_opp_table_v1(struct device *dev)
 {
const struct property *prop;
const __be32 *val;
@@ -13

Re: linux-next: build failure after merge of the rcu tree

2015-09-02 Thread Paul E. McKenney
On Tue, Sep 01, 2015 at 11:40:51PM -0700, Davidlohr Bueso wrote:
> On Tue, 2015-09-01 at 22:26 -0700, Paul E. McKenney wrote:
> > Davidlohr, the error is due to sched_setscheduler_nocheck() not being
> > exported, so that Stephen gets this failure when building modules.
> > This is 04be76a9b067 (locktorture: Support rtmutex torturing) in -rcu.
> > 
> > Thoughts?
> 
> Right, the below should take care of it. Although I think it makes sense
> to get this into at least 4.3 even if we won't use it until 4.4. Simply
> because we already export sched_setscheduler(). If you agree I guess we
> could route via -tip.

Given an ack from Peter or Ingo, I would happy to queue it.  But we are
talking 4.4 rather than 4.3, sorry!

Thanx, Paul

> Thanks,
> Davidlohr
> 
> 8<
> Subject: [PATCH -next] sched: Export sched_setscheduler_nocheck
> 
> ... just like regular sched_setscheduler(). We need this, for locktorture
> otherwise we can fail to build modules, ie:
> 
> ERROR: "sched_setscheduler_nocheck" [kernel/locking/locktorture.ko] undefined!
> 
> Signed-off-by: Davidlohr Bueso 
> Reported-by: Stephen Rothwell 
> Cc: Ingo Molnar 
> ---
>  kernel/sched/core.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 3595403..7b51f64 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -4012,6 +4012,7 @@ int sched_setscheduler_nocheck(struct task_struct *p, 
> int policy,
>  {
>   return _sched_setscheduler(p, policy, param, false);
>  }
> +EXPORT_SYMBOL_GPL(sched_setscheduler_nocheck);
> 
>  static int
>  do_sched_setscheduler(pid_t pid, int policy, struct sched_param __user 
> *param)
> -- 
> 2.1.4
> 
> 
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH V2 Resend 3/5] PM / OPP: Move opp core to its own directory

2015-09-02 Thread Viresh Kumar
On 01-09-15, 15:51, Stephen Boyd wrote:
> It's odd that we use CONFIG_DEBUG_DRIVER here when that's talking
> about debugging the driver core. I wonder why this wouldn't be
> some OPP specific debug config option instead. But that was
> already there before so this topic is for another patch.

I agree.. Maybe a separate patch to add Kconfig for both
drivers/base/power and drivers/base/power/opp directories.

-- 
viresh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [RFC 2/3] mmc: sdhci: add host_ops->voltage_switch callback for all other voltages

2015-09-02 Thread Jisheng Zhang
On Wed, 2 Sep 2015 01:02:17 +0530
Vaibhav Hiremath  wrote:

> Currently, the sdhci_do_start_signal_voltage_switch() function invokes
> controller specific voltage switch configuration only for 1.8v usecase;
> but it is required for others as well.
> 
> For example, in case of PXA1928 SDH controller, we need to set different
> configuration for 3.3, 1.8 and 1.2 volt support (I/O domain power
> control register).
> 
> Signed-off-by: Vaibhav Hiremath 
> ---
> Note:
> Currently ->voltage_switch() callback is only supported
> in f_sdh30 driver. And I am not sure on the dependency of execution
> sequence for that device. I could have moved ->voltage_switch() call
> at one common place (above/below), but was not quite sure about it.
> So, replicated/duplicated the call for other voltages.
> 
>  drivers/mmc/host/sdhci.c | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
> index 3dd295f..b59b76d 100644
> --- a/drivers/mmc/host/sdhci.c
> +++ b/drivers/mmc/host/sdhci.c
> @@ -1753,6 +1753,10 @@ static int sdhci_do_start_signal_voltage_switch(struct 
> sdhci_host *host,
>   /* Wait for 5ms */
>   usleep_range(5000, 5500);
>  
> + /* Some controller need to do more when switching */
> + if (host->ops->voltage_switch)
> + host->ops->voltage_switch(host, MMC_SIGNAL_VOLTAGE_330);

Could this be implemented by regulator API? From patch set 3/3, the pxa1928
voltage_switch hook is to operate the IO pad registers, this seems not belong
to the SDHC IP core.

Thanks,
Jisheng

> +
>   /* 3.3V regulator output should be stable within 5 ms */
>   ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2);
>   if (!(ctrl & SDHCI_CTRL_VDD_180))
> @@ -1803,6 +1807,10 @@ static int sdhci_do_start_signal_voltage_switch(struct 
> sdhci_host *host,
>   return -EIO;
>   }
>   }
> + /* Some controller need to do more when switching */
> + if (host->ops->voltage_switch)
> + host->ops->voltage_switch(host, MMC_SIGNAL_VOLTAGE_120);
> +
>   return 0;
>   default:
>   /* No signal voltage switch required */

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/3] rhashtable-test: retry insert operations in threads

2015-09-02 Thread Thomas Graf
On 09/02/15 at 10:00am, Herbert Xu wrote:
> On Tue, Sep 01, 2015 at 04:51:24PM +0200, Thomas Graf wrote:
> >
> > 1. The current in-kernel self-test
> > 2. bind_netlink.c: https://github.com/tgraf/rhashtable
> 
> Thanks, I will try to reproduce this.

The path in question is:

int rhashtable_insert_rehash(struct rhashtable *ht)
{
[...]

old_tbl = rht_dereference_rcu(ht->tbl, ht);
tbl = rhashtable_last_table(ht, old_tbl);

size = tbl->size;

if (rht_grow_above_75(ht, tbl))
size *= 2;
/* Do not schedule more than one rehash */
else if (old_tbl != tbl)
return -EBUSY;

The behaviour in question is the immediate rehash during
insertion which we want to fail.

Commits:
ccd57b1bd32460d27bbb9c599e795628a3c66983
a87b9ebf1709687ff213091d0fdb4254b1564803
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] kvm: irqchip: fix memory leak

2015-09-02 Thread Sudip Mukherjee
We were taking the exit path after checking ue->flags and return value
of setup_routing_entry(), but 'e' was not freed incase of a failure.

Signed-off-by: Sudip Mukherjee 
---
 virt/kvm/irqchip.c | 8 ++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/virt/kvm/irqchip.c b/virt/kvm/irqchip.c
index 21c1424..c63e54f 100644
--- a/virt/kvm/irqchip.c
+++ b/virt/kvm/irqchip.c
@@ -213,11 +213,15 @@ int kvm_set_irq_routing(struct kvm *kvm,
goto out;
 
r = -EINVAL;
-   if (ue->flags)
+   if (ue->flags) {
+   kfree(e);
goto out;
+   }
r = setup_routing_entry(new, e, ue);
-   if (r)
+   if (r) {
+   kfree(e);
goto out;
+   }
++ue;
}
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


<    3   4   5   6   7   8