[PATCH 2/3] modpost: merge module iterations

2018-11-22 Thread Masahiro Yamada
Probably, this is just a matter of the order of error/warning
messages. Merge the two for-loops.

Signed-off-by: Masahiro Yamada 
---

 scripts/mod/modpost.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 39432c2..05e41eb 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -2484,12 +2484,6 @@ int main(int argc, char **argv)
if (files_source)
read_symbols_from_files(files_source);
 
-   for (mod = modules; mod; mod = mod->next) {
-   if (mod->skip)
-   continue;
-   check_exports(mod);
-   }
-
err = 0;
 
for (mod = modules; mod; mod = mod->next) {
@@ -2501,6 +2495,7 @@ int main(int argc, char **argv)
buf.pos = 0;
 
err |= check_modname_len(mod);
+   check_exports(mod);
add_header(, mod);
add_intree_flag(, !external_module);
add_retpoline();
-- 
2.7.4



[PATCH 1/3] modpost: refactor seen flag clearing in add_depends()

2018-11-22 Thread Masahiro Yamada
You do not need to iterate over all modules for resetting ->seen flag
because add_depends() is only interested in modules that export symbols
referenced from the given 'mod'.

This also avoids shadowing the 'modules' parameter of add_depends().

Signed-off-by: Masahiro Yamada 
---

 scripts/mod/modpost.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index c64066d..39432c2 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -2229,15 +2229,15 @@ static int add_versions(struct buffer *b, struct module 
*mod)
return err;
 }
 
-static void add_depends(struct buffer *b, struct module *mod,
-   struct module *modules)
+static void add_depends(struct buffer *b, struct module *mod)
 {
struct symbol *s;
-   struct module *m;
int first = 1;
 
-   for (m = modules; m; m = m->next)
-   m->seen = is_vmlinux(m->name);
+   /* Clear ->seen flag of modules that own symbols needed by this. */
+   for (s = mod->unres; s; s = s->next)
+   if (s->module)
+   s->module->seen = is_vmlinux(s->module->name);
 
buf_printf(b, "\n");
buf_printf(b, "static const char __module_depends[]\n");
@@ -2506,7 +2506,7 @@ int main(int argc, char **argv)
add_retpoline();
add_staging_flag(, mod->name);
err |= add_versions(, mod);
-   add_depends(, mod, modules);
+   add_depends(, mod);
add_moddevtable(, mod);
add_srcversion(, mod);
 
-- 
2.7.4



[PATCH 2/3] modpost: merge module iterations

2018-11-22 Thread Masahiro Yamada
Probably, this is just a matter of the order of error/warning
messages. Merge the two for-loops.

Signed-off-by: Masahiro Yamada 
---

 scripts/mod/modpost.c | 7 +--
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 39432c2..05e41eb 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -2484,12 +2484,6 @@ int main(int argc, char **argv)
if (files_source)
read_symbols_from_files(files_source);
 
-   for (mod = modules; mod; mod = mod->next) {
-   if (mod->skip)
-   continue;
-   check_exports(mod);
-   }
-
err = 0;
 
for (mod = modules; mod; mod = mod->next) {
@@ -2501,6 +2495,7 @@ int main(int argc, char **argv)
buf.pos = 0;
 
err |= check_modname_len(mod);
+   check_exports(mod);
add_header(, mod);
add_intree_flag(, !external_module);
add_retpoline();
-- 
2.7.4



[PATCH 1/3] modpost: refactor seen flag clearing in add_depends()

2018-11-22 Thread Masahiro Yamada
You do not need to iterate over all modules for resetting ->seen flag
because add_depends() is only interested in modules that export symbols
referenced from the given 'mod'.

This also avoids shadowing the 'modules' parameter of add_depends().

Signed-off-by: Masahiro Yamada 
---

 scripts/mod/modpost.c | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index c64066d..39432c2 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -2229,15 +2229,15 @@ static int add_versions(struct buffer *b, struct module 
*mod)
return err;
 }
 
-static void add_depends(struct buffer *b, struct module *mod,
-   struct module *modules)
+static void add_depends(struct buffer *b, struct module *mod)
 {
struct symbol *s;
-   struct module *m;
int first = 1;
 
-   for (m = modules; m; m = m->next)
-   m->seen = is_vmlinux(m->name);
+   /* Clear ->seen flag of modules that own symbols needed by this. */
+   for (s = mod->unres; s; s = s->next)
+   if (s->module)
+   s->module->seen = is_vmlinux(s->module->name);
 
buf_printf(b, "\n");
buf_printf(b, "static const char __module_depends[]\n");
@@ -2506,7 +2506,7 @@ int main(int argc, char **argv)
add_retpoline();
add_staging_flag(, mod->name);
err |= add_versions(, mod);
-   add_depends(, mod, modules);
+   add_depends(, mod);
add_moddevtable(, mod);
add_srcversion(, mod);
 
-- 
2.7.4



[PATCH 3/3] modpost: move unresolved symbol checks to check_exports()

2018-11-22 Thread Masahiro Yamada
This will fit better in check_exports() than add_versions().

Signed-off-by: Masahiro Yamada 
---

 scripts/mod/modpost.c | 33 ++---
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 05e41eb..32e5026 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -2085,15 +2085,27 @@ static void check_for_unused(enum export exp, const 
char *m, const char *s)
}
 }
 
-static void check_exports(struct module *mod)
+static int check_exports(struct module *mod)
 {
struct symbol *s, *exp;
+   int err = 0;
 
for (s = mod->unres; s; s = s->next) {
const char *basename;
exp = find_symbol(s->name);
-   if (!exp || exp->module == mod)
+   if (!exp || exp->module == mod) {
+   if (have_vmlinux && !s->weak) {
+   if (warn_unresolved) {
+   warn("\"%s\" [%s.ko] undefined!\n",
+s->name, mod->name);
+   } else {
+   merror("\"%s\" [%s.ko] undefined!\n",
+  s->name, mod->name);
+   err = 1;
+   }
+   }
continue;
+   }
basename = strrchr(mod->name, '/');
if (basename)
basename++;
@@ -2103,6 +2115,8 @@ static void check_exports(struct module *mod)
check_for_gpl_usage(exp->export, basename, exp->name);
check_for_unused(exp->export, basename, exp->name);
}
+
+   return err;
 }
 
 static int check_modname_len(struct module *mod)
@@ -2180,19 +2194,8 @@ static int add_versions(struct buffer *b, struct module 
*mod)
 
for (s = mod->unres; s; s = s->next) {
exp = find_symbol(s->name);
-   if (!exp || exp->module == mod) {
-   if (have_vmlinux && !s->weak) {
-   if (warn_unresolved) {
-   warn("\"%s\" [%s.ko] undefined!\n",
-s->name, mod->name);
-   } else {
-   merror("\"%s\" [%s.ko] undefined!\n",
-  s->name, mod->name);
-   err = 1;
-   }
-   }
+   if (!exp || exp->module == mod)
continue;
-   }
s->module = exp->module;
s->crc_valid = exp->crc_valid;
s->crc = exp->crc;
@@ -2495,7 +2498,7 @@ int main(int argc, char **argv)
buf.pos = 0;
 
err |= check_modname_len(mod);
-   check_exports(mod);
+   err |= check_exports(mod);
add_header(, mod);
add_intree_flag(, !external_module);
add_retpoline();
-- 
2.7.4



[PATCH 3/3] modpost: move unresolved symbol checks to check_exports()

2018-11-22 Thread Masahiro Yamada
This will fit better in check_exports() than add_versions().

Signed-off-by: Masahiro Yamada 
---

 scripts/mod/modpost.c | 33 ++---
 1 file changed, 18 insertions(+), 15 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 05e41eb..32e5026 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -2085,15 +2085,27 @@ static void check_for_unused(enum export exp, const 
char *m, const char *s)
}
 }
 
-static void check_exports(struct module *mod)
+static int check_exports(struct module *mod)
 {
struct symbol *s, *exp;
+   int err = 0;
 
for (s = mod->unres; s; s = s->next) {
const char *basename;
exp = find_symbol(s->name);
-   if (!exp || exp->module == mod)
+   if (!exp || exp->module == mod) {
+   if (have_vmlinux && !s->weak) {
+   if (warn_unresolved) {
+   warn("\"%s\" [%s.ko] undefined!\n",
+s->name, mod->name);
+   } else {
+   merror("\"%s\" [%s.ko] undefined!\n",
+  s->name, mod->name);
+   err = 1;
+   }
+   }
continue;
+   }
basename = strrchr(mod->name, '/');
if (basename)
basename++;
@@ -2103,6 +2115,8 @@ static void check_exports(struct module *mod)
check_for_gpl_usage(exp->export, basename, exp->name);
check_for_unused(exp->export, basename, exp->name);
}
+
+   return err;
 }
 
 static int check_modname_len(struct module *mod)
@@ -2180,19 +2194,8 @@ static int add_versions(struct buffer *b, struct module 
*mod)
 
for (s = mod->unres; s; s = s->next) {
exp = find_symbol(s->name);
-   if (!exp || exp->module == mod) {
-   if (have_vmlinux && !s->weak) {
-   if (warn_unresolved) {
-   warn("\"%s\" [%s.ko] undefined!\n",
-s->name, mod->name);
-   } else {
-   merror("\"%s\" [%s.ko] undefined!\n",
-  s->name, mod->name);
-   err = 1;
-   }
-   }
+   if (!exp || exp->module == mod)
continue;
-   }
s->module = exp->module;
s->crc_valid = exp->crc_valid;
s->crc = exp->crc;
@@ -2495,7 +2498,7 @@ int main(int argc, char **argv)
buf.pos = 0;
 
err |= check_modname_len(mod);
-   check_exports(mod);
+   err |= check_exports(mod);
add_header(, mod);
add_intree_flag(, !external_module);
add_retpoline();
-- 
2.7.4



[PATCH V2] exportfs: do not read dentry after free

2018-11-22 Thread Pan Bian
The function dentry_connected calls dput(dentry) to drop the previously
acquired reference to dentry. In this case, dentry can be released.
After that, IS_ROOT(dentry) checks the condition
(dentry == dentry->d_parent), which may result in a use-after-free bug.
This patch directly compares dentry with its parent obtained before
dropping the reference.

Fixes: a056cc8934c("exportfs: stop retrying once we race with
rename/remove")

Signed-off-by: Pan Bian 

---
V2: get rid of the comment

---
 fs/exportfs/expfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
index 645158d..a69aaf5 100644
--- a/fs/exportfs/expfs.c
+++ b/fs/exportfs/expfs.c
@@ -77,7 +77,7 @@ static bool dentry_connected(struct dentry *dentry)
struct dentry *parent = dget_parent(dentry);
 
dput(dentry);
-   if (IS_ROOT(dentry)) {
+   if (dentry == parent) {
dput(parent);
return false;
}
-- 
2.7.4




[PATCH V2] exportfs: do not read dentry after free

2018-11-22 Thread Pan Bian
The function dentry_connected calls dput(dentry) to drop the previously
acquired reference to dentry. In this case, dentry can be released.
After that, IS_ROOT(dentry) checks the condition
(dentry == dentry->d_parent), which may result in a use-after-free bug.
This patch directly compares dentry with its parent obtained before
dropping the reference.

Fixes: a056cc8934c("exportfs: stop retrying once we race with
rename/remove")

Signed-off-by: Pan Bian 

---
V2: get rid of the comment

---
 fs/exportfs/expfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
index 645158d..a69aaf5 100644
--- a/fs/exportfs/expfs.c
+++ b/fs/exportfs/expfs.c
@@ -77,7 +77,7 @@ static bool dentry_connected(struct dentry *dentry)
struct dentry *parent = dget_parent(dentry);
 
dput(dentry);
-   if (IS_ROOT(dentry)) {
+   if (dentry == parent) {
dput(parent);
return false;
}
-- 
2.7.4




[PATCH 1/1] sched/headers: fix thread_info. is overwritten by STACK_END_MAGIC

2018-11-22 Thread Wang Dongsheng
When select ARCH_TASK_STRUCT_ON_STACK the first of thread_info variable
is overwritten by STACK_END_MAGIC. In fact, the ARCH_TASK_STRUCT_ON_STACK
is not a real task on stack, it's only init_task on init_stack.

Commit 0500871f21b2 ("Construct init thread stack in the linker script
rather than by union") added this macro and put task_strcut into
thread_union. This brings us the following possibilities:
TASK_ON_STACKTHREAD_INFO_IN_TASKSTACK
- <-- thread_info & stack
NN | | --- <-- task
   | ||   |
-  ---

- <-- stack
NY | | --- <-- task(Including 
thread_info)
   | ||   |
-  ---

- <-- stack & task & thread_info
YN | |
   | |
-

- <-- stack & task(Including 
thread_info)
YY | |
   | |
-
The kernel has handled the first two cases correctly.

For the third case:
TASK_ON_STACK: Y. THREAD_INFO_IN_TASK: N. this case
should never happen, because the task and thread_info will overlap. So
when TASK_ON_STACK is selected, THREAD_INFO_IN_TASK must be selected too.

For the fourth case:
When task on stack, the end of stack should add a sizeof(task_struct) offset.

This patch handled with the third and fourth case.

Fixes: 0500871f21b2 ("Construct init thread stack in the linker ...")

Signed-off-by: Wang Dongsheng 
Signed-off-by: Shunyong Yang 
---
 arch/Kconfig | 1 +
 include/linux/sched/task_stack.h | 5 -
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index e1e540ffa979..0a2c73e73195 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -251,6 +251,7 @@ config ARCH_HAS_SET_MEMORY
 # Select if arch init_task must go in the __init_task_data section
 config ARCH_TASK_STRUCT_ON_STACK
bool
+   depends on THREAD_INFO_IN_TASK || IA64
 
 # Select if arch has its private alloc_task_struct() function
 config ARCH_TASK_STRUCT_ALLOCATOR
diff --git a/include/linux/sched/task_stack.h b/include/linux/sched/task_stack.h
index 6a841929073f..624c48defb9e 100644
--- a/include/linux/sched/task_stack.h
+++ b/include/linux/sched/task_stack.h
@@ -7,6 +7,7 @@
  */
 
 #include 
+#include 
 #include 
 
 #ifdef CONFIG_THREAD_INFO_IN_TASK
@@ -25,7 +26,9 @@ static inline void *task_stack_page(const struct task_struct 
*task)
 
 static inline unsigned long *end_of_stack(const struct task_struct *task)
 {
-   return task->stack;
+   if (!IS_ENABLED(CONFIG_ARCH_TASK_STRUCT_ON_STACK) || task != _task)
+   return task->stack;
+   return (unsigned long *)(task + 1);
 }
 
 #elif !defined(__HAVE_THREAD_FUNCTIONS)
-- 
2.19.1



[PATCH 1/1] sched/headers: fix thread_info. is overwritten by STACK_END_MAGIC

2018-11-22 Thread Wang Dongsheng
When select ARCH_TASK_STRUCT_ON_STACK the first of thread_info variable
is overwritten by STACK_END_MAGIC. In fact, the ARCH_TASK_STRUCT_ON_STACK
is not a real task on stack, it's only init_task on init_stack.

Commit 0500871f21b2 ("Construct init thread stack in the linker script
rather than by union") added this macro and put task_strcut into
thread_union. This brings us the following possibilities:
TASK_ON_STACKTHREAD_INFO_IN_TASKSTACK
- <-- thread_info & stack
NN | | --- <-- task
   | ||   |
-  ---

- <-- stack
NY | | --- <-- task(Including 
thread_info)
   | ||   |
-  ---

- <-- stack & task & thread_info
YN | |
   | |
-

- <-- stack & task(Including 
thread_info)
YY | |
   | |
-
The kernel has handled the first two cases correctly.

For the third case:
TASK_ON_STACK: Y. THREAD_INFO_IN_TASK: N. this case
should never happen, because the task and thread_info will overlap. So
when TASK_ON_STACK is selected, THREAD_INFO_IN_TASK must be selected too.

For the fourth case:
When task on stack, the end of stack should add a sizeof(task_struct) offset.

This patch handled with the third and fourth case.

Fixes: 0500871f21b2 ("Construct init thread stack in the linker ...")

Signed-off-by: Wang Dongsheng 
Signed-off-by: Shunyong Yang 
---
 arch/Kconfig | 1 +
 include/linux/sched/task_stack.h | 5 -
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index e1e540ffa979..0a2c73e73195 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -251,6 +251,7 @@ config ARCH_HAS_SET_MEMORY
 # Select if arch init_task must go in the __init_task_data section
 config ARCH_TASK_STRUCT_ON_STACK
bool
+   depends on THREAD_INFO_IN_TASK || IA64
 
 # Select if arch has its private alloc_task_struct() function
 config ARCH_TASK_STRUCT_ALLOCATOR
diff --git a/include/linux/sched/task_stack.h b/include/linux/sched/task_stack.h
index 6a841929073f..624c48defb9e 100644
--- a/include/linux/sched/task_stack.h
+++ b/include/linux/sched/task_stack.h
@@ -7,6 +7,7 @@
  */
 
 #include 
+#include 
 #include 
 
 #ifdef CONFIG_THREAD_INFO_IN_TASK
@@ -25,7 +26,9 @@ static inline void *task_stack_page(const struct task_struct 
*task)
 
 static inline unsigned long *end_of_stack(const struct task_struct *task)
 {
-   return task->stack;
+   if (!IS_ENABLED(CONFIG_ARCH_TASK_STRUCT_ON_STACK) || task != _task)
+   return task->stack;
+   return (unsigned long *)(task + 1);
 }
 
 #elif !defined(__HAVE_THREAD_FUNCTIONS)
-- 
2.19.1



[PATCH v2] arm64: dts: rockchip: Add DT for nanopc-t4

2018-11-22 Thread Tomeu Vizoso
This adds a device tree for the NanoPC-T4 SBC, which is based on the
Rockchip RK3399 SoC and marketed by FriendlyELEC.

Known working:

- Serial
- Ethernet
- HDMI
- USB 2.0

All of the interesting stuff is in a .dtsi because there are at least
two other boards that share most of it: NanoPi M4 and NanoPi NEO4.

Signed-off-by: Tomeu Vizoso 

---

v2: - Rename compatible from friendlyelec to friendlyarm, to match
  existing bindings
- Remove superfluous node spi1
---
 .../devicetree/bindings/arm/rockchip.txt  |   4 +
 arch/arm64/boot/dts/rockchip/Makefile |   1 +
 .../boot/dts/rockchip/rk3399-nanopc-t4.dts|  18 +
 .../boot/dts/rockchip/rk3399-nanopi4.dtsi | 770 ++
 4 files changed, 793 insertions(+)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi

diff --git a/Documentation/devicetree/bindings/arm/rockchip.txt 
b/Documentation/devicetree/bindings/arm/rockchip.txt
index 0cc71236d639..e907d309486e 100644
--- a/Documentation/devicetree/bindings/arm/rockchip.txt
+++ b/Documentation/devicetree/bindings/arm/rockchip.txt
@@ -71,6 +71,10 @@ Rockchip platforms device tree bindings
 Required root node properties:
   - compatible = "firefly,roc-rk3399-pc", "rockchip,rk3399";
 
+- FriendlyElec NanoPC-T4 board:
+Required root node properties:
+  - compatible = "friendlyarm,nanopc-t4", "rockchip,rk3399";
+
 - ChipSPARK PopMetal-RK3288 board:
 Required root node properties:
   - compatible = "chipspark,popmetal-rk3288", "rockchip,rk3288";
diff --git a/arch/arm64/boot/dts/rockchip/Makefile 
b/arch/arm64/boot/dts/rockchip/Makefile
index 49042c477870..ed90cd1e5a8b 100644
--- a/arch/arm64/boot/dts/rockchip/Makefile
+++ b/arch/arm64/boot/dts/rockchip/Makefile
@@ -20,3 +20,4 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock960.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rockpro64.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire-excavator.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopc-t4.dtb
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts 
b/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
new file mode 100644
index ..0965712b4464
--- /dev/null
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * FriendlyElec NanoPC-T4 board device tree source
+ *
+ * Copyright (c) 2018 FriendlyElec Computer Tech. Co., Ltd.
+ * (http://www.friendlyarm.com)
+ *
+ * Copyright (c) 2018 Collabora Ltd.
+ */
+
+/dts-v1/;
+#include "rk3399-nanopi4.dtsi"
+
+/ {
+   model = "FriendlyElec NanoPC-T4";
+   compatible = "friendlyarm,nanopc-t4", "rockchip,rk3399";
+};
+
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi 
b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi
new file mode 100644
index ..148f85b4bd49
--- /dev/null
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi
@@ -0,0 +1,770 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * RK3399-based FriendlyElec boards device tree source
+ *
+ * Copyright (c) 2016 Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * Copyright (c) 2018 FriendlyElec Computer Tech. Co., Ltd.
+ * (http://www.friendlyarm.com)
+ *
+ * Copyright (c) 2018 Collabora Ltd.
+ */
+
+/dts-v1/;
+#include 
+#include "rk3399.dtsi"
+#include "rk3399-opp.dtsi"
+
+/ {
+   chosen {
+   stdout-path = "serial2:150n8";
+   };
+
+   clkin_gmac: external-gmac-clock {
+   compatible = "fixed-clock";
+   clock-frequency = <12500>;
+   clock-output-names = "clkin_gmac";
+   #clock-cells = <0>;
+   };
+
+   vcc3v3_sys: vcc3v3-sys {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc3v3_sys";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   };
+
+   vcc5v0_host: vcc5v0-host-regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc5v0_host";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   };
+
+   vcc5v0_sys: vcc5v0-sys {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc5v0_sys";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   };
+
+   vccadc_ref: vccadc-ref {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc1v8_sys";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <180>;
+   

[PATCH v2] arm64: dts: rockchip: Add DT for nanopc-t4

2018-11-22 Thread Tomeu Vizoso
This adds a device tree for the NanoPC-T4 SBC, which is based on the
Rockchip RK3399 SoC and marketed by FriendlyELEC.

Known working:

- Serial
- Ethernet
- HDMI
- USB 2.0

All of the interesting stuff is in a .dtsi because there are at least
two other boards that share most of it: NanoPi M4 and NanoPi NEO4.

Signed-off-by: Tomeu Vizoso 

---

v2: - Rename compatible from friendlyelec to friendlyarm, to match
  existing bindings
- Remove superfluous node spi1
---
 .../devicetree/bindings/arm/rockchip.txt  |   4 +
 arch/arm64/boot/dts/rockchip/Makefile |   1 +
 .../boot/dts/rockchip/rk3399-nanopc-t4.dts|  18 +
 .../boot/dts/rockchip/rk3399-nanopi4.dtsi | 770 ++
 4 files changed, 793 insertions(+)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi

diff --git a/Documentation/devicetree/bindings/arm/rockchip.txt 
b/Documentation/devicetree/bindings/arm/rockchip.txt
index 0cc71236d639..e907d309486e 100644
--- a/Documentation/devicetree/bindings/arm/rockchip.txt
+++ b/Documentation/devicetree/bindings/arm/rockchip.txt
@@ -71,6 +71,10 @@ Rockchip platforms device tree bindings
 Required root node properties:
   - compatible = "firefly,roc-rk3399-pc", "rockchip,rk3399";
 
+- FriendlyElec NanoPC-T4 board:
+Required root node properties:
+  - compatible = "friendlyarm,nanopc-t4", "rockchip,rk3399";
+
 - ChipSPARK PopMetal-RK3288 board:
 Required root node properties:
   - compatible = "chipspark,popmetal-rk3288", "rockchip,rk3288";
diff --git a/arch/arm64/boot/dts/rockchip/Makefile 
b/arch/arm64/boot/dts/rockchip/Makefile
index 49042c477870..ed90cd1e5a8b 100644
--- a/arch/arm64/boot/dts/rockchip/Makefile
+++ b/arch/arm64/boot/dts/rockchip/Makefile
@@ -20,3 +20,4 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock960.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rockpro64.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire-excavator.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopc-t4.dtb
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts 
b/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
new file mode 100644
index ..0965712b4464
--- /dev/null
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * FriendlyElec NanoPC-T4 board device tree source
+ *
+ * Copyright (c) 2018 FriendlyElec Computer Tech. Co., Ltd.
+ * (http://www.friendlyarm.com)
+ *
+ * Copyright (c) 2018 Collabora Ltd.
+ */
+
+/dts-v1/;
+#include "rk3399-nanopi4.dtsi"
+
+/ {
+   model = "FriendlyElec NanoPC-T4";
+   compatible = "friendlyarm,nanopc-t4", "rockchip,rk3399";
+};
+
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi 
b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi
new file mode 100644
index ..148f85b4bd49
--- /dev/null
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi
@@ -0,0 +1,770 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * RK3399-based FriendlyElec boards device tree source
+ *
+ * Copyright (c) 2016 Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * Copyright (c) 2018 FriendlyElec Computer Tech. Co., Ltd.
+ * (http://www.friendlyarm.com)
+ *
+ * Copyright (c) 2018 Collabora Ltd.
+ */
+
+/dts-v1/;
+#include 
+#include "rk3399.dtsi"
+#include "rk3399-opp.dtsi"
+
+/ {
+   chosen {
+   stdout-path = "serial2:150n8";
+   };
+
+   clkin_gmac: external-gmac-clock {
+   compatible = "fixed-clock";
+   clock-frequency = <12500>;
+   clock-output-names = "clkin_gmac";
+   #clock-cells = <0>;
+   };
+
+   vcc3v3_sys: vcc3v3-sys {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc3v3_sys";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   };
+
+   vcc5v0_host: vcc5v0-host-regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc5v0_host";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   };
+
+   vcc5v0_sys: vcc5v0-sys {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc5v0_sys";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   };
+
+   vccadc_ref: vccadc-ref {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc1v8_sys";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <180>;
+   

Re: Linux 4.9.139

2018-11-22 Thread Greg KH
diff --git a/.gitignore b/.gitignore
index c2ed4ecb0acd..0c39aa20b6ba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,6 +33,7 @@
 *.lzo
 *.patch
 *.gcno
+*.ll
 modules.builtin
 Module.symvers
 *.dwo
diff --git a/Kbuild b/Kbuild
index 3d0ae152af7c..94c752762bc2 100644
--- a/Kbuild
+++ b/Kbuild
@@ -7,31 +7,6 @@
 # 4) Check for missing system calls
 # 5) Generate constants.py (may need bounds.h)
 
-# Default sed regexp - multiline due to syntax constraints
-define sed-y
-   "/^->/{s:->#\(.*\):/* \1 */:; \
-   s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
-   s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
-   s:->::; p;}"
-endef
-
-# Use filechk to avoid rebuilds when a header changes, but the resulting file
-# does not
-define filechk_offsets
-   (set -e; \
-echo "#ifndef $2"; \
-echo "#define $2"; \
-echo "/*"; \
-echo " * DO NOT MODIFY."; \
-echo " *"; \
-echo " * This file was generated by Kbuild"; \
-echo " */"; \
-echo ""; \
-sed -ne $(sed-y); \
-echo ""; \
-echo "#endif" )
-endef
-
 #
 # 1) Generate bounds.h
 
diff --git a/Makefile b/Makefile
index ccf2602f664d..a6959d96316d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 9
-SUBLEVEL = 138
+SUBLEVEL = 139
 EXTRAVERSION =
 NAME = Roaring Lionus
 
@@ -303,7 +303,7 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo 
$$BASH; \
 
 HOSTCC   = gcc
 HOSTCXX  = g++
-HOSTCFLAGS   = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 
-fomit-frame-pointer -std=gnu89
+HOSTCFLAGS   := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 
-fomit-frame-pointer -std=gnu89
 HOSTCXXFLAGS = -O2
 
 ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
@@ -394,7 +394,7 @@ LINUXINCLUDE+= $(filter-out 
$(LINUXINCLUDE),$(USERINCLUDE))
 
 KBUILD_AFLAGS   := -D__ASSEMBLY__
 KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-  -fno-strict-aliasing -fno-common \
+  -fno-strict-aliasing -fno-common -fshort-wchar \
   -Werror-implicit-function-declaration \
   -Wno-format-security \
   -std=gnu89
@@ -644,7 +644,8 @@ KBUILD_CFLAGS   += $(call cc-option,-fdata-sections,)
 endif
 
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
-KBUILD_CFLAGS  += -Os $(call cc-disable-warning,maybe-uninitialized,)
+KBUILD_CFLAGS  += $(call cc-option,-Oz,-Os)
+KBUILD_CFLAGS  += $(call cc-disable-warning,maybe-uninitialized,)
 else
 ifdef CONFIG_PROFILE_ALL_BRANCHES
 KBUILD_CFLAGS  += -O2 $(call cc-disable-warning,maybe-uninitialized,)
@@ -704,11 +705,20 @@ endif
 KBUILD_CFLAGS += $(stackp-flag)
 
 ifeq ($(cc-name),clang)
+ifneq ($(CROSS_COMPILE),)
+CLANG_TARGET   := -target $(notdir $(CROSS_COMPILE:%-=%))
+GCC_TOOLCHAIN  := $(realpath $(dir $(shell which $(LD)))/..)
+endif
+ifneq ($(GCC_TOOLCHAIN),)
+CLANG_GCC_TC   := -gcc-toolchain $(GCC_TOOLCHAIN)
+endif
+KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
+KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
 KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
-KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,)
 KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable)
 KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier)
 KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
+KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
 # Quiet clang warning: comparison of unsigned expression < 0 is always false
 KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare)
 # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
@@ -716,6 +726,8 @@ KBUILD_CFLAGS += $(call cc-disable-warning, 
tautological-compare)
 # See modpost pattern 2
 KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,)
 KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior)
+KBUILD_CFLAGS += $(call cc-option, -no-integrated-as)
+KBUILD_AFLAGS += $(call cc-option, -no-integrated-as)
 else
 
 # These warnings generated too much noise in a regular build.
@@ -1379,6 +1391,8 @@ help:
@echo  '(default: 
$$(INSTALL_MOD_PATH)/lib/firmware)'
@echo  '  dir/- Build all files in dir and below'
@echo  '  dir/file.[ois]  - Build specified target only'
+   @echo  '  dir/file.ll - Build the LLVM assembly file'
+   @echo  '(requires compiler support for LLVM 
assembly generation)'
@echo  '  dir/file.lst- Build specified mixed source/assembly 
target only'
@echo  '(requires a recent binutils and recent 
build (System.map))'
@echo  '  dir/file.ko - Build module including final link'
@@ -1563,6 +1577,7 @@ clean: $(clean-dirs)
-o -name '*.symtypes' -o -name 'modules.order' \
-o -name modules.builtin -o -name '.tmp_*.o.*' \
-o -name 

Re: Linux 4.9.139

2018-11-22 Thread Greg KH
diff --git a/.gitignore b/.gitignore
index c2ed4ecb0acd..0c39aa20b6ba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,6 +33,7 @@
 *.lzo
 *.patch
 *.gcno
+*.ll
 modules.builtin
 Module.symvers
 *.dwo
diff --git a/Kbuild b/Kbuild
index 3d0ae152af7c..94c752762bc2 100644
--- a/Kbuild
+++ b/Kbuild
@@ -7,31 +7,6 @@
 # 4) Check for missing system calls
 # 5) Generate constants.py (may need bounds.h)
 
-# Default sed regexp - multiline due to syntax constraints
-define sed-y
-   "/^->/{s:->#\(.*\):/* \1 */:; \
-   s:^->\([^ ]*\) [\$$#]*\([-0-9]*\) \(.*\):#define \1 \2 /* \3 */:; \
-   s:^->\([^ ]*\) [\$$#]*\([^ ]*\) \(.*\):#define \1 \2 /* \3 */:; \
-   s:->::; p;}"
-endef
-
-# Use filechk to avoid rebuilds when a header changes, but the resulting file
-# does not
-define filechk_offsets
-   (set -e; \
-echo "#ifndef $2"; \
-echo "#define $2"; \
-echo "/*"; \
-echo " * DO NOT MODIFY."; \
-echo " *"; \
-echo " * This file was generated by Kbuild"; \
-echo " */"; \
-echo ""; \
-sed -ne $(sed-y); \
-echo ""; \
-echo "#endif" )
-endef
-
 #
 # 1) Generate bounds.h
 
diff --git a/Makefile b/Makefile
index ccf2602f664d..a6959d96316d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 VERSION = 4
 PATCHLEVEL = 9
-SUBLEVEL = 138
+SUBLEVEL = 139
 EXTRAVERSION =
 NAME = Roaring Lionus
 
@@ -303,7 +303,7 @@ CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo 
$$BASH; \
 
 HOSTCC   = gcc
 HOSTCXX  = g++
-HOSTCFLAGS   = -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 
-fomit-frame-pointer -std=gnu89
+HOSTCFLAGS   := -Wall -Wmissing-prototypes -Wstrict-prototypes -O2 
-fomit-frame-pointer -std=gnu89
 HOSTCXXFLAGS = -O2
 
 ifeq ($(shell $(HOSTCC) -v 2>&1 | grep -c "clang version"), 1)
@@ -394,7 +394,7 @@ LINUXINCLUDE+= $(filter-out 
$(LINUXINCLUDE),$(USERINCLUDE))
 
 KBUILD_AFLAGS   := -D__ASSEMBLY__
 KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-  -fno-strict-aliasing -fno-common \
+  -fno-strict-aliasing -fno-common -fshort-wchar \
   -Werror-implicit-function-declaration \
   -Wno-format-security \
   -std=gnu89
@@ -644,7 +644,8 @@ KBUILD_CFLAGS   += $(call cc-option,-fdata-sections,)
 endif
 
 ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE
-KBUILD_CFLAGS  += -Os $(call cc-disable-warning,maybe-uninitialized,)
+KBUILD_CFLAGS  += $(call cc-option,-Oz,-Os)
+KBUILD_CFLAGS  += $(call cc-disable-warning,maybe-uninitialized,)
 else
 ifdef CONFIG_PROFILE_ALL_BRANCHES
 KBUILD_CFLAGS  += -O2 $(call cc-disable-warning,maybe-uninitialized,)
@@ -704,11 +705,20 @@ endif
 KBUILD_CFLAGS += $(stackp-flag)
 
 ifeq ($(cc-name),clang)
+ifneq ($(CROSS_COMPILE),)
+CLANG_TARGET   := -target $(notdir $(CROSS_COMPILE:%-=%))
+GCC_TOOLCHAIN  := $(realpath $(dir $(shell which $(LD)))/..)
+endif
+ifneq ($(GCC_TOOLCHAIN),)
+CLANG_GCC_TC   := -gcc-toolchain $(GCC_TOOLCHAIN)
+endif
+KBUILD_CFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
+KBUILD_AFLAGS += $(CLANG_TARGET) $(CLANG_GCC_TC)
 KBUILD_CPPFLAGS += $(call cc-option,-Qunused-arguments,)
-KBUILD_CPPFLAGS += $(call cc-option,-Wno-unknown-warning-option,)
 KBUILD_CFLAGS += $(call cc-disable-warning, unused-variable)
 KBUILD_CFLAGS += $(call cc-disable-warning, format-invalid-specifier)
 KBUILD_CFLAGS += $(call cc-disable-warning, gnu)
+KBUILD_CFLAGS += $(call cc-disable-warning, address-of-packed-member)
 # Quiet clang warning: comparison of unsigned expression < 0 is always false
 KBUILD_CFLAGS += $(call cc-disable-warning, tautological-compare)
 # CLANG uses a _MergedGlobals as optimization, but this breaks modpost, as the
@@ -716,6 +726,8 @@ KBUILD_CFLAGS += $(call cc-disable-warning, 
tautological-compare)
 # See modpost pattern 2
 KBUILD_CFLAGS += $(call cc-option, -mno-global-merge,)
 KBUILD_CFLAGS += $(call cc-option, -fcatch-undefined-behavior)
+KBUILD_CFLAGS += $(call cc-option, -no-integrated-as)
+KBUILD_AFLAGS += $(call cc-option, -no-integrated-as)
 else
 
 # These warnings generated too much noise in a regular build.
@@ -1379,6 +1391,8 @@ help:
@echo  '(default: 
$$(INSTALL_MOD_PATH)/lib/firmware)'
@echo  '  dir/- Build all files in dir and below'
@echo  '  dir/file.[ois]  - Build specified target only'
+   @echo  '  dir/file.ll - Build the LLVM assembly file'
+   @echo  '(requires compiler support for LLVM 
assembly generation)'
@echo  '  dir/file.lst- Build specified mixed source/assembly 
target only'
@echo  '(requires a recent binutils and recent 
build (System.map))'
@echo  '  dir/file.ko - Build module including final link'
@@ -1563,6 +1577,7 @@ clean: $(clean-dirs)
-o -name '*.symtypes' -o -name 'modules.order' \
-o -name modules.builtin -o -name '.tmp_*.o.*' \
-o -name 

Re: Linux 4.14.83

2018-11-22 Thread Greg KH
diff --git a/Makefile b/Makefile
index cac5323bc95d..0f42814095a4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 4
 PATCHLEVEL = 14
-SUBLEVEL = 82
+SUBLEVEL = 83
 EXTRAVERSION =
 NAME = Petit Gorille
 
diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index f1d1a9772153..0aceb3736e5c 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -91,7 +91,7 @@
 
trips {
cpu-crit {
-   temperature = <115000>;
+   temperature = <95000>;
hysteresis  = <0>;
type= "critical";
};
diff --git a/arch/arm/boot/dts/r8a7793.dtsi b/arch/arm/boot/dts/r8a7793.dtsi
index 497716b6fbe2..fd12564aabc3 100644
--- a/arch/arm/boot/dts/r8a7793.dtsi
+++ b/arch/arm/boot/dts/r8a7793.dtsi
@@ -88,7 +88,7 @@
 
trips {
cpu-crit {
-   temperature = <115000>;
+   temperature = <95000>;
hysteresis  = <0>;
type= "critical";
};
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index aa6e7f75bccc..e92aedd93806 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -34,10 +34,12 @@ static void __init spectre_v2_select_mitigation(void);
 static void __init ssb_select_mitigation(void);
 static void __init l1tf_select_mitigation(void);
 
-/* The base value of the SPEC_CTRL MSR that always has to be preserved. */
-u64 x86_spec_ctrl_base;
+/*
+ * Our boot-time value of the SPEC_CTRL MSR. We read it once so that any
+ * writes to SPEC_CTRL contain whatever reserved bits have been set.
+ */
+u64 __ro_after_init x86_spec_ctrl_base;
 EXPORT_SYMBOL_GPL(x86_spec_ctrl_base);
-static DEFINE_MUTEX(spec_ctrl_mutex);
 
 /*
  * The vendor and possibly platform specific bits which can be modified in
@@ -321,46 +323,6 @@ static enum spectre_v2_mitigation_cmd __init 
spectre_v2_parse_cmdline(void)
return cmd;
 }
 
-static bool stibp_needed(void)
-{
-   if (spectre_v2_enabled == SPECTRE_V2_NONE)
-   return false;
-
-   if (!boot_cpu_has(X86_FEATURE_STIBP))
-   return false;
-
-   return true;
-}
-
-static void update_stibp_msr(void *info)
-{
-   wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base);
-}
-
-void arch_smt_update(void)
-{
-   u64 mask;
-
-   if (!stibp_needed())
-   return;
-
-   mutex_lock(_ctrl_mutex);
-   mask = x86_spec_ctrl_base;
-   if (cpu_smt_control == CPU_SMT_ENABLED)
-   mask |= SPEC_CTRL_STIBP;
-   else
-   mask &= ~SPEC_CTRL_STIBP;
-
-   if (mask != x86_spec_ctrl_base) {
-   pr_info("Spectre v2 cross-process SMT mitigation: %s STIBP\n",
-   cpu_smt_control == CPU_SMT_ENABLED ?
-   "Enabling" : "Disabling");
-   x86_spec_ctrl_base = mask;
-   on_each_cpu(update_stibp_msr, NULL, 1);
-   }
-   mutex_unlock(_ctrl_mutex);
-}
-
 static void __init spectre_v2_select_mitigation(void)
 {
enum spectre_v2_mitigation_cmd cmd = spectre_v2_parse_cmdline();
@@ -460,9 +422,6 @@ static void __init spectre_v2_select_mitigation(void)
setup_force_cpu_cap(X86_FEATURE_USE_IBRS_FW);
pr_info("Enabling Restricted Speculation for firmware calls\n");
}
-
-   /* Enable STIBP if appropriate */
-   arch_smt_update();
 }
 
 #undef pr_fmt
@@ -855,8 +814,6 @@ static ssize_t l1tf_show_state(char *buf)
 static ssize_t cpu_show_common(struct device *dev, struct device_attribute 
*attr,
   char *buf, unsigned int bug)
 {
-   int ret;
-
if (!boot_cpu_has_bug(bug))
return sprintf(buf, "Not affected\n");
 
@@ -871,12 +828,10 @@ static ssize_t cpu_show_common(struct device *dev, struct 
device_attribute *attr
return sprintf(buf, "Mitigation: __user pointer 
sanitization\n");
 
case X86_BUG_SPECTRE_V2:
-   ret = sprintf(buf, "%s%s%s%s%s\n", 
spectre_v2_strings[spectre_v2_enabled],
+   return sprintf(buf, "%s%s%s%s\n", 
spectre_v2_strings[spectre_v2_enabled],
   boot_cpu_has(X86_FEATURE_USE_IBPB) ? ", IBPB" : 
"",
   boot_cpu_has(X86_FEATURE_USE_IBRS_FW) ? ", 
IBRS_FW" : "",
-  (x86_spec_ctrl_base & SPEC_CTRL_STIBP) ? ", 
STIBP" : "",
   spectre_v2_module_string());
-   return ret;
 
case X86_BUG_SPEC_STORE_BYPASS:

Re: Linux 4.14.83

2018-11-22 Thread Greg KH
diff --git a/Makefile b/Makefile
index cac5323bc95d..0f42814095a4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 4
 PATCHLEVEL = 14
-SUBLEVEL = 82
+SUBLEVEL = 83
 EXTRAVERSION =
 NAME = Petit Gorille
 
diff --git a/arch/arm/boot/dts/r8a7791.dtsi b/arch/arm/boot/dts/r8a7791.dtsi
index f1d1a9772153..0aceb3736e5c 100644
--- a/arch/arm/boot/dts/r8a7791.dtsi
+++ b/arch/arm/boot/dts/r8a7791.dtsi
@@ -91,7 +91,7 @@
 
trips {
cpu-crit {
-   temperature = <115000>;
+   temperature = <95000>;
hysteresis  = <0>;
type= "critical";
};
diff --git a/arch/arm/boot/dts/r8a7793.dtsi b/arch/arm/boot/dts/r8a7793.dtsi
index 497716b6fbe2..fd12564aabc3 100644
--- a/arch/arm/boot/dts/r8a7793.dtsi
+++ b/arch/arm/boot/dts/r8a7793.dtsi
@@ -88,7 +88,7 @@
 
trips {
cpu-crit {
-   temperature = <115000>;
+   temperature = <95000>;
hysteresis  = <0>;
type= "critical";
};
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index aa6e7f75bccc..e92aedd93806 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -34,10 +34,12 @@ static void __init spectre_v2_select_mitigation(void);
 static void __init ssb_select_mitigation(void);
 static void __init l1tf_select_mitigation(void);
 
-/* The base value of the SPEC_CTRL MSR that always has to be preserved. */
-u64 x86_spec_ctrl_base;
+/*
+ * Our boot-time value of the SPEC_CTRL MSR. We read it once so that any
+ * writes to SPEC_CTRL contain whatever reserved bits have been set.
+ */
+u64 __ro_after_init x86_spec_ctrl_base;
 EXPORT_SYMBOL_GPL(x86_spec_ctrl_base);
-static DEFINE_MUTEX(spec_ctrl_mutex);
 
 /*
  * The vendor and possibly platform specific bits which can be modified in
@@ -321,46 +323,6 @@ static enum spectre_v2_mitigation_cmd __init 
spectre_v2_parse_cmdline(void)
return cmd;
 }
 
-static bool stibp_needed(void)
-{
-   if (spectre_v2_enabled == SPECTRE_V2_NONE)
-   return false;
-
-   if (!boot_cpu_has(X86_FEATURE_STIBP))
-   return false;
-
-   return true;
-}
-
-static void update_stibp_msr(void *info)
-{
-   wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base);
-}
-
-void arch_smt_update(void)
-{
-   u64 mask;
-
-   if (!stibp_needed())
-   return;
-
-   mutex_lock(_ctrl_mutex);
-   mask = x86_spec_ctrl_base;
-   if (cpu_smt_control == CPU_SMT_ENABLED)
-   mask |= SPEC_CTRL_STIBP;
-   else
-   mask &= ~SPEC_CTRL_STIBP;
-
-   if (mask != x86_spec_ctrl_base) {
-   pr_info("Spectre v2 cross-process SMT mitigation: %s STIBP\n",
-   cpu_smt_control == CPU_SMT_ENABLED ?
-   "Enabling" : "Disabling");
-   x86_spec_ctrl_base = mask;
-   on_each_cpu(update_stibp_msr, NULL, 1);
-   }
-   mutex_unlock(_ctrl_mutex);
-}
-
 static void __init spectre_v2_select_mitigation(void)
 {
enum spectre_v2_mitigation_cmd cmd = spectre_v2_parse_cmdline();
@@ -460,9 +422,6 @@ static void __init spectre_v2_select_mitigation(void)
setup_force_cpu_cap(X86_FEATURE_USE_IBRS_FW);
pr_info("Enabling Restricted Speculation for firmware calls\n");
}
-
-   /* Enable STIBP if appropriate */
-   arch_smt_update();
 }
 
 #undef pr_fmt
@@ -855,8 +814,6 @@ static ssize_t l1tf_show_state(char *buf)
 static ssize_t cpu_show_common(struct device *dev, struct device_attribute 
*attr,
   char *buf, unsigned int bug)
 {
-   int ret;
-
if (!boot_cpu_has_bug(bug))
return sprintf(buf, "Not affected\n");
 
@@ -871,12 +828,10 @@ static ssize_t cpu_show_common(struct device *dev, struct 
device_attribute *attr
return sprintf(buf, "Mitigation: __user pointer 
sanitization\n");
 
case X86_BUG_SPECTRE_V2:
-   ret = sprintf(buf, "%s%s%s%s%s\n", 
spectre_v2_strings[spectre_v2_enabled],
+   return sprintf(buf, "%s%s%s%s\n", 
spectre_v2_strings[spectre_v2_enabled],
   boot_cpu_has(X86_FEATURE_USE_IBPB) ? ", IBPB" : 
"",
   boot_cpu_has(X86_FEATURE_USE_IBRS_FW) ? ", 
IBRS_FW" : "",
-  (x86_spec_ctrl_base & SPEC_CTRL_STIBP) ? ", 
STIBP" : "",
   spectre_v2_module_string());
-   return ret;
 
case X86_BUG_SPEC_STORE_BYPASS:

Linux 4.14.83

2018-11-22 Thread Greg KH
I'm announcing the release of the 4.14.83 kernel.

All users of the 4.14 kernel series must upgrade.

The updated 4.14.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.14.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile|2 
 arch/arm/boot/dts/r8a7791.dtsi  |2 
 arch/arm/boot/dts/r8a7793.dtsi  |2 
 arch/x86/kernel/cpu/bugs.c  |   57 ++--
 drivers/net/dsa/microchip/ksz_common.c  |   10 ++--
 drivers/net/ethernet/broadcom/bcmsysport.c  |   15 ++
 drivers/net/ethernet/broadcom/tg3.c |   18 ++-
 drivers/net/ethernet/ibm/ibmvnic.c  |2 
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c  |1 
 drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c |6 +-
 drivers/net/phy/mdio-gpio.c |   10 ++--
 drivers/net/tun.c   |6 ++
 drivers/net/usb/smsc95xx.c  |9 +++
 include/uapi/linux/sctp.h   |2 
 kernel/cpu.c|   11 
 net/core/dev.c  |4 +
 net/core/flow_dissector.c   |4 -
 net/ipv4/inet_fragment.c|   28 ++-
 net/ipv4/ip_tunnel_core.c   |2 
 net/ipv6/route.c|7 ++
 net/sctp/socket.c   |   26 ++
 net/sctp/stream.c   |1 
 22 files changed, 95 insertions(+), 130 deletions(-)

Chris Paterson (2):
  ARM: dts: r8a7791: Correct critical CPU temperature
  ARM: dts: r8a7793: Correct critical CPU temperature

David Ahern (1):
  ipv6: Fix PMTU updates for UDP/raw sockets in presence of VRF

Eric Dumazet (2):
  net-gro: reset skb->pkt_type in napi_reuse_skb()
  inet: frags: better deal with smp races

Florian Fainelli (1):
  net: systemport: Protect stop from timeout

Frieder Schrempf (1):
  usbnet: smsc95xx: disable carrier check while suspending

Greg Kroah-Hartman (2):
  Revert "x86/speculation: Enable cross-hyperthread spectre v2 STIBP 
mitigation"
  Linux 4.14.83

Martin Schiller (1):
  net: phy: mdio-gpio: Fix working over slow can_sleep GPIOs

Matthew Cover (1):
  tuntap: fix multiqueue rx

Michał Mirosław (1):
  ibmvnic: fix accelerated VLAN handling

Sabrina Dubroca (1):
  ip_tunnel: don't force DF when MTU is locked

Shalom Toledo (1):
  mlxsw: spectrum: Fix IP2ME CPU policer configuration

Siva Reddy Kallam (1):
  tg3: Add PHY reset for 5717/5719/5720 in change ring and flow control 
paths

Stefan Wahren (1):
  net: smsc95xx: Fix MTU range

Subash Abhinov Kasiviswanathan (1):
  net: qualcomm: rmnet: Fix incorrect assignment of real_dev

Tristram Ha (1):
  net: dsa: microchip: initialize mutex before use

Xin Long (3):
  sctp: not allow to set asoc prsctp_enable by sockopt
  sctp: fix strchange_flags name for Stream Change Event
  sctp: not increase stream's incnt before sending addstrm_in request

배석진 (1):
  flow_dissector: do not dissect l4 ports for fragments



signature.asc
Description: PGP signature


Linux 4.9.139

2018-11-22 Thread Greg KH
I'm announcing the release of the 4.9.139 kernel.

All users of the 4.9 kernel series must upgrade.

The updated 4.9.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.9.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 .gitignore|1 
 Kbuild|   25 
 Makefile  |   27 +++-
 arch/arm/include/asm/assembler.h  |   12 ++
 arch/arm/include/asm/barrier.h|   32 +
 arch/arm/include/asm/bugs.h   |6 -
 arch/arm/include/asm/cp15.h   |3 
 arch/arm/include/asm/cputype.h|8 +
 arch/arm/include/asm/kvm_asm.h|2 
 arch/arm/include/asm/kvm_host.h   |   14 ++
 arch/arm/include/asm/kvm_mmu.h|   23 +++
 arch/arm/include/asm/proc-fns.h   |4 
 arch/arm/include/asm/system_misc.h|   15 ++
 arch/arm/include/asm/thread_info.h|4 
 arch/arm/include/asm/uaccess.h|   26 +++-
 arch/arm/kernel/Makefile  |1 
 arch/arm/kernel/bugs.c|   18 +++
 arch/arm/kernel/entry-common.S|   18 +--
 arch/arm/kernel/entry-header.S|   25 
 arch/arm/kernel/signal.c  |   55 +
 arch/arm/kernel/smp.c |4 
 arch/arm/kernel/suspend.c |2 
 arch/arm/kernel/sys_oabi-compat.c |8 -
 arch/arm/kvm/hyp/hyp-entry.S  |  112 ++-
 arch/arm/lib/copy_from_user.S |9 +
 arch/arm/mm/Kconfig   |   23 +++
 arch/arm/mm/Makefile  |2 
 arch/arm/mm/fault.c   |3 
 arch/arm/mm/proc-macros.S |3 
 arch/arm/mm/proc-v7-2level.S  |6 -
 arch/arm/mm/proc-v7-bugs.c|  174 ++
 arch/arm/mm/proc-v7.S |  154 +-
 arch/arm/vfp/vfpmodule.c  |   17 +-
 arch/arm64/crypto/sha1-ce-core.S  |6 -
 arch/arm64/crypto/sha1-ce-glue.c  |   11 -
 arch/arm64/crypto/sha2-ce-core.S  |6 -
 arch/arm64/crypto/sha2-ce-glue.c  |   13 --
 arch/arm64/include/asm/efi.h  |3 
 arch/arm64/include/asm/uaccess.h  |4 
 arch/ia64/kernel/Makefile |   26 
 arch/x86/Makefile |   39 +-
 arch/x86/boot/string.c|9 +
 arch/x86/crypto/aes_ctrby8_avx-x86_64.S   |7 -
 drivers/firmware/efi/libstub/Makefile |   26 ++--
 drivers/firmware/efi/libstub/arm64-stub.c |   10 +
 drivers/net/ethernet/broadcom/tg3.c   |   18 ++-
 drivers/net/usb/smsc95xx.c|7 +
 drivers/xen/Makefile  |3 
 include/linux/kbuild.h|6 -
 include/linux/module.h|4 
 net/core/dev.c|4 
 net/core/flow_dissector.c |4 
 net/ipv4/inet_fragment.c  |   28 ++--
 net/ipv4/ip_tunnel_core.c |2 
 net/ipv6/route.c  |7 -
 net/sctp/socket.c |   26 
 scripts/Kbuild.include|   18 ++-
 scripts/Makefile.build|8 +
 scripts/Makefile.extrawarn|1 
 scripts/Makefile.host |6 -
 scripts/Makefile.lib  |   31 +
 scripts/mod/Makefile  |   28 
 62 files changed, 901 insertions(+), 296 deletions(-)

Ard Biesheuvel (5):
  crypto: arm64/sha - avoid non-standard inline asm tricks
  efi/libstub/arm64: Use hidden attribute for struct screen_info reference
  efi/libstub/arm64: Force 'hidden' visibility for section markers
  efi/libstub: Preserve .debug sections after absolute relocation check
  efi/libstub/arm64: Set -fpie when building the EFI stub

Arnd Bergmann (2):
  modules: mark __inittest/__exittest as __maybe_unused
  Kbuild: use -fshort-wchar globally

Behan Webster (2):
  kbuild: Add better clang cross build support
  kbuild: use -Oz instead of -Os when using clang

David Ahern (1):
  ipv6: Fix PMTU updates for UDP/raw sockets in presence of VRF

Eric Dumazet (2):
  net-gro: reset skb->pkt_type in napi_reuse_skb()
  inet: frags: better deal with smp races

Frieder Schrempf (1):
  usbnet: smsc95xx: disable carrier check while suspending

Greg Kroah-Hartman (1):
  Linux 4.9.139

Jeroen Hofstee (1):
  kbuild: fix asm-offset generation to work with clang

Marc Zyngier (2):
  ARM: KVM: invalidate BTB on guest exit for Cortex-A12/A17
  ARM: KVM: invalidate icache on guest exit for Cortex-A15


Linux 4.14.83

2018-11-22 Thread Greg KH
I'm announcing the release of the 4.14.83 kernel.

All users of the 4.14 kernel series must upgrade.

The updated 4.14.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.14.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile|2 
 arch/arm/boot/dts/r8a7791.dtsi  |2 
 arch/arm/boot/dts/r8a7793.dtsi  |2 
 arch/x86/kernel/cpu/bugs.c  |   57 ++--
 drivers/net/dsa/microchip/ksz_common.c  |   10 ++--
 drivers/net/ethernet/broadcom/bcmsysport.c  |   15 ++
 drivers/net/ethernet/broadcom/tg3.c |   18 ++-
 drivers/net/ethernet/ibm/ibmvnic.c  |2 
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c  |1 
 drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c |6 +-
 drivers/net/phy/mdio-gpio.c |   10 ++--
 drivers/net/tun.c   |6 ++
 drivers/net/usb/smsc95xx.c  |9 +++
 include/uapi/linux/sctp.h   |2 
 kernel/cpu.c|   11 
 net/core/dev.c  |4 +
 net/core/flow_dissector.c   |4 -
 net/ipv4/inet_fragment.c|   28 ++-
 net/ipv4/ip_tunnel_core.c   |2 
 net/ipv6/route.c|7 ++
 net/sctp/socket.c   |   26 ++
 net/sctp/stream.c   |1 
 22 files changed, 95 insertions(+), 130 deletions(-)

Chris Paterson (2):
  ARM: dts: r8a7791: Correct critical CPU temperature
  ARM: dts: r8a7793: Correct critical CPU temperature

David Ahern (1):
  ipv6: Fix PMTU updates for UDP/raw sockets in presence of VRF

Eric Dumazet (2):
  net-gro: reset skb->pkt_type in napi_reuse_skb()
  inet: frags: better deal with smp races

Florian Fainelli (1):
  net: systemport: Protect stop from timeout

Frieder Schrempf (1):
  usbnet: smsc95xx: disable carrier check while suspending

Greg Kroah-Hartman (2):
  Revert "x86/speculation: Enable cross-hyperthread spectre v2 STIBP 
mitigation"
  Linux 4.14.83

Martin Schiller (1):
  net: phy: mdio-gpio: Fix working over slow can_sleep GPIOs

Matthew Cover (1):
  tuntap: fix multiqueue rx

Michał Mirosław (1):
  ibmvnic: fix accelerated VLAN handling

Sabrina Dubroca (1):
  ip_tunnel: don't force DF when MTU is locked

Shalom Toledo (1):
  mlxsw: spectrum: Fix IP2ME CPU policer configuration

Siva Reddy Kallam (1):
  tg3: Add PHY reset for 5717/5719/5720 in change ring and flow control 
paths

Stefan Wahren (1):
  net: smsc95xx: Fix MTU range

Subash Abhinov Kasiviswanathan (1):
  net: qualcomm: rmnet: Fix incorrect assignment of real_dev

Tristram Ha (1):
  net: dsa: microchip: initialize mutex before use

Xin Long (3):
  sctp: not allow to set asoc prsctp_enable by sockopt
  sctp: fix strchange_flags name for Stream Change Event
  sctp: not increase stream's incnt before sending addstrm_in request

배석진 (1):
  flow_dissector: do not dissect l4 ports for fragments



signature.asc
Description: PGP signature


Linux 4.9.139

2018-11-22 Thread Greg KH
I'm announcing the release of the 4.9.139 kernel.

All users of the 4.9 kernel series must upgrade.

The updated 4.9.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.9.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 .gitignore|1 
 Kbuild|   25 
 Makefile  |   27 +++-
 arch/arm/include/asm/assembler.h  |   12 ++
 arch/arm/include/asm/barrier.h|   32 +
 arch/arm/include/asm/bugs.h   |6 -
 arch/arm/include/asm/cp15.h   |3 
 arch/arm/include/asm/cputype.h|8 +
 arch/arm/include/asm/kvm_asm.h|2 
 arch/arm/include/asm/kvm_host.h   |   14 ++
 arch/arm/include/asm/kvm_mmu.h|   23 +++
 arch/arm/include/asm/proc-fns.h   |4 
 arch/arm/include/asm/system_misc.h|   15 ++
 arch/arm/include/asm/thread_info.h|4 
 arch/arm/include/asm/uaccess.h|   26 +++-
 arch/arm/kernel/Makefile  |1 
 arch/arm/kernel/bugs.c|   18 +++
 arch/arm/kernel/entry-common.S|   18 +--
 arch/arm/kernel/entry-header.S|   25 
 arch/arm/kernel/signal.c  |   55 +
 arch/arm/kernel/smp.c |4 
 arch/arm/kernel/suspend.c |2 
 arch/arm/kernel/sys_oabi-compat.c |8 -
 arch/arm/kvm/hyp/hyp-entry.S  |  112 ++-
 arch/arm/lib/copy_from_user.S |9 +
 arch/arm/mm/Kconfig   |   23 +++
 arch/arm/mm/Makefile  |2 
 arch/arm/mm/fault.c   |3 
 arch/arm/mm/proc-macros.S |3 
 arch/arm/mm/proc-v7-2level.S  |6 -
 arch/arm/mm/proc-v7-bugs.c|  174 ++
 arch/arm/mm/proc-v7.S |  154 +-
 arch/arm/vfp/vfpmodule.c  |   17 +-
 arch/arm64/crypto/sha1-ce-core.S  |6 -
 arch/arm64/crypto/sha1-ce-glue.c  |   11 -
 arch/arm64/crypto/sha2-ce-core.S  |6 -
 arch/arm64/crypto/sha2-ce-glue.c  |   13 --
 arch/arm64/include/asm/efi.h  |3 
 arch/arm64/include/asm/uaccess.h  |4 
 arch/ia64/kernel/Makefile |   26 
 arch/x86/Makefile |   39 +-
 arch/x86/boot/string.c|9 +
 arch/x86/crypto/aes_ctrby8_avx-x86_64.S   |7 -
 drivers/firmware/efi/libstub/Makefile |   26 ++--
 drivers/firmware/efi/libstub/arm64-stub.c |   10 +
 drivers/net/ethernet/broadcom/tg3.c   |   18 ++-
 drivers/net/usb/smsc95xx.c|7 +
 drivers/xen/Makefile  |3 
 include/linux/kbuild.h|6 -
 include/linux/module.h|4 
 net/core/dev.c|4 
 net/core/flow_dissector.c |4 
 net/ipv4/inet_fragment.c  |   28 ++--
 net/ipv4/ip_tunnel_core.c |2 
 net/ipv6/route.c  |7 -
 net/sctp/socket.c |   26 
 scripts/Kbuild.include|   18 ++-
 scripts/Makefile.build|8 +
 scripts/Makefile.extrawarn|1 
 scripts/Makefile.host |6 -
 scripts/Makefile.lib  |   31 +
 scripts/mod/Makefile  |   28 
 62 files changed, 901 insertions(+), 296 deletions(-)

Ard Biesheuvel (5):
  crypto: arm64/sha - avoid non-standard inline asm tricks
  efi/libstub/arm64: Use hidden attribute for struct screen_info reference
  efi/libstub/arm64: Force 'hidden' visibility for section markers
  efi/libstub: Preserve .debug sections after absolute relocation check
  efi/libstub/arm64: Set -fpie when building the EFI stub

Arnd Bergmann (2):
  modules: mark __inittest/__exittest as __maybe_unused
  Kbuild: use -fshort-wchar globally

Behan Webster (2):
  kbuild: Add better clang cross build support
  kbuild: use -Oz instead of -Os when using clang

David Ahern (1):
  ipv6: Fix PMTU updates for UDP/raw sockets in presence of VRF

Eric Dumazet (2):
  net-gro: reset skb->pkt_type in napi_reuse_skb()
  inet: frags: better deal with smp races

Frieder Schrempf (1):
  usbnet: smsc95xx: disable carrier check while suspending

Greg Kroah-Hartman (1):
  Linux 4.9.139

Jeroen Hofstee (1):
  kbuild: fix asm-offset generation to work with clang

Marc Zyngier (2):
  ARM: KVM: invalidate BTB on guest exit for Cortex-A12/A17
  ARM: KVM: invalidate icache on guest exit for Cortex-A15


Re: Linux 4.19.4

2018-11-22 Thread Greg KH
diff --git a/Makefile b/Makefile
index e4064fa16f11..1f3c7adeea63 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 4
 PATCHLEVEL = 19
-SUBLEVEL = 3
+SUBLEVEL = 4
 EXTRAVERSION =
 NAME = "People's Front"
 
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 53eb14a65610..40bdaea97fe7 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -35,10 +35,12 @@ static void __init spectre_v2_select_mitigation(void);
 static void __init ssb_select_mitigation(void);
 static void __init l1tf_select_mitigation(void);
 
-/* The base value of the SPEC_CTRL MSR that always has to be preserved. */
-u64 x86_spec_ctrl_base;
+/*
+ * Our boot-time value of the SPEC_CTRL MSR. We read it once so that any
+ * writes to SPEC_CTRL contain whatever reserved bits have been set.
+ */
+u64 __ro_after_init x86_spec_ctrl_base;
 EXPORT_SYMBOL_GPL(x86_spec_ctrl_base);
-static DEFINE_MUTEX(spec_ctrl_mutex);
 
 /*
  * The vendor and possibly platform specific bits which can be modified in
@@ -323,46 +325,6 @@ static enum spectre_v2_mitigation_cmd __init 
spectre_v2_parse_cmdline(void)
return cmd;
 }
 
-static bool stibp_needed(void)
-{
-   if (spectre_v2_enabled == SPECTRE_V2_NONE)
-   return false;
-
-   if (!boot_cpu_has(X86_FEATURE_STIBP))
-   return false;
-
-   return true;
-}
-
-static void update_stibp_msr(void *info)
-{
-   wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base);
-}
-
-void arch_smt_update(void)
-{
-   u64 mask;
-
-   if (!stibp_needed())
-   return;
-
-   mutex_lock(_ctrl_mutex);
-   mask = x86_spec_ctrl_base;
-   if (cpu_smt_control == CPU_SMT_ENABLED)
-   mask |= SPEC_CTRL_STIBP;
-   else
-   mask &= ~SPEC_CTRL_STIBP;
-
-   if (mask != x86_spec_ctrl_base) {
-   pr_info("Spectre v2 cross-process SMT mitigation: %s STIBP\n",
-   cpu_smt_control == CPU_SMT_ENABLED ?
-   "Enabling" : "Disabling");
-   x86_spec_ctrl_base = mask;
-   on_each_cpu(update_stibp_msr, NULL, 1);
-   }
-   mutex_unlock(_ctrl_mutex);
-}
-
 static void __init spectre_v2_select_mitigation(void)
 {
enum spectre_v2_mitigation_cmd cmd = spectre_v2_parse_cmdline();
@@ -462,9 +424,6 @@ static void __init spectre_v2_select_mitigation(void)
setup_force_cpu_cap(X86_FEATURE_USE_IBRS_FW);
pr_info("Enabling Restricted Speculation for firmware calls\n");
}
-
-   /* Enable STIBP if appropriate */
-   arch_smt_update();
 }
 
 #undef pr_fmt
@@ -855,8 +814,6 @@ static ssize_t l1tf_show_state(char *buf)
 static ssize_t cpu_show_common(struct device *dev, struct device_attribute 
*attr,
   char *buf, unsigned int bug)
 {
-   int ret;
-
if (!boot_cpu_has_bug(bug))
return sprintf(buf, "Not affected\n");
 
@@ -874,12 +831,10 @@ static ssize_t cpu_show_common(struct device *dev, struct 
device_attribute *attr
return sprintf(buf, "Mitigation: __user pointer 
sanitization\n");
 
case X86_BUG_SPECTRE_V2:
-   ret = sprintf(buf, "%s%s%s%s%s\n", 
spectre_v2_strings[spectre_v2_enabled],
+   return sprintf(buf, "%s%s%s%s\n", 
spectre_v2_strings[spectre_v2_enabled],
   boot_cpu_has(X86_FEATURE_USE_IBPB) ? ", IBPB" : 
"",
   boot_cpu_has(X86_FEATURE_USE_IBRS_FW) ? ", 
IBRS_FW" : "",
-  (x86_spec_ctrl_base & SPEC_CTRL_STIBP) ? ", 
STIBP" : "",
   spectre_v2_module_string());
-   return ret;
 
case X86_BUG_SPEC_STORE_BYPASS:
return sprintf(buf, "%s\n", ssb_strings[ssb_mode]);
diff --git a/drivers/net/dsa/microchip/ksz_common.c 
b/drivers/net/dsa/microchip/ksz_common.c
index 54e0ca6ed730..86b6464b4525 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -1117,11 +1117,6 @@ static int ksz_switch_init(struct ksz_device *dev)
 {
int i;
 
-   mutex_init(>reg_mutex);
-   mutex_init(>stats_mutex);
-   mutex_init(>alu_mutex);
-   mutex_init(>vlan_mutex);
-
dev->ds->ops = _switch_ops;
 
for (i = 0; i < ARRAY_SIZE(ksz_switch_chips); i++) {
@@ -1206,6 +1201,11 @@ int ksz_switch_register(struct ksz_device *dev)
if (dev->pdata)
dev->chip_id = dev->pdata->chip_id;
 
+   mutex_init(>reg_mutex);
+   mutex_init(>stats_mutex);
+   mutex_init(>alu_mutex);
+   mutex_init(>vlan_mutex);
+
if (ksz_switch_detect(dev))
return -EINVAL;
 
diff --git a/drivers/net/dsa/mv88e6xxx/global1.c 
b/drivers/net/dsa/mv88e6xxx/global1.c
index d721ccf7d8be..38e399e0f30e 100644
--- a/drivers/net/dsa/mv88e6xxx/global1.c
+++ b/drivers/net/dsa/mv88e6xxx/global1.c
@@ -567,6 +567,8 

Re: Linux 4.19.4

2018-11-22 Thread Greg KH
diff --git a/Makefile b/Makefile
index e4064fa16f11..1f3c7adeea63 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
 VERSION = 4
 PATCHLEVEL = 19
-SUBLEVEL = 3
+SUBLEVEL = 4
 EXTRAVERSION =
 NAME = "People's Front"
 
diff --git a/arch/x86/kernel/cpu/bugs.c b/arch/x86/kernel/cpu/bugs.c
index 53eb14a65610..40bdaea97fe7 100644
--- a/arch/x86/kernel/cpu/bugs.c
+++ b/arch/x86/kernel/cpu/bugs.c
@@ -35,10 +35,12 @@ static void __init spectre_v2_select_mitigation(void);
 static void __init ssb_select_mitigation(void);
 static void __init l1tf_select_mitigation(void);
 
-/* The base value of the SPEC_CTRL MSR that always has to be preserved. */
-u64 x86_spec_ctrl_base;
+/*
+ * Our boot-time value of the SPEC_CTRL MSR. We read it once so that any
+ * writes to SPEC_CTRL contain whatever reserved bits have been set.
+ */
+u64 __ro_after_init x86_spec_ctrl_base;
 EXPORT_SYMBOL_GPL(x86_spec_ctrl_base);
-static DEFINE_MUTEX(spec_ctrl_mutex);
 
 /*
  * The vendor and possibly platform specific bits which can be modified in
@@ -323,46 +325,6 @@ static enum spectre_v2_mitigation_cmd __init 
spectre_v2_parse_cmdline(void)
return cmd;
 }
 
-static bool stibp_needed(void)
-{
-   if (spectre_v2_enabled == SPECTRE_V2_NONE)
-   return false;
-
-   if (!boot_cpu_has(X86_FEATURE_STIBP))
-   return false;
-
-   return true;
-}
-
-static void update_stibp_msr(void *info)
-{
-   wrmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base);
-}
-
-void arch_smt_update(void)
-{
-   u64 mask;
-
-   if (!stibp_needed())
-   return;
-
-   mutex_lock(_ctrl_mutex);
-   mask = x86_spec_ctrl_base;
-   if (cpu_smt_control == CPU_SMT_ENABLED)
-   mask |= SPEC_CTRL_STIBP;
-   else
-   mask &= ~SPEC_CTRL_STIBP;
-
-   if (mask != x86_spec_ctrl_base) {
-   pr_info("Spectre v2 cross-process SMT mitigation: %s STIBP\n",
-   cpu_smt_control == CPU_SMT_ENABLED ?
-   "Enabling" : "Disabling");
-   x86_spec_ctrl_base = mask;
-   on_each_cpu(update_stibp_msr, NULL, 1);
-   }
-   mutex_unlock(_ctrl_mutex);
-}
-
 static void __init spectre_v2_select_mitigation(void)
 {
enum spectre_v2_mitigation_cmd cmd = spectre_v2_parse_cmdline();
@@ -462,9 +424,6 @@ static void __init spectre_v2_select_mitigation(void)
setup_force_cpu_cap(X86_FEATURE_USE_IBRS_FW);
pr_info("Enabling Restricted Speculation for firmware calls\n");
}
-
-   /* Enable STIBP if appropriate */
-   arch_smt_update();
 }
 
 #undef pr_fmt
@@ -855,8 +814,6 @@ static ssize_t l1tf_show_state(char *buf)
 static ssize_t cpu_show_common(struct device *dev, struct device_attribute 
*attr,
   char *buf, unsigned int bug)
 {
-   int ret;
-
if (!boot_cpu_has_bug(bug))
return sprintf(buf, "Not affected\n");
 
@@ -874,12 +831,10 @@ static ssize_t cpu_show_common(struct device *dev, struct 
device_attribute *attr
return sprintf(buf, "Mitigation: __user pointer 
sanitization\n");
 
case X86_BUG_SPECTRE_V2:
-   ret = sprintf(buf, "%s%s%s%s%s\n", 
spectre_v2_strings[spectre_v2_enabled],
+   return sprintf(buf, "%s%s%s%s\n", 
spectre_v2_strings[spectre_v2_enabled],
   boot_cpu_has(X86_FEATURE_USE_IBPB) ? ", IBPB" : 
"",
   boot_cpu_has(X86_FEATURE_USE_IBRS_FW) ? ", 
IBRS_FW" : "",
-  (x86_spec_ctrl_base & SPEC_CTRL_STIBP) ? ", 
STIBP" : "",
   spectre_v2_module_string());
-   return ret;
 
case X86_BUG_SPEC_STORE_BYPASS:
return sprintf(buf, "%s\n", ssb_strings[ssb_mode]);
diff --git a/drivers/net/dsa/microchip/ksz_common.c 
b/drivers/net/dsa/microchip/ksz_common.c
index 54e0ca6ed730..86b6464b4525 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -1117,11 +1117,6 @@ static int ksz_switch_init(struct ksz_device *dev)
 {
int i;
 
-   mutex_init(>reg_mutex);
-   mutex_init(>stats_mutex);
-   mutex_init(>alu_mutex);
-   mutex_init(>vlan_mutex);
-
dev->ds->ops = _switch_ops;
 
for (i = 0; i < ARRAY_SIZE(ksz_switch_chips); i++) {
@@ -1206,6 +1201,11 @@ int ksz_switch_register(struct ksz_device *dev)
if (dev->pdata)
dev->chip_id = dev->pdata->chip_id;
 
+   mutex_init(>reg_mutex);
+   mutex_init(>stats_mutex);
+   mutex_init(>alu_mutex);
+   mutex_init(>vlan_mutex);
+
if (ksz_switch_detect(dev))
return -EINVAL;
 
diff --git a/drivers/net/dsa/mv88e6xxx/global1.c 
b/drivers/net/dsa/mv88e6xxx/global1.c
index d721ccf7d8be..38e399e0f30e 100644
--- a/drivers/net/dsa/mv88e6xxx/global1.c
+++ b/drivers/net/dsa/mv88e6xxx/global1.c
@@ -567,6 +567,8 

Re: [PATCH v8 2/4] pps: descriptor-based gpio, capture-clear addition

2018-11-22 Thread Philipp Zabel
Hi Tom,

On Sat, Nov 17, 2018 at 2:07 PM Tom Burkart  wrote:
>
> This patch changes the GPIO access for the pps-gpio driver from the
> integer based ABI to the descriptor based ABI.  It also adds the
> extraction of the device tree capture-clear option.

Is the capture-clear property documented in
Documentation/devicetree/bindings/pps/pps-gpio.txt?
If not, you should add a binding documentation patch.

> Signed-off-by: Tom Burkart 
> ---
>  drivers/pps/clients/pps-gpio.c | 80 
> +-
>  include/linux/pps-gpio.h   |  3 +-
>  2 files changed, 41 insertions(+), 42 deletions(-)
>
> diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
> index 333ad7d5b45b..d2fbc91dc8fc 100644
> --- a/drivers/pps/clients/pps-gpio.c
> +++ b/drivers/pps/clients/pps-gpio.c
> @@ -31,7 +31,7 @@
>  #include 
>  #include 
>  #include 
> -#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -41,9 +41,9 @@ struct pps_gpio_device_data {
> int irq;/* IRQ used as PPS source */
> struct pps_device *pps; /* PPS source device */
> struct pps_source_info info;/* PPS source information */
> +   struct gpio_desc *gpio_pin; /* GPIO port descriptors */
> bool assert_falling_edge;
> bool capture_clear;
> -   unsigned int gpio_pin;
>  };
>
>  /*
> @@ -61,18 +61,49 @@ static irqreturn_t pps_gpio_irq_handler(int irq, void 
> *data)
>
> info = data;
>
> -   rising_edge = gpio_get_value(info->gpio_pin);
> +   rising_edge = gpiod_get_value(info->gpio_pin);
> if ((rising_edge && !info->assert_falling_edge) ||
> (!rising_edge && info->assert_falling_edge))
> pps_event(info->pps, , PPS_CAPTUREASSERT, NULL);
> else if (info->capture_clear &&
> ((rising_edge && info->assert_falling_edge) ||
> -(!rising_edge && !info->assert_falling_edge)))
> +   (!rising_edge && !info->assert_falling_edge)))
> pps_event(info->pps, , PPS_CAPTURECLEAR, NULL);
>
> return IRQ_HANDLED;
>  }
>
> +static int pps_gpio_setup(struct platform_device *pdev)
> +{
> +   struct pps_gpio_device_data *data = platform_get_drvdata(pdev);
> +   const struct pps_gpio_platform_data *pdata = pdev->dev.platform_data;
> +   struct device_node *np = pdev->dev.of_node;
> +   int ret;

Unused variable?

> +
> +   if (pdata) {
> +   data->gpio_pin = pdata->gpio_pin;
> +
> +   data->assert_falling_edge = pdata->assert_falling_edge;
> +   data->capture_clear = pdata->capture_clear;

This is just a matter of personal taste, so feel free to ignore:
I would keep the pdata branch in pps_gpio_probe and call this function
pps_gpio_dt_setup, to reduce indentation of the OF branch.

> +   } else {
> +   data->gpio_pin = devm_gpiod_get(>dev,
> +   NULL,   /* request "gpios" */
> +   GPIOD_IN);
> +   if (IS_ERR(data->gpio_pin)) {
> +   dev_err(>dev,
> +   "failed to request PPS GPIO\n");
> +   return PTR_ERR(data->gpio_pin);
> +   }
> +
> +   if (of_get_property(np, "assert-falling-edge", NULL))
> +   data->assert_falling_edge = true;
> +
> +   if (of_get_property(np, "capture-clear", NULL))
> +   data->capture_clear = true;

Those two should use the of_property_read_bool wrapper.

> +   }
> +   return 0;
> +}
> +
>  static unsigned long
>  get_irqf_trigger_flags(const struct pps_gpio_device_data *data)
>  {
> @@ -90,53 +121,23 @@ get_irqf_trigger_flags(const struct pps_gpio_device_data 
> *data)
>  static int pps_gpio_probe(struct platform_device *pdev)
>  {
> struct pps_gpio_device_data *data;
> -   const char *gpio_label;
> int ret;
> int pps_default_params;
> -   const struct pps_gpio_platform_data *pdata = pdev->dev.platform_data;
> -   struct device_node *np = pdev->dev.of_node;
>
> /* allocate space for device info */
> data = devm_kzalloc(>dev, sizeof(struct pps_gpio_device_data),

Could use sizeof(*data) here. Otherwise,

Reviewed-by: Philipp Zabel 

regards
Philipp


Linux 4.19.4

2018-11-22 Thread Greg KH
I'm announcing the release of the 4.19.4 kernel.

All users of the 4.19 kernel series must upgrade.

The updated 4.19.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.19.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile |2 
 arch/x86/kernel/cpu/bugs.c   |   57 +---
 drivers/net/dsa/microchip/ksz_common.c   |   10 +-
 drivers/net/dsa/mv88e6xxx/global1.c  |2 
 drivers/net/ethernet/broadcom/bcmsysport.c   |   15 +--
 drivers/net/ethernet/broadcom/genet/bcmgenet.c   |   13 +-
 drivers/net/ethernet/broadcom/tg3.c  |   18 +++-
 drivers/net/ethernet/ibm/ibmvnic.c   |2 
 drivers/net/ethernet/mellanox/mlx5/core/en.h |1 
 drivers/net/ethernet/mellanox/mlx5/core/en/port.c|4 
 drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c |4 
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c|   37 ++--
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c  |6 +
 drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c|   26 ++---
 drivers/net/ethernet/mellanox/mlx5/core/en_stats.c   |3 
 drivers/net/ethernet/mellanox/mlx5/core/en_stats.h   |2 
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c  |   67 +++
 drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c |   10 +-
 drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c|2 
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c   |1 
 drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c  |6 -
 drivers/net/phy/mdio-gpio.c  |   10 +-
 drivers/net/phy/realtek.c|2 
 drivers/net/tun.c|6 +
 drivers/net/usb/smsc95xx.c   |9 ++
 include/net/sctp/sctp.h  |   12 ++
 include/uapi/linux/sctp.h|3 
 kernel/cpu.c |   11 --
 net/core/dev.c   |4 
 net/core/flow_dissector.c|4 
 net/ipv4/inet_fragment.c |   29 +++---
 net/ipv4/ip_tunnel_core.c|2 
 net/ipv4/tcp_input.c |1 
 net/ipv6/route.c |   14 +--
 net/l2tp/l2tp_core.c |9 --
 net/rxrpc/ar-internal.h  |1 
 net/rxrpc/call_event.c   |   18 +++-
 net/rxrpc/output.c   |   35 ++-
 net/sched/act_pedit.c|3 
 net/sched/cls_flower.c   |   14 ++-
 net/sctp/output.c|3 
 net/sctp/outqueue.c  |2 
 net/sctp/socket.c|   26 +
 net/sctp/stream.c|1 
 net/tipc/discover.c  |   19 ++--
 net/tipc/link.c  |   11 +-
 net/tipc/net.c   |   45 --
 net/tipc/net.h   |2 
 net/tipc/socket.c|   15 ++-
 49 files changed, 355 insertions(+), 244 deletions(-)

Andrew Lunn (1):
  net: dsa: mv88e6xxx: Fix clearing of stats counters

David Ahern (1):
  ipv6: Fix PMTU updates for UDP/raw sockets in presence of VRF

David Howells (1):
  rxrpc: Fix lockup due to no error backoff after ack transmit error

Davide Caratti (1):
  net/sched: act_pedit: fix memory leak when IDR allocation fails

Denis Drozdov (1):
  net/mlx5e: IPoIB, Reset QP after channels are closed

Doug Berger (1):
  net: bcmgenet: protect stop from timeout

Eric Dumazet (2):
  net-gro: reset skb->pkt_type in napi_reuse_skb()
  inet: frags: better deal with smp races

Florian Fainelli (1):
  net: systemport: Protect stop from timeout

Frieder Schrempf (1):
  usbnet: smsc95xx: disable carrier check while suspending

Greg Kroah-Hartman (2):
  Revert "x86/speculation: Enable cross-hyperthread spectre v2 STIBP 
mitigation"
  Linux 4.19.4

Holger Hoffstätte (1):
  net: phy: realtek: fix RTL8201F sysfs name

Jakub Kicinski (1):
  net: sched: cls_flower: validate nested enc_opts_policy to avoid warning

Jon Maloy (3):
  tipc: don't assume linear buffer when reading ancillary data
  tipc: fix lockdep 

Re: [PATCH v8 2/4] pps: descriptor-based gpio, capture-clear addition

2018-11-22 Thread Philipp Zabel
Hi Tom,

On Sat, Nov 17, 2018 at 2:07 PM Tom Burkart  wrote:
>
> This patch changes the GPIO access for the pps-gpio driver from the
> integer based ABI to the descriptor based ABI.  It also adds the
> extraction of the device tree capture-clear option.

Is the capture-clear property documented in
Documentation/devicetree/bindings/pps/pps-gpio.txt?
If not, you should add a binding documentation patch.

> Signed-off-by: Tom Burkart 
> ---
>  drivers/pps/clients/pps-gpio.c | 80 
> +-
>  include/linux/pps-gpio.h   |  3 +-
>  2 files changed, 41 insertions(+), 42 deletions(-)
>
> diff --git a/drivers/pps/clients/pps-gpio.c b/drivers/pps/clients/pps-gpio.c
> index 333ad7d5b45b..d2fbc91dc8fc 100644
> --- a/drivers/pps/clients/pps-gpio.c
> +++ b/drivers/pps/clients/pps-gpio.c
> @@ -31,7 +31,7 @@
>  #include 
>  #include 
>  #include 
> -#include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -41,9 +41,9 @@ struct pps_gpio_device_data {
> int irq;/* IRQ used as PPS source */
> struct pps_device *pps; /* PPS source device */
> struct pps_source_info info;/* PPS source information */
> +   struct gpio_desc *gpio_pin; /* GPIO port descriptors */
> bool assert_falling_edge;
> bool capture_clear;
> -   unsigned int gpio_pin;
>  };
>
>  /*
> @@ -61,18 +61,49 @@ static irqreturn_t pps_gpio_irq_handler(int irq, void 
> *data)
>
> info = data;
>
> -   rising_edge = gpio_get_value(info->gpio_pin);
> +   rising_edge = gpiod_get_value(info->gpio_pin);
> if ((rising_edge && !info->assert_falling_edge) ||
> (!rising_edge && info->assert_falling_edge))
> pps_event(info->pps, , PPS_CAPTUREASSERT, NULL);
> else if (info->capture_clear &&
> ((rising_edge && info->assert_falling_edge) ||
> -(!rising_edge && !info->assert_falling_edge)))
> +   (!rising_edge && !info->assert_falling_edge)))
> pps_event(info->pps, , PPS_CAPTURECLEAR, NULL);
>
> return IRQ_HANDLED;
>  }
>
> +static int pps_gpio_setup(struct platform_device *pdev)
> +{
> +   struct pps_gpio_device_data *data = platform_get_drvdata(pdev);
> +   const struct pps_gpio_platform_data *pdata = pdev->dev.platform_data;
> +   struct device_node *np = pdev->dev.of_node;
> +   int ret;

Unused variable?

> +
> +   if (pdata) {
> +   data->gpio_pin = pdata->gpio_pin;
> +
> +   data->assert_falling_edge = pdata->assert_falling_edge;
> +   data->capture_clear = pdata->capture_clear;

This is just a matter of personal taste, so feel free to ignore:
I would keep the pdata branch in pps_gpio_probe and call this function
pps_gpio_dt_setup, to reduce indentation of the OF branch.

> +   } else {
> +   data->gpio_pin = devm_gpiod_get(>dev,
> +   NULL,   /* request "gpios" */
> +   GPIOD_IN);
> +   if (IS_ERR(data->gpio_pin)) {
> +   dev_err(>dev,
> +   "failed to request PPS GPIO\n");
> +   return PTR_ERR(data->gpio_pin);
> +   }
> +
> +   if (of_get_property(np, "assert-falling-edge", NULL))
> +   data->assert_falling_edge = true;
> +
> +   if (of_get_property(np, "capture-clear", NULL))
> +   data->capture_clear = true;

Those two should use the of_property_read_bool wrapper.

> +   }
> +   return 0;
> +}
> +
>  static unsigned long
>  get_irqf_trigger_flags(const struct pps_gpio_device_data *data)
>  {
> @@ -90,53 +121,23 @@ get_irqf_trigger_flags(const struct pps_gpio_device_data 
> *data)
>  static int pps_gpio_probe(struct platform_device *pdev)
>  {
> struct pps_gpio_device_data *data;
> -   const char *gpio_label;
> int ret;
> int pps_default_params;
> -   const struct pps_gpio_platform_data *pdata = pdev->dev.platform_data;
> -   struct device_node *np = pdev->dev.of_node;
>
> /* allocate space for device info */
> data = devm_kzalloc(>dev, sizeof(struct pps_gpio_device_data),

Could use sizeof(*data) here. Otherwise,

Reviewed-by: Philipp Zabel 

regards
Philipp


Linux 4.19.4

2018-11-22 Thread Greg KH
I'm announcing the release of the 4.19.4 kernel.

All users of the 4.19 kernel series must upgrade.

The updated 4.19.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git 
linux-4.19.y
and can be browsed at the normal kernel.org git web browser:

http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary

thanks,

greg k-h



 Makefile |2 
 arch/x86/kernel/cpu/bugs.c   |   57 +---
 drivers/net/dsa/microchip/ksz_common.c   |   10 +-
 drivers/net/dsa/mv88e6xxx/global1.c  |2 
 drivers/net/ethernet/broadcom/bcmsysport.c   |   15 +--
 drivers/net/ethernet/broadcom/genet/bcmgenet.c   |   13 +-
 drivers/net/ethernet/broadcom/tg3.c  |   18 +++-
 drivers/net/ethernet/ibm/ibmvnic.c   |2 
 drivers/net/ethernet/mellanox/mlx5/core/en.h |1 
 drivers/net/ethernet/mellanox/mlx5/core/en/port.c|4 
 drivers/net/ethernet/mellanox/mlx5/core/en/port_buffer.c |4 
 drivers/net/ethernet/mellanox/mlx5/core/en_main.c|   37 ++--
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c  |6 +
 drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c|   26 ++---
 drivers/net/ethernet/mellanox/mlx5/core/en_stats.c   |3 
 drivers/net/ethernet/mellanox/mlx5/core/en_stats.h   |2 
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c  |   67 +++
 drivers/net/ethernet/mellanox/mlx5/core/fpga/ipsec.c |   10 +-
 drivers/net/ethernet/mellanox/mlx5/core/ipoib/ipoib.c|2 
 drivers/net/ethernet/mellanox/mlxsw/spectrum.c   |1 
 drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c  |6 -
 drivers/net/phy/mdio-gpio.c  |   10 +-
 drivers/net/phy/realtek.c|2 
 drivers/net/tun.c|6 +
 drivers/net/usb/smsc95xx.c   |9 ++
 include/net/sctp/sctp.h  |   12 ++
 include/uapi/linux/sctp.h|3 
 kernel/cpu.c |   11 --
 net/core/dev.c   |4 
 net/core/flow_dissector.c|4 
 net/ipv4/inet_fragment.c |   29 +++---
 net/ipv4/ip_tunnel_core.c|2 
 net/ipv4/tcp_input.c |1 
 net/ipv6/route.c |   14 +--
 net/l2tp/l2tp_core.c |9 --
 net/rxrpc/ar-internal.h  |1 
 net/rxrpc/call_event.c   |   18 +++-
 net/rxrpc/output.c   |   35 ++-
 net/sched/act_pedit.c|3 
 net/sched/cls_flower.c   |   14 ++-
 net/sctp/output.c|3 
 net/sctp/outqueue.c  |2 
 net/sctp/socket.c|   26 +
 net/sctp/stream.c|1 
 net/tipc/discover.c  |   19 ++--
 net/tipc/link.c  |   11 +-
 net/tipc/net.c   |   45 --
 net/tipc/net.h   |2 
 net/tipc/socket.c|   15 ++-
 49 files changed, 355 insertions(+), 244 deletions(-)

Andrew Lunn (1):
  net: dsa: mv88e6xxx: Fix clearing of stats counters

David Ahern (1):
  ipv6: Fix PMTU updates for UDP/raw sockets in presence of VRF

David Howells (1):
  rxrpc: Fix lockup due to no error backoff after ack transmit error

Davide Caratti (1):
  net/sched: act_pedit: fix memory leak when IDR allocation fails

Denis Drozdov (1):
  net/mlx5e: IPoIB, Reset QP after channels are closed

Doug Berger (1):
  net: bcmgenet: protect stop from timeout

Eric Dumazet (2):
  net-gro: reset skb->pkt_type in napi_reuse_skb()
  inet: frags: better deal with smp races

Florian Fainelli (1):
  net: systemport: Protect stop from timeout

Frieder Schrempf (1):
  usbnet: smsc95xx: disable carrier check while suspending

Greg Kroah-Hartman (2):
  Revert "x86/speculation: Enable cross-hyperthread spectre v2 STIBP 
mitigation"
  Linux 4.19.4

Holger Hoffstätte (1):
  net: phy: realtek: fix RTL8201F sysfs name

Jakub Kicinski (1):
  net: sched: cls_flower: validate nested enc_opts_policy to avoid warning

Jon Maloy (3):
  tipc: don't assume linear buffer when reading ancillary data
  tipc: fix lockdep 

Re: [PATCH 4.19 00/42] 4.19.4-stable review

2018-11-22 Thread Greg Kroah-Hartman
On Thu, Nov 22, 2018 at 02:30:58PM -0800, Guenter Roeck wrote:
> On 11/22/18 2:01 PM, Thomas Voegtle wrote:
> > On Thu, 22 Nov 2018, Thomas Voegtle wrote:
> > 
> > > 
> > > Doesn't compile for me on OpenSuSE 15.0 (gcc 7.3.1):
> > > 
> > >   CALL    scripts/checksyscalls.sh
> > >   DESCEND  objtool
> > >   CHK include/generated/compile.h
> > >   CC [M]  drivers/gpu/drm/i915/i915_gem_gtt.o
> > > drivers/gpu/drm/i915/i915_gem_gtt.c: In function ‘gen6_dump_ppgtt’:
> > > drivers/gpu/drm/i915/i915_gem_gtt.c:1771:41: error: format ‘%llx’ expects
> > > argument of type ‘long long unsigned int’, but argument 5 has type ‘long
> > > unsigned int’ [-Werror=format=]
> > >    seq_printf(m, "\t\t(%03d, %04d) %08llx: ",
> > >    ~ ^
> > >    %08lx
> > > cc1: all warnings being treated as errors
> > > make[4]: *** [scripts/Makefile.build:306:
> > > drivers/gpu/drm/i915/i915_gem_gtt.o] Error 1
> > > make[3]: *** [scripts/Makefile.build:546: drivers/gpu/drm/i915] Error 2
> > > make[2]: *** [scripts/Makefile.build:546: drivers/gpu/drm] Error 2
> > > make[1]: *** [scripts/Makefile.build:546: drivers/gpu] Error 2
> > > make: *** [Makefile:1052: drivers] Error 2
> > > 
> > > 
> > > 
> > > 4.19.3 is broken for me, too. 4.19.2 is works.
> > > 4.20-rc tree works.
> > > 
> > > Config attached.
> > 
> > 
> > quick bisect shows problem is:
> > 
> > commit 1a25e1a1be71a49ee7f34fb14b5a26191e6cf501
> > Author: Chris Wilson 
> > Date:   Thu Oct 25 10:18:22 2018 +0100
> > 
> >      drm/i915: Mark up GTT sizes as u64
> > 
> >      commit c58281056a8b26d5d9dc15c19859a7880835ef44 upstream.
> > 
> > 
> > reverted on 4.19.4-rc1 it compiles for me. I guess something is missing 
> > here?
> > 
> AFAICS someone was not careful with the backport. Upstream doesn't have %llx
> at that place.

Yes it does, unless I'm reading the code wrong?

It seems that this does not trigger on upstream due to f6e35cda6614
("drm/i915: Replace some PAGE_SIZE with I915_GTT_PAGE_SIZE") being
there, which changed the type of the variable being displayed here.

I've now backported that as well, as it should help out over time, and
the build warning seems to be gone.

thanks,

greg k-h


Re: [PATCH 4.19 00/42] 4.19.4-stable review

2018-11-22 Thread Greg Kroah-Hartman
On Thu, Nov 22, 2018 at 02:30:58PM -0800, Guenter Roeck wrote:
> On 11/22/18 2:01 PM, Thomas Voegtle wrote:
> > On Thu, 22 Nov 2018, Thomas Voegtle wrote:
> > 
> > > 
> > > Doesn't compile for me on OpenSuSE 15.0 (gcc 7.3.1):
> > > 
> > >   CALL    scripts/checksyscalls.sh
> > >   DESCEND  objtool
> > >   CHK include/generated/compile.h
> > >   CC [M]  drivers/gpu/drm/i915/i915_gem_gtt.o
> > > drivers/gpu/drm/i915/i915_gem_gtt.c: In function ‘gen6_dump_ppgtt’:
> > > drivers/gpu/drm/i915/i915_gem_gtt.c:1771:41: error: format ‘%llx’ expects
> > > argument of type ‘long long unsigned int’, but argument 5 has type ‘long
> > > unsigned int’ [-Werror=format=]
> > >    seq_printf(m, "\t\t(%03d, %04d) %08llx: ",
> > >    ~ ^
> > >    %08lx
> > > cc1: all warnings being treated as errors
> > > make[4]: *** [scripts/Makefile.build:306:
> > > drivers/gpu/drm/i915/i915_gem_gtt.o] Error 1
> > > make[3]: *** [scripts/Makefile.build:546: drivers/gpu/drm/i915] Error 2
> > > make[2]: *** [scripts/Makefile.build:546: drivers/gpu/drm] Error 2
> > > make[1]: *** [scripts/Makefile.build:546: drivers/gpu] Error 2
> > > make: *** [Makefile:1052: drivers] Error 2
> > > 
> > > 
> > > 
> > > 4.19.3 is broken for me, too. 4.19.2 is works.
> > > 4.20-rc tree works.
> > > 
> > > Config attached.
> > 
> > 
> > quick bisect shows problem is:
> > 
> > commit 1a25e1a1be71a49ee7f34fb14b5a26191e6cf501
> > Author: Chris Wilson 
> > Date:   Thu Oct 25 10:18:22 2018 +0100
> > 
> >      drm/i915: Mark up GTT sizes as u64
> > 
> >      commit c58281056a8b26d5d9dc15c19859a7880835ef44 upstream.
> > 
> > 
> > reverted on 4.19.4-rc1 it compiles for me. I guess something is missing 
> > here?
> > 
> AFAICS someone was not careful with the backport. Upstream doesn't have %llx
> at that place.

Yes it does, unless I'm reading the code wrong?

It seems that this does not trigger on upstream due to f6e35cda6614
("drm/i915: Replace some PAGE_SIZE with I915_GTT_PAGE_SIZE") being
there, which changed the type of the variable being displayed here.

I've now backported that as well, as it should help out over time, and
the build warning seems to be gone.

thanks,

greg k-h


Re: [PATCH] exportfs: do not read dentry after free

2018-11-22 Thread PanBian
On Fri, Nov 23, 2018 at 07:58:15AM +0200, Amir Goldstein wrote:
> On Fri, Nov 23, 2018 at 5:16 AM Pan Bian  wrote:
> >
> > The function dentry_connected calls dput(dentry) to drop the previously
> > acquired reference to dentry. In this case, dentry can be released.
> > After that, IS_ROOT(dentry) checks the condition
> > (dentry == dentry->d_parent), which may result in a use-after-free bug.
> > This patch directly compares dentry with its parent obtained before
> > dropping the reference.
> >
> > Fixes: a056cc8934c("exportfs: stop retrying once we race with
> > rename/remove")
> >
> 
> CC Fixes patch author/reviewers
> 
> How did you find this? by code review or did this actually happen?
> 
> Normally a IS_ROOT dentry would be either DCACHE_DISCONNECTED or
> pinned to some super block, but I guess there may be corner cases?

I found this by code review, and I have not yet observed crash.

> 
> > Signed-off-by: Pan Bian 
> > ---
> >  fs/exportfs/expfs.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
> > index 645158d..a69aaf5 100644
> > --- a/fs/exportfs/expfs.c
> > +++ b/fs/exportfs/expfs.c
> > @@ -77,7 +77,7 @@ static bool dentry_connected(struct dentry *dentry)
> > struct dentry *parent = dget_parent(dentry);
> >
> > dput(dentry);
> > -   if (IS_ROOT(dentry)) {
> > +   if (dentry == parent) { /* is root entry */
> > dput(parent);
> > return false;
> > }
> 
> The change itself looks right, but the name IS_ROOT is confusing
> enough as it is. The explicit comment is just plain wrong.
> If it was really a root dentry, it wouldn't have been DCACHE_DISCONNECTED
> (unless it is a filesystem bug).

I will remove the comment and resubmit the patch.

Thanks a lot,
Pan

> 
> Thanks,
> Amir.



Re: [PATCH] exportfs: do not read dentry after free

2018-11-22 Thread PanBian
On Fri, Nov 23, 2018 at 07:58:15AM +0200, Amir Goldstein wrote:
> On Fri, Nov 23, 2018 at 5:16 AM Pan Bian  wrote:
> >
> > The function dentry_connected calls dput(dentry) to drop the previously
> > acquired reference to dentry. In this case, dentry can be released.
> > After that, IS_ROOT(dentry) checks the condition
> > (dentry == dentry->d_parent), which may result in a use-after-free bug.
> > This patch directly compares dentry with its parent obtained before
> > dropping the reference.
> >
> > Fixes: a056cc8934c("exportfs: stop retrying once we race with
> > rename/remove")
> >
> 
> CC Fixes patch author/reviewers
> 
> How did you find this? by code review or did this actually happen?
> 
> Normally a IS_ROOT dentry would be either DCACHE_DISCONNECTED or
> pinned to some super block, but I guess there may be corner cases?

I found this by code review, and I have not yet observed crash.

> 
> > Signed-off-by: Pan Bian 
> > ---
> >  fs/exportfs/expfs.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/fs/exportfs/expfs.c b/fs/exportfs/expfs.c
> > index 645158d..a69aaf5 100644
> > --- a/fs/exportfs/expfs.c
> > +++ b/fs/exportfs/expfs.c
> > @@ -77,7 +77,7 @@ static bool dentry_connected(struct dentry *dentry)
> > struct dentry *parent = dget_parent(dentry);
> >
> > dput(dentry);
> > -   if (IS_ROOT(dentry)) {
> > +   if (dentry == parent) { /* is root entry */
> > dput(parent);
> > return false;
> > }
> 
> The change itself looks right, but the name IS_ROOT is confusing
> enough as it is. The explicit comment is just plain wrong.
> If it was really a root dentry, it wouldn't have been DCACHE_DISCONNECTED
> (unless it is a filesystem bug).

I will remove the comment and resubmit the patch.

Thanks a lot,
Pan

> 
> Thanks,
> Amir.



Re: [patch 20/24] x86/speculation: Split out TIF update

2018-11-22 Thread Ingo Molnar


* Thomas Gleixner  wrote:

> On Thu, 22 Nov 2018, Ingo Molnar wrote:
> > * Thomas Gleixner  wrote:
> > 
> > Had to read this twice, because the comment and the code are both correct 
> > but deal with the inverse case. This might have helped:
> > 
> > /*
> >  * Immediately update the speculation MSRs on the current task,
> >  * but for non-current tasks delay setting the CPU mitigation 
> >  * until it is scheduled next.
> >  */
> > if (tsk == current && update)
> > speculation_ctrl_update_current();
> > 
> > But can the target task ever be non-current here? I don't think so: the 
> > two callers are prctl and seccomp, and both are passing in the current 
> > task pointer.
> 
> See te other mail. Yes, seccomp passes non current task pointers. Will
> update the comment.

Ignore my previous mail :-)

Thanks,

Ingo


Re: [patch 20/24] x86/speculation: Split out TIF update

2018-11-22 Thread Ingo Molnar


* Thomas Gleixner  wrote:

> On Thu, 22 Nov 2018, Ingo Molnar wrote:
> > * Thomas Gleixner  wrote:
> > 
> > Had to read this twice, because the comment and the code are both correct 
> > but deal with the inverse case. This might have helped:
> > 
> > /*
> >  * Immediately update the speculation MSRs on the current task,
> >  * but for non-current tasks delay setting the CPU mitigation 
> >  * until it is scheduled next.
> >  */
> > if (tsk == current && update)
> > speculation_ctrl_update_current();
> > 
> > But can the target task ever be non-current here? I don't think so: the 
> > two callers are prctl and seccomp, and both are passing in the current 
> > task pointer.
> 
> See te other mail. Yes, seccomp passes non current task pointers. Will
> update the comment.

Ignore my previous mail :-)

Thanks,

Ingo


Re: [patch 20/24] x86/speculation: Split out TIF update

2018-11-22 Thread Ingo Molnar


* Thomas Gleixner  wrote:

> On Wed, 21 Nov 2018, Tim Chen wrote:
> 
> > On Wed, Nov 21, 2018 at 09:14:50PM +0100, Thomas Gleixner wrote:
> > > +static void task_update_spec_tif(struct task_struct *tsk, int tifbit, 
> > > bool on)
> > >  {
> > >   bool update;
> > >
> > > + if (on)
> > > + update = !test_and_set_tsk_thread_flag(tsk, tifbit);
> > > + else
> > > + update = test_and_clear_tsk_thread_flag(tsk, tifbit);
> > > +
> > > + /*
> > > +  * If being set on non-current task, delay setting the CPU
> > > +  * mitigation until it is scheduled next.
> > > +  */
> > > + if (tsk == current && update)
> > > + speculation_ctrl_update_current();
> > 
> > I think all the call paths from prctl and seccomp coming here
> > has tsk == current.
> 
> We had that discussion before with SSBD:
> 
> seccomp_set_mode_filter()
>seccomp_attach_filter()
>   seccomp_sync_threads()
>  for_each_thread(t)
>   if (t == current)
>   continue;
>   seccomp_assign_mode(t)
> arch_seccomp_spec_mitigate(t);
> 
> seccomp_assign_mode(current...)
>   arch_seccomp_spec_mitigate();
> 
> > But if task_update_spec_tif gets used in the future where tsk is running
> > on a remote CPU, this could lead to the MSR getting out of sync with the
> > running task's TIF flag. This will break either performance or security.
> 
> We also had that discussion with SSBD and decided that we won't chase
> threads and send IPIs around. Yes, it's not perfect, but not the end of the
> world either. For PRCTL it's a non issue.

Fair enough and agreed - but please add a comment for all this, as it's a 
non-trivial and rare call context and a non-trivial implementation 
trade-off as a result.

Thanks,

Ingo


Re: [patch 20/24] x86/speculation: Split out TIF update

2018-11-22 Thread Ingo Molnar


* Thomas Gleixner  wrote:

> On Wed, 21 Nov 2018, Tim Chen wrote:
> 
> > On Wed, Nov 21, 2018 at 09:14:50PM +0100, Thomas Gleixner wrote:
> > > +static void task_update_spec_tif(struct task_struct *tsk, int tifbit, 
> > > bool on)
> > >  {
> > >   bool update;
> > >
> > > + if (on)
> > > + update = !test_and_set_tsk_thread_flag(tsk, tifbit);
> > > + else
> > > + update = test_and_clear_tsk_thread_flag(tsk, tifbit);
> > > +
> > > + /*
> > > +  * If being set on non-current task, delay setting the CPU
> > > +  * mitigation until it is scheduled next.
> > > +  */
> > > + if (tsk == current && update)
> > > + speculation_ctrl_update_current();
> > 
> > I think all the call paths from prctl and seccomp coming here
> > has tsk == current.
> 
> We had that discussion before with SSBD:
> 
> seccomp_set_mode_filter()
>seccomp_attach_filter()
>   seccomp_sync_threads()
>  for_each_thread(t)
>   if (t == current)
>   continue;
>   seccomp_assign_mode(t)
> arch_seccomp_spec_mitigate(t);
> 
> seccomp_assign_mode(current...)
>   arch_seccomp_spec_mitigate();
> 
> > But if task_update_spec_tif gets used in the future where tsk is running
> > on a remote CPU, this could lead to the MSR getting out of sync with the
> > running task's TIF flag. This will break either performance or security.
> 
> We also had that discussion with SSBD and decided that we won't chase
> threads and send IPIs around. Yes, it's not perfect, but not the end of the
> world either. For PRCTL it's a non issue.

Fair enough and agreed - but please add a comment for all this, as it's a 
non-trivial and rare call context and a non-trivial implementation 
trade-off as a result.

Thanks,

Ingo


Re: [PATCH 0/4] dts/layerscape-pci: removed unsuitable compatible string

2018-11-22 Thread Shawn Guo
On Tue, Nov 20, 2018 at 12:53:14PM +, Lorenzo Pieralisi wrote:
> On Mon, Oct 08, 2018 at 11:14:24AM +0800, Zhiqiang Hou wrote:
> > From: Hou Zhiqiang 
> > 
> > Removed the compatible string "snps,dw-pcie" from FSL layerscape-pci 
> > compatible
> > string list.
> > 
> > Hou Zhiqiang (4):
> >   doc/layerscape-pci: update the PCIe compatible strings
> >   doc/layerscape-pci: removed unsuitable compatible string
> >   dts/arm/ls1021a: Clean PCIe controller compatible strings
> >   dts/arm64/layerscape: Clean PCIe controller compatible strings
> > 
> >  .../devicetree/bindings/pci/layerscape-pci.txt   |  7 ---
> >  arch/arm/boot/dts/ls1021a.dtsi   |  4 ++--
> >  arch/arm64/boot/dts/freescale/fsl-ls1012a.dtsi   |  2 +-
> >  arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi   |  6 +++---
> >  arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi   |  6 +++---
> >  arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi   |  6 +++---
> >  arch/arm64/boot/dts/freescale/fsl-ls2088a.dtsi   |  8 
> >  arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi   | 12 
> >  8 files changed, 24 insertions(+), 27 deletions(-)
> 
> Hi Rob,
> 
> I assume the dts changes in this series are OK so I am going to
> pull them in the PCI tree, please let me know if you see any
> problem with that.

I will take the dts changes.

Shawn


Re: [PATCH 0/4] dts/layerscape-pci: removed unsuitable compatible string

2018-11-22 Thread Shawn Guo
On Tue, Nov 20, 2018 at 12:53:14PM +, Lorenzo Pieralisi wrote:
> On Mon, Oct 08, 2018 at 11:14:24AM +0800, Zhiqiang Hou wrote:
> > From: Hou Zhiqiang 
> > 
> > Removed the compatible string "snps,dw-pcie" from FSL layerscape-pci 
> > compatible
> > string list.
> > 
> > Hou Zhiqiang (4):
> >   doc/layerscape-pci: update the PCIe compatible strings
> >   doc/layerscape-pci: removed unsuitable compatible string
> >   dts/arm/ls1021a: Clean PCIe controller compatible strings
> >   dts/arm64/layerscape: Clean PCIe controller compatible strings
> > 
> >  .../devicetree/bindings/pci/layerscape-pci.txt   |  7 ---
> >  arch/arm/boot/dts/ls1021a.dtsi   |  4 ++--
> >  arch/arm64/boot/dts/freescale/fsl-ls1012a.dtsi   |  2 +-
> >  arch/arm64/boot/dts/freescale/fsl-ls1043a.dtsi   |  6 +++---
> >  arch/arm64/boot/dts/freescale/fsl-ls1046a.dtsi   |  6 +++---
> >  arch/arm64/boot/dts/freescale/fsl-ls1088a.dtsi   |  6 +++---
> >  arch/arm64/boot/dts/freescale/fsl-ls2088a.dtsi   |  8 
> >  arch/arm64/boot/dts/freescale/fsl-ls208xa.dtsi   | 12 
> >  8 files changed, 24 insertions(+), 27 deletions(-)
> 
> Hi Rob,
> 
> I assume the dts changes in this series are OK so I am going to
> pull them in the PCI tree, please let me know if you see any
> problem with that.

I will take the dts changes.

Shawn


[tip:perf/urgent] uprobes: Fix handle_swbp() vs. unregister() + register() race once more

2018-11-22 Thread tip-bot for Andrea Parri
Commit-ID:  09d3f015d1e1b4fee7e9bbdcf54201d239393391
Gitweb: https://git.kernel.org/tip/09d3f015d1e1b4fee7e9bbdcf54201d239393391
Author: Andrea Parri 
AuthorDate: Thu, 22 Nov 2018 17:10:31 +0100
Committer:  Ingo Molnar 
CommitDate: Fri, 23 Nov 2018 08:31:19 +0100

uprobes: Fix handle_swbp() vs. unregister() + register() race once more

Commit:

  142b18ddc8143 ("uprobes: Fix handle_swbp() vs unregister() + register() race")

added the UPROBE_COPY_INSN flag, and corresponding smp_wmb() and smp_rmb()
memory barriers, to ensure that handle_swbp() uses fully-initialized
uprobes only.

However, the smp_rmb() is mis-placed: this barrier should be placed
after handle_swbp() has tested for the flag, thus guaranteeing that
(program-order) subsequent loads from the uprobe can see the initial
stores performed by prepare_uprobe().

Move the smp_rmb() accordingly.  Also amend the comments associated
to the two memory barriers to indicate their actual locations.

Signed-off-by: Andrea Parri 
Acked-by: Oleg Nesterov 
Cc: Alexander Shishkin 
Cc: Andrew Morton 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Linus Torvalds 
Cc: Namhyung Kim 
Cc: Paul E. McKenney 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: Thomas Gleixner 
Cc: Vince Weaver 
Cc: sta...@kernel.org
Fixes: 142b18ddc8143 ("uprobes: Fix handle_swbp() vs unregister() + register() 
race")
Link: 
http://lkml.kernel.org/r/20181122161031.15179-1-andrea.pa...@amarulasolutions.com
Signed-off-by: Ingo Molnar 
---
 kernel/events/uprobes.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 96d4bee83489..322e97bbb437 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -829,7 +829,7 @@ static int prepare_uprobe(struct uprobe *uprobe, struct 
file *file,
BUG_ON((uprobe->offset & ~PAGE_MASK) +
UPROBE_SWBP_INSN_SIZE > PAGE_SIZE);
 
-   smp_wmb(); /* pairs with rmb() in find_active_uprobe() */
+   smp_wmb(); /* pairs with the smp_rmb() in handle_swbp() */
set_bit(UPROBE_COPY_INSN, >flags);
 
  out:
@@ -2178,10 +2178,18 @@ static void handle_swbp(struct pt_regs *regs)
 * After we hit the bp, _unregister + _register can install the
 * new and not-yet-analyzed uprobe at the same address, restart.
 */
-   smp_rmb(); /* pairs with wmb() in install_breakpoint() */
if (unlikely(!test_bit(UPROBE_COPY_INSN, >flags)))
goto out;
 
+   /*
+* Pairs with the smp_wmb() in prepare_uprobe().
+*
+* Guarantees that if we see the UPROBE_COPY_INSN bit set, then
+* we must also see the stores to >arch performed by the
+* prepare_uprobe() call.
+*/
+   smp_rmb();
+
/* Tracing handlers use ->utask to communicate with fetch methods */
if (!get_utask())
goto out;


[tip:perf/urgent] uprobes: Fix handle_swbp() vs. unregister() + register() race once more

2018-11-22 Thread tip-bot for Andrea Parri
Commit-ID:  09d3f015d1e1b4fee7e9bbdcf54201d239393391
Gitweb: https://git.kernel.org/tip/09d3f015d1e1b4fee7e9bbdcf54201d239393391
Author: Andrea Parri 
AuthorDate: Thu, 22 Nov 2018 17:10:31 +0100
Committer:  Ingo Molnar 
CommitDate: Fri, 23 Nov 2018 08:31:19 +0100

uprobes: Fix handle_swbp() vs. unregister() + register() race once more

Commit:

  142b18ddc8143 ("uprobes: Fix handle_swbp() vs unregister() + register() race")

added the UPROBE_COPY_INSN flag, and corresponding smp_wmb() and smp_rmb()
memory barriers, to ensure that handle_swbp() uses fully-initialized
uprobes only.

However, the smp_rmb() is mis-placed: this barrier should be placed
after handle_swbp() has tested for the flag, thus guaranteeing that
(program-order) subsequent loads from the uprobe can see the initial
stores performed by prepare_uprobe().

Move the smp_rmb() accordingly.  Also amend the comments associated
to the two memory barriers to indicate their actual locations.

Signed-off-by: Andrea Parri 
Acked-by: Oleg Nesterov 
Cc: Alexander Shishkin 
Cc: Andrew Morton 
Cc: Arnaldo Carvalho de Melo 
Cc: Jiri Olsa 
Cc: Linus Torvalds 
Cc: Namhyung Kim 
Cc: Paul E. McKenney 
Cc: Peter Zijlstra 
Cc: Stephane Eranian 
Cc: Thomas Gleixner 
Cc: Vince Weaver 
Cc: sta...@kernel.org
Fixes: 142b18ddc8143 ("uprobes: Fix handle_swbp() vs unregister() + register() 
race")
Link: 
http://lkml.kernel.org/r/20181122161031.15179-1-andrea.pa...@amarulasolutions.com
Signed-off-by: Ingo Molnar 
---
 kernel/events/uprobes.c | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 96d4bee83489..322e97bbb437 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -829,7 +829,7 @@ static int prepare_uprobe(struct uprobe *uprobe, struct 
file *file,
BUG_ON((uprobe->offset & ~PAGE_MASK) +
UPROBE_SWBP_INSN_SIZE > PAGE_SIZE);
 
-   smp_wmb(); /* pairs with rmb() in find_active_uprobe() */
+   smp_wmb(); /* pairs with the smp_rmb() in handle_swbp() */
set_bit(UPROBE_COPY_INSN, >flags);
 
  out:
@@ -2178,10 +2178,18 @@ static void handle_swbp(struct pt_regs *regs)
 * After we hit the bp, _unregister + _register can install the
 * new and not-yet-analyzed uprobe at the same address, restart.
 */
-   smp_rmb(); /* pairs with wmb() in install_breakpoint() */
if (unlikely(!test_bit(UPROBE_COPY_INSN, >flags)))
goto out;
 
+   /*
+* Pairs with the smp_wmb() in prepare_uprobe().
+*
+* Guarantees that if we see the UPROBE_COPY_INSN bit set, then
+* we must also see the stores to >arch performed by the
+* prepare_uprobe() call.
+*/
+   smp_rmb();
+
/* Tracing handlers use ->utask to communicate with fetch methods */
if (!get_utask())
goto out;


Re: [PATCH] uprobes: Fix handle_swbp() vs. unregister() + register() race once more

2018-11-22 Thread Ingo Molnar


* Oleg Nesterov  wrote:

> On 11/22, Oleg Nesterov wrote:
> > On 11/22, Andrea Parri wrote:
> > >
> > > Commit 142b18ddc8143 ("uprobes: Fix handle_swbp() vs unregister() +
> > > register() race") added the UPROBE_COPY_INSN flag, and corresponding
> > > smp_wmb() and smp_rmb() memory barriers, to ensure that handle_swbp()
> > > uses fully-initialized uprobes only.
> > > 
> > > However, the smp_rmb() is mis-placed: this barrier should be placed
> > > after handle_swbp() has tested for the flag, thus guaranteeing that
> > > (program-order) subsequent loads from the uprobe can see the initial
> > > stores performed by prepare_uprobe().
> > > 
> > > Move the smp_rmb() accordingly.  Also amend the comments associated
> > > to the two memory barriers to indicate their actual locations.
> > > 
> > > Signed-off-by: Andrea Parri 
> > > Cc: Peter Zijlstra 
> > > Cc: Ingo Molnar 
> > > Cc: Arnaldo Carvalho de Melo 
> > > Cc: Alexander Shishkin 
> > > Cc: Jiri Olsa 
> > > Cc: Namhyung Kim 
> > > Cc: Oleg Nesterov 
> > > Cc: sta...@kernel.org
> > > Fixes: 142b18ddc8143 ("uprobes: Fix handle_swbp() vs unregister() + 
> > > register() race")
> > 
> > Thanks,
> > 
> > Acked-by: Oleg Nesterov 
> 
> Yes, but I am not sure this is the -stable material...

So I left the Cc: stable tag intact, because this is a really low-risk 
fix (it just moves barriers around), and clearly fixes a bug that people 
might or might not have observed.

Even if they observed it the race is probably very hard to reproduce and 
almost impossible to report - so we are better off propagating this fix 
to -stable, as there's no realistic actionable way for users to actually 
complain about the bug if it affects them.

That's the general backporting policy for race fixes, unless they are 
really, really intrusive - which this one isn't really.

Thanks,

Ingo


Re: [PATCH] uprobes: Fix handle_swbp() vs. unregister() + register() race once more

2018-11-22 Thread Ingo Molnar


* Oleg Nesterov  wrote:

> On 11/22, Oleg Nesterov wrote:
> > On 11/22, Andrea Parri wrote:
> > >
> > > Commit 142b18ddc8143 ("uprobes: Fix handle_swbp() vs unregister() +
> > > register() race") added the UPROBE_COPY_INSN flag, and corresponding
> > > smp_wmb() and smp_rmb() memory barriers, to ensure that handle_swbp()
> > > uses fully-initialized uprobes only.
> > > 
> > > However, the smp_rmb() is mis-placed: this barrier should be placed
> > > after handle_swbp() has tested for the flag, thus guaranteeing that
> > > (program-order) subsequent loads from the uprobe can see the initial
> > > stores performed by prepare_uprobe().
> > > 
> > > Move the smp_rmb() accordingly.  Also amend the comments associated
> > > to the two memory barriers to indicate their actual locations.
> > > 
> > > Signed-off-by: Andrea Parri 
> > > Cc: Peter Zijlstra 
> > > Cc: Ingo Molnar 
> > > Cc: Arnaldo Carvalho de Melo 
> > > Cc: Alexander Shishkin 
> > > Cc: Jiri Olsa 
> > > Cc: Namhyung Kim 
> > > Cc: Oleg Nesterov 
> > > Cc: sta...@kernel.org
> > > Fixes: 142b18ddc8143 ("uprobes: Fix handle_swbp() vs unregister() + 
> > > register() race")
> > 
> > Thanks,
> > 
> > Acked-by: Oleg Nesterov 
> 
> Yes, but I am not sure this is the -stable material...

So I left the Cc: stable tag intact, because this is a really low-risk 
fix (it just moves barriers around), and clearly fixes a bug that people 
might or might not have observed.

Even if they observed it the race is probably very hard to reproduce and 
almost impossible to report - so we are better off propagating this fix 
to -stable, as there's no realistic actionable way for users to actually 
complain about the bug if it affects them.

That's the general backporting policy for race fixes, unless they are 
really, really intrusive - which this one isn't really.

Thanks,

Ingo


[PATCH] arm64: dts: rockchip: Add DT for nanopc-t4

2018-11-22 Thread Tomeu Vizoso
This adds a device tree for the NanoPC-T4 SBC, which is based on the
Rockchip RK3399 SoC and marketed by FriendlyELEC.

Known working:

- Serial
- Ethernet
- HDMI
- USB 2.0

All of the interesting stuff is in a .dtsi because there are at least
two other boards that share most of it: NanoPi M4 and NanoPi NEO4.

Signed-off-by: Tomeu Vizoso 
---
 .../devicetree/bindings/arm/rockchip.txt  |   4 +
 arch/arm64/boot/dts/rockchip/Makefile |   1 +
 .../boot/dts/rockchip/rk3399-nanopc-t4.dts|  18 +
 .../boot/dts/rockchip/rk3399-nanopi4.dtsi | 782 ++
 4 files changed, 805 insertions(+)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi

diff --git a/Documentation/devicetree/bindings/arm/rockchip.txt 
b/Documentation/devicetree/bindings/arm/rockchip.txt
index 0cc71236d639..57e048dfec1f 100644
--- a/Documentation/devicetree/bindings/arm/rockchip.txt
+++ b/Documentation/devicetree/bindings/arm/rockchip.txt
@@ -71,6 +71,10 @@ Rockchip platforms device tree bindings
 Required root node properties:
   - compatible = "firefly,roc-rk3399-pc", "rockchip,rk3399";
 
+- FriendlyElec NanoPC-T4 board:
+Required root node properties:
+  - compatible = "friendlyelec,nanopc-t4", "rockchip,rk3399";
+
 - ChipSPARK PopMetal-RK3288 board:
 Required root node properties:
   - compatible = "chipspark,popmetal-rk3288", "rockchip,rk3288";
diff --git a/arch/arm64/boot/dts/rockchip/Makefile 
b/arch/arm64/boot/dts/rockchip/Makefile
index 49042c477870..ed90cd1e5a8b 100644
--- a/arch/arm64/boot/dts/rockchip/Makefile
+++ b/arch/arm64/boot/dts/rockchip/Makefile
@@ -20,3 +20,4 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock960.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rockpro64.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire-excavator.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopc-t4.dtb
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts 
b/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
new file mode 100644
index ..8e716c790d60
--- /dev/null
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * FriendlyElec NanoPC-T4 board device tree source
+ *
+ * Copyright (c) 2018 FriendlyElec Computer Tech. Co., Ltd.
+ * (http://www.friendlyarm.com)
+ *
+ * Copyright (c) 2018 Collabora Ltd.
+ */
+
+/dts-v1/;
+#include "rk3399-nanopi4.dtsi"
+
+/ {
+   model = "FriendlyElec NanoPC-T4";
+   compatible = "friendlyelec,nanopc-t4", "rockchip,rk3399";
+};
+
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi 
b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi
new file mode 100644
index ..01be5cc57213
--- /dev/null
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi
@@ -0,0 +1,782 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * RK3399-based FriendlyElec boards device tree source
+ *
+ * Copyright (c) 2016 Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * Copyright (c) 2018 FriendlyElec Computer Tech. Co., Ltd.
+ * (http://www.friendlyarm.com)
+ *
+ * Copyright (c) 2018 Collabora Ltd.
+ */
+
+/dts-v1/;
+#include 
+#include "rk3399.dtsi"
+#include "rk3399-opp.dtsi"
+
+/ {
+   chosen {
+   stdout-path = "serial2:150n8";
+   };
+
+   clkin_gmac: external-gmac-clock {
+   compatible = "fixed-clock";
+   clock-frequency = <12500>;
+   clock-output-names = "clkin_gmac";
+   #clock-cells = <0>;
+   };
+
+   vcc3v3_sys: vcc3v3-sys {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc3v3_sys";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   };
+
+   vcc5v0_host: vcc5v0-host-regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc5v0_host";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   };
+
+   vcc5v0_sys: vcc5v0-sys {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc5v0_sys";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   };
+
+   vccadc_ref: vccadc-ref {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc1v8_sys";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   };
+
+   vcc_sd: vcc-sd {
+   compatible = "regulator-fixed";
+   

[PATCH] arm64: dts: rockchip: Add DT for nanopc-t4

2018-11-22 Thread Tomeu Vizoso
This adds a device tree for the NanoPC-T4 SBC, which is based on the
Rockchip RK3399 SoC and marketed by FriendlyELEC.

Known working:

- Serial
- Ethernet
- HDMI
- USB 2.0

All of the interesting stuff is in a .dtsi because there are at least
two other boards that share most of it: NanoPi M4 and NanoPi NEO4.

Signed-off-by: Tomeu Vizoso 
---
 .../devicetree/bindings/arm/rockchip.txt  |   4 +
 arch/arm64/boot/dts/rockchip/Makefile |   1 +
 .../boot/dts/rockchip/rk3399-nanopc-t4.dts|  18 +
 .../boot/dts/rockchip/rk3399-nanopi4.dtsi | 782 ++
 4 files changed, 805 insertions(+)
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
 create mode 100644 arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi

diff --git a/Documentation/devicetree/bindings/arm/rockchip.txt 
b/Documentation/devicetree/bindings/arm/rockchip.txt
index 0cc71236d639..57e048dfec1f 100644
--- a/Documentation/devicetree/bindings/arm/rockchip.txt
+++ b/Documentation/devicetree/bindings/arm/rockchip.txt
@@ -71,6 +71,10 @@ Rockchip platforms device tree bindings
 Required root node properties:
   - compatible = "firefly,roc-rk3399-pc", "rockchip,rk3399";
 
+- FriendlyElec NanoPC-T4 board:
+Required root node properties:
+  - compatible = "friendlyelec,nanopc-t4", "rockchip,rk3399";
+
 - ChipSPARK PopMetal-RK3288 board:
 Required root node properties:
   - compatible = "chipspark,popmetal-rk3288", "rockchip,rk3288";
diff --git a/arch/arm64/boot/dts/rockchip/Makefile 
b/arch/arm64/boot/dts/rockchip/Makefile
index 49042c477870..ed90cd1e5a8b 100644
--- a/arch/arm64/boot/dts/rockchip/Makefile
+++ b/arch/arm64/boot/dts/rockchip/Makefile
@@ -20,3 +20,4 @@ dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rock960.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-rockpro64.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire.dtb
 dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-sapphire-excavator.dtb
+dtb-$(CONFIG_ARCH_ROCKCHIP) += rk3399-nanopc-t4.dtb
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts 
b/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
new file mode 100644
index ..8e716c790d60
--- /dev/null
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopc-t4.dts
@@ -0,0 +1,18 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * FriendlyElec NanoPC-T4 board device tree source
+ *
+ * Copyright (c) 2018 FriendlyElec Computer Tech. Co., Ltd.
+ * (http://www.friendlyarm.com)
+ *
+ * Copyright (c) 2018 Collabora Ltd.
+ */
+
+/dts-v1/;
+#include "rk3399-nanopi4.dtsi"
+
+/ {
+   model = "FriendlyElec NanoPC-T4";
+   compatible = "friendlyelec,nanopc-t4", "rockchip,rk3399";
+};
+
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi 
b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi
new file mode 100644
index ..01be5cc57213
--- /dev/null
+++ b/arch/arm64/boot/dts/rockchip/rk3399-nanopi4.dtsi
@@ -0,0 +1,782 @@
+// SPDX-License-Identifier: (GPL-2.0+ OR MIT)
+/*
+ * RK3399-based FriendlyElec boards device tree source
+ *
+ * Copyright (c) 2016 Fuzhou Rockchip Electronics Co., Ltd
+ *
+ * Copyright (c) 2018 FriendlyElec Computer Tech. Co., Ltd.
+ * (http://www.friendlyarm.com)
+ *
+ * Copyright (c) 2018 Collabora Ltd.
+ */
+
+/dts-v1/;
+#include 
+#include "rk3399.dtsi"
+#include "rk3399-opp.dtsi"
+
+/ {
+   chosen {
+   stdout-path = "serial2:150n8";
+   };
+
+   clkin_gmac: external-gmac-clock {
+   compatible = "fixed-clock";
+   clock-frequency = <12500>;
+   clock-output-names = "clkin_gmac";
+   #clock-cells = <0>;
+   };
+
+   vcc3v3_sys: vcc3v3-sys {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc3v3_sys";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <330>;
+   regulator-max-microvolt = <330>;
+   };
+
+   vcc5v0_host: vcc5v0-host-regulator {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc5v0_host";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   };
+
+   vcc5v0_sys: vcc5v0-sys {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc5v0_sys";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <500>;
+   regulator-max-microvolt = <500>;
+   };
+
+   vccadc_ref: vccadc-ref {
+   compatible = "regulator-fixed";
+   regulator-name = "vcc1v8_sys";
+   regulator-always-on;
+   regulator-boot-on;
+   regulator-min-microvolt = <180>;
+   regulator-max-microvolt = <180>;
+   };
+
+   vcc_sd: vcc-sd {
+   compatible = "regulator-fixed";
+   

Re: [PATCH 4.9 00/59] 4.9.139-stable review

2018-11-22 Thread Greg Kroah-Hartman
On Fri, Nov 23, 2018 at 12:46:51PM +0530, Naresh Kamboju wrote:
> On Thu, 22 Nov 2018 at 00:40, Greg Kroah-Hartman
>  wrote:
> >
> > This is the start of the stable review cycle for the 4.9.139 release.
> > There are 59 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> >
> > Responses should be made by Fri Nov 23 18:34:55 UTC 2018.
> > Anything received after that time might be too late.
> >
> > The whole patch series can be found in one patch at:
> > 
> > https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.139-rc1.gz
> > or in the git tree and branch at:
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> > linux-4.9.y
> > and the diffstat can be found below.
> >
> > thanks,
> >
> > greg k-h
> 
> Results from Linaro’s test farm.
> No regressions on arm64, arm, x86_64, and i386.

Great, thanks for testing and letting me know.

greg k-h


Re: [PATCH 4.9 00/59] 4.9.139-stable review

2018-11-22 Thread Greg Kroah-Hartman
On Fri, Nov 23, 2018 at 12:46:51PM +0530, Naresh Kamboju wrote:
> On Thu, 22 Nov 2018 at 00:40, Greg Kroah-Hartman
>  wrote:
> >
> > This is the start of the stable review cycle for the 4.9.139 release.
> > There are 59 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> >
> > Responses should be made by Fri Nov 23 18:34:55 UTC 2018.
> > Anything received after that time might be too late.
> >
> > The whole patch series can be found in one patch at:
> > 
> > https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.139-rc1.gz
> > or in the git tree and branch at:
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> > linux-4.9.y
> > and the diffstat can be found below.
> >
> > thanks,
> >
> > greg k-h
> 
> Results from Linaro’s test farm.
> No regressions on arm64, arm, x86_64, and i386.

Great, thanks for testing and letting me know.

greg k-h


[PATCH RESEND V2] Documentation: can: flexcan: add stop mode property

2018-11-22 Thread Joakim Zhang
From: Dong Aisheng 

The FlexCAN controller can parse the stop mode property to enable CAN
self wakeup feature.

Signed-off-by: Dong Aisheng 
Signed-off-by: Joakim Zhang 
---
ChangeLog:
V1->V2:
*add a vendor prefix in property (stop-mode -> fsl,stop-mode).
---
 Documentation/devicetree/bindings/net/can/fsl-flexcan.txt | 8 
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt 
b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
index bfc0c433654f..bc77477c6878 100644
--- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
+++ b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
@@ -24,6 +24,14 @@ Optional properties:
   if this property is present then controller is assumed to be big
   endian.
 
+- fsl,stop-mode: register bits of stop mode control, the format is
+< req_gpr req_bit ack_gpr ack_bit>.
+gpr is the phandle to general purpose register node.
+req_gpr is the gpr register offset of CAN stop request.
+req_bit is the bit offset of CAN stop request.
+ack_gpr is the gpr register offset of CAN stop acknowledge.
+ack_bit is the bit offset of CAN stop acknowledge.
+
 Example:
 
can@1c000 {
-- 
2.17.1



[PATCH RESEND V2] Documentation: can: flexcan: add stop mode property

2018-11-22 Thread Joakim Zhang
From: Dong Aisheng 

The FlexCAN controller can parse the stop mode property to enable CAN
self wakeup feature.

Signed-off-by: Dong Aisheng 
Signed-off-by: Joakim Zhang 
---
ChangeLog:
V1->V2:
*add a vendor prefix in property (stop-mode -> fsl,stop-mode).
---
 Documentation/devicetree/bindings/net/can/fsl-flexcan.txt | 8 
 1 file changed, 8 insertions(+)

diff --git a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt 
b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
index bfc0c433654f..bc77477c6878 100644
--- a/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
+++ b/Documentation/devicetree/bindings/net/can/fsl-flexcan.txt
@@ -24,6 +24,14 @@ Optional properties:
   if this property is present then controller is assumed to be big
   endian.
 
+- fsl,stop-mode: register bits of stop mode control, the format is
+< req_gpr req_bit ack_gpr ack_bit>.
+gpr is the phandle to general purpose register node.
+req_gpr is the gpr register offset of CAN stop request.
+req_bit is the bit offset of CAN stop request.
+ack_gpr is the gpr register offset of CAN stop acknowledge.
+ack_bit is the bit offset of CAN stop acknowledge.
+
 Example:
 
can@1c000 {
-- 
2.17.1



[GIT PULL] MMC fixes for v4.20-rc4

2018-11-22 Thread Ulf Hansson
Hi Linus,

Here's a PR with two MMC fixes intended for v4.20-rc4. Details about the
highlights are as usual found in the signed tag.

Please pull this in!

Kind regards
Ulf Hansson


The following changes since commit ccda4af0f4b92f7b4c308d3acc262f4a7e3affad:

  Linux 4.20-rc2 (2018-11-11 17:12:31 -0600)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git tags/mmc-v4.20-rc2

for you to fetch changes up to 5305ec6a27b2dc7398a689e661a4a2e951026f09:

  mmc: sdhci-pci: Workaround GLK firmware failing to restore the tuning value 
(2018-11-19 14:11:07 +0100)


MMC host:
 - sdhci-pci: Fixup card detect lookup
 - sdhci-pci: Workaround GLK firmware bug for tuning


Adrian Hunter (1):
  mmc: sdhci-pci: Workaround GLK firmware failing to restore the tuning 
value

Rajat Jain (1):
  mmc: sdhci-pci: Try "cd" for card-detect lookup before using NULL

 drivers/mmc/host/sdhci-pci-core.c | 86 +--
 1 file changed, 83 insertions(+), 3 deletions(-)


RE: [patch 8/9] posix-clocks: Remove license boiler plate

2018-11-22 Thread Manfred Rudigier
Acked-by: Manfred Rudigier 

Regards,
Manfred

> -Original Message-
> From: Richard Cochran 
> Sent: Thursday, November 1, 2018 3:12 AM
> To: Thomas Gleixner 
> Cc: LKML ; Cristian Marinescu
> ; Manfred Rudigier
> 
> Subject: Re: [patch 8/9] posix-clocks: Remove license boiler plate
> 
> On Wed, Oct 31, 2018 at 07:21:15PM +0100, Thomas Gleixner wrote:
> > The SPDX identifier defines the license of the file already. No need
> > for the boilerplate.
> >
> > Signed-off-by: Thomas Gleixner 
> > Cc: Richard Cochran 
> > ---
> >
> > @Richard: This file is (C) OMICRON, but I don't have a contact
> > anymore. That Cochran dude is not longer working there :)
> >
> > Do you have a contact? If so, can you please reply to this mail and Cc
> > him/her.
> 
> @Cristian and Manfred:
> 
> We want to replace the license boilerplate with SPDX tags.  The file,
> kernel/time/posix-clock.c, is copyrighted by omicron, and so we need your
> okay.  All that is needed is a reply to this email with an omicron Acked-by 
> tag,
> like this:
> 
> Acked-by: Richard Cochran 
> 
> Thanks,
> Richard
> 
> >
> > ---
> >  kernel/time/posix-clock.c |   14 --
> >  1 file changed, 14 deletions(-)
> >
> > --- a/kernel/time/posix-clock.c
> > +++ b/kernel/time/posix-clock.c
> > @@ -3,20 +3,6 @@
> >   * Support for dynamic clock devices
> >   *
> >   * Copyright (C) 2010 OMICRON electronics GmbH
> > - *
> > - *  This program is free software; you can redistribute it and/or
> > modify
> > - *  it under the terms of the GNU General Public License as published
> > by
> > - *  the Free Software Foundation; either version 2 of the License, or
> > - *  (at your option) any later version.
> > - *
> > - *  This program is distributed in the hope that it will be useful,
> > - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> > - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > - *  GNU General Public License for more details.
> > - *
> > - *  You should have received a copy of the GNU General Public License
> > - *  along with this program; if not, write to the Free Software
> > - *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> >   */
> >  #include 
> >  #include 
> >
> >


[GIT PULL] MMC fixes for v4.20-rc4

2018-11-22 Thread Ulf Hansson
Hi Linus,

Here's a PR with two MMC fixes intended for v4.20-rc4. Details about the
highlights are as usual found in the signed tag.

Please pull this in!

Kind regards
Ulf Hansson


The following changes since commit ccda4af0f4b92f7b4c308d3acc262f4a7e3affad:

  Linux 4.20-rc2 (2018-11-11 17:12:31 -0600)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc.git tags/mmc-v4.20-rc2

for you to fetch changes up to 5305ec6a27b2dc7398a689e661a4a2e951026f09:

  mmc: sdhci-pci: Workaround GLK firmware failing to restore the tuning value 
(2018-11-19 14:11:07 +0100)


MMC host:
 - sdhci-pci: Fixup card detect lookup
 - sdhci-pci: Workaround GLK firmware bug for tuning


Adrian Hunter (1):
  mmc: sdhci-pci: Workaround GLK firmware failing to restore the tuning 
value

Rajat Jain (1):
  mmc: sdhci-pci: Try "cd" for card-detect lookup before using NULL

 drivers/mmc/host/sdhci-pci-core.c | 86 +--
 1 file changed, 83 insertions(+), 3 deletions(-)


RE: [patch 8/9] posix-clocks: Remove license boiler plate

2018-11-22 Thread Manfred Rudigier
Acked-by: Manfred Rudigier 

Regards,
Manfred

> -Original Message-
> From: Richard Cochran 
> Sent: Thursday, November 1, 2018 3:12 AM
> To: Thomas Gleixner 
> Cc: LKML ; Cristian Marinescu
> ; Manfred Rudigier
> 
> Subject: Re: [patch 8/9] posix-clocks: Remove license boiler plate
> 
> On Wed, Oct 31, 2018 at 07:21:15PM +0100, Thomas Gleixner wrote:
> > The SPDX identifier defines the license of the file already. No need
> > for the boilerplate.
> >
> > Signed-off-by: Thomas Gleixner 
> > Cc: Richard Cochran 
> > ---
> >
> > @Richard: This file is (C) OMICRON, but I don't have a contact
> > anymore. That Cochran dude is not longer working there :)
> >
> > Do you have a contact? If so, can you please reply to this mail and Cc
> > him/her.
> 
> @Cristian and Manfred:
> 
> We want to replace the license boilerplate with SPDX tags.  The file,
> kernel/time/posix-clock.c, is copyrighted by omicron, and so we need your
> okay.  All that is needed is a reply to this email with an omicron Acked-by 
> tag,
> like this:
> 
> Acked-by: Richard Cochran 
> 
> Thanks,
> Richard
> 
> >
> > ---
> >  kernel/time/posix-clock.c |   14 --
> >  1 file changed, 14 deletions(-)
> >
> > --- a/kernel/time/posix-clock.c
> > +++ b/kernel/time/posix-clock.c
> > @@ -3,20 +3,6 @@
> >   * Support for dynamic clock devices
> >   *
> >   * Copyright (C) 2010 OMICRON electronics GmbH
> > - *
> > - *  This program is free software; you can redistribute it and/or
> > modify
> > - *  it under the terms of the GNU General Public License as published
> > by
> > - *  the Free Software Foundation; either version 2 of the License, or
> > - *  (at your option) any later version.
> > - *
> > - *  This program is distributed in the hope that it will be useful,
> > - *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> > - *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > - *  GNU General Public License for more details.
> > - *
> > - *  You should have received a copy of the GNU General Public License
> > - *  along with this program; if not, write to the Free Software
> > - *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
> >   */
> >  #include 
> >  #include 
> >
> >


[PATCH V5] can: flexcan: add self wakeup support

2018-11-22 Thread Joakim Zhang
From: Aisheng Dong 

If wakeup is enabled, enter stop mode, else enter disabled mode. Self wake
can only work on stop mode.

Starting from IMX6, the flexcan stop mode control bits is SoC specific,
move it out of IP driver and parse it from devicetree.

Signed-off-by: Aisheng Dong 
Signed-off-by: Joakim Zhang 
---
ChangeLog:
V1->V2:
*add a vendor prefix in property (stop-mode -> fsl,stop-mode).
V2->V3:
*add FLEXCAN_QUIRK_SETUP_STOP_MODE quirk.
*rename function.
*fix system can't be wakeuped during suspend.
V3->V4:
*normalize the code following Aisheng Dong's comments.
V4->V5:
*move enable/disable self wakeup feature into
 enter/exit_stop_mode() function.
---
 drivers/net/can/flexcan.c | 172 --
 1 file changed, 163 insertions(+), 9 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 8e972ef08637..e6dc51d4d1ee 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -19,11 +19,14 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #define DRV_NAME   "flexcan"
 
@@ -131,7 +134,8 @@
(FLEXCAN_ESR_ERR_BUS | FLEXCAN_ESR_ERR_STATE)
 #define FLEXCAN_ESR_ALL_INT \
(FLEXCAN_ESR_TWRN_INT | FLEXCAN_ESR_RWRN_INT | \
-FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT)
+   FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT | \
+   FLEXCAN_ESR_WAK_INT)
 
 /* FLEXCAN interrupt flag register (IFLAG) bits */
 /* Errata ERR005829 step7: Reserve first valid MB */
@@ -190,6 +194,7 @@
 #define FLEXCAN_QUIRK_USE_OFF_TIMESTAMPBIT(5) /* Use timestamp based 
offloading */
 #define FLEXCAN_QUIRK_BROKEN_PERR_STATEBIT(6) /* No interrupt for 
error passive */
 #define FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN   BIT(7) /* default to BE 
register access */
+#define FLEXCAN_QUIRK_SETUP_STOP_MODE  BIT(8) /* Setup stop mode to 
support wakeup */
 
 /* Structure of the message buffer */
 struct flexcan_mb {
@@ -254,6 +259,14 @@ struct flexcan_devtype_data {
u32 quirks; /* quirks needed for different IP cores */
 };
 
+struct flexcan_stop_mode {
+   struct regmap *gpr;
+   u8 req_gpr;
+   u8 req_bit;
+   u8 ack_gpr;
+   u8 ack_bit;
+};
+
 struct flexcan_priv {
struct can_priv can;
struct can_rx_offload offload;
@@ -270,6 +283,7 @@ struct flexcan_priv {
struct clk *clk_per;
const struct flexcan_devtype_data *devtype_data;
struct regulator *reg_xceiver;
+   struct flexcan_stop_mode stm;
 
/* Read and Write APIs */
u32 (*read)(void __iomem *addr);
@@ -293,7 +307,8 @@ static const struct flexcan_devtype_data 
fsl_imx28_devtype_data = {
 
 static const struct flexcan_devtype_data fsl_imx6q_devtype_data = {
.quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS |
-   FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | 
FLEXCAN_QUIRK_BROKEN_PERR_STATE,
+   FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | 
FLEXCAN_QUIRK_BROKEN_PERR_STATE |
+   FLEXCAN_QUIRK_SETUP_STOP_MODE,
 };
 
 static const struct flexcan_devtype_data fsl_vf610_devtype_data = {
@@ -353,6 +368,49 @@ static inline void flexcan_write_le(u32 val, void __iomem 
*addr)
iowrite32(val, addr);
 }
 
+static void flexcan_enable_wakeup_irq(struct flexcan_priv *priv, bool enable)
+{
+   struct flexcan_regs __iomem *regs = priv->regs;
+   u32 reg_mcr;
+
+   reg_mcr = priv->read(>mcr);
+
+   if (enable)
+   reg_mcr |= FLEXCAN_MCR_WAK_MSK;
+   else
+   reg_mcr &= ~FLEXCAN_MCR_WAK_MSK;
+
+   priv->write(reg_mcr, >mcr);
+}
+
+static inline void flexcan_enter_stop_mode(struct flexcan_priv *priv)
+{
+   struct flexcan_regs __iomem *regs = priv->regs;
+   u32 reg_mcr;
+
+   reg_mcr = priv->read(>mcr);
+   reg_mcr |= FLEXCAN_MCR_SLF_WAK;
+   priv->write(reg_mcr, >mcr);
+
+   /* enable stop request */
+   regmap_update_bits(priv->stm.gpr, priv->stm.req_gpr,
+  1 << priv->stm.req_bit, 1 << priv->stm.req_bit);
+}
+
+static inline void flexcan_exit_stop_mode(struct flexcan_priv *priv)
+{
+   struct flexcan_regs __iomem *regs = priv->regs;
+   u32 reg_mcr;
+
+   /* remove stop request */
+   regmap_update_bits(priv->stm.gpr, priv->stm.req_gpr,
+  1 << priv->stm.req_bit, 0);
+
+   reg_mcr = priv->read(>mcr);
+   reg_mcr &= ~FLEXCAN_MCR_SLF_WAK;
+   priv->write(reg_mcr, >mcr);
+}
+
 static inline void flexcan_error_irq_enable(const struct flexcan_priv *priv)
 {
struct flexcan_regs __iomem *regs = priv->regs;
@@ -1244,6 +1302,57 @@ static void unregister_flexcandev(struct net_device *dev)
unregister_candev(dev);
 }
 
+static int flexcan_setup_stop_mode(struct platform_device *pdev)
+{
+   struct net_device *dev = platform_get_drvdata(pdev);
+ 

[PATCH V5] can: flexcan: add self wakeup support

2018-11-22 Thread Joakim Zhang
From: Aisheng Dong 

If wakeup is enabled, enter stop mode, else enter disabled mode. Self wake
can only work on stop mode.

Starting from IMX6, the flexcan stop mode control bits is SoC specific,
move it out of IP driver and parse it from devicetree.

Signed-off-by: Aisheng Dong 
Signed-off-by: Joakim Zhang 
---
ChangeLog:
V1->V2:
*add a vendor prefix in property (stop-mode -> fsl,stop-mode).
V2->V3:
*add FLEXCAN_QUIRK_SETUP_STOP_MODE quirk.
*rename function.
*fix system can't be wakeuped during suspend.
V3->V4:
*normalize the code following Aisheng Dong's comments.
V4->V5:
*move enable/disable self wakeup feature into
 enter/exit_stop_mode() function.
---
 drivers/net/can/flexcan.c | 172 --
 1 file changed, 163 insertions(+), 9 deletions(-)

diff --git a/drivers/net/can/flexcan.c b/drivers/net/can/flexcan.c
index 8e972ef08637..e6dc51d4d1ee 100644
--- a/drivers/net/can/flexcan.c
+++ b/drivers/net/can/flexcan.c
@@ -19,11 +19,14 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #define DRV_NAME   "flexcan"
 
@@ -131,7 +134,8 @@
(FLEXCAN_ESR_ERR_BUS | FLEXCAN_ESR_ERR_STATE)
 #define FLEXCAN_ESR_ALL_INT \
(FLEXCAN_ESR_TWRN_INT | FLEXCAN_ESR_RWRN_INT | \
-FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT)
+   FLEXCAN_ESR_BOFF_INT | FLEXCAN_ESR_ERR_INT | \
+   FLEXCAN_ESR_WAK_INT)
 
 /* FLEXCAN interrupt flag register (IFLAG) bits */
 /* Errata ERR005829 step7: Reserve first valid MB */
@@ -190,6 +194,7 @@
 #define FLEXCAN_QUIRK_USE_OFF_TIMESTAMPBIT(5) /* Use timestamp based 
offloading */
 #define FLEXCAN_QUIRK_BROKEN_PERR_STATEBIT(6) /* No interrupt for 
error passive */
 #define FLEXCAN_QUIRK_DEFAULT_BIG_ENDIAN   BIT(7) /* default to BE 
register access */
+#define FLEXCAN_QUIRK_SETUP_STOP_MODE  BIT(8) /* Setup stop mode to 
support wakeup */
 
 /* Structure of the message buffer */
 struct flexcan_mb {
@@ -254,6 +259,14 @@ struct flexcan_devtype_data {
u32 quirks; /* quirks needed for different IP cores */
 };
 
+struct flexcan_stop_mode {
+   struct regmap *gpr;
+   u8 req_gpr;
+   u8 req_bit;
+   u8 ack_gpr;
+   u8 ack_bit;
+};
+
 struct flexcan_priv {
struct can_priv can;
struct can_rx_offload offload;
@@ -270,6 +283,7 @@ struct flexcan_priv {
struct clk *clk_per;
const struct flexcan_devtype_data *devtype_data;
struct regulator *reg_xceiver;
+   struct flexcan_stop_mode stm;
 
/* Read and Write APIs */
u32 (*read)(void __iomem *addr);
@@ -293,7 +307,8 @@ static const struct flexcan_devtype_data 
fsl_imx28_devtype_data = {
 
 static const struct flexcan_devtype_data fsl_imx6q_devtype_data = {
.quirks = FLEXCAN_QUIRK_DISABLE_RXFG | FLEXCAN_QUIRK_ENABLE_EACEN_RRS |
-   FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | 
FLEXCAN_QUIRK_BROKEN_PERR_STATE,
+   FLEXCAN_QUIRK_USE_OFF_TIMESTAMP | 
FLEXCAN_QUIRK_BROKEN_PERR_STATE |
+   FLEXCAN_QUIRK_SETUP_STOP_MODE,
 };
 
 static const struct flexcan_devtype_data fsl_vf610_devtype_data = {
@@ -353,6 +368,49 @@ static inline void flexcan_write_le(u32 val, void __iomem 
*addr)
iowrite32(val, addr);
 }
 
+static void flexcan_enable_wakeup_irq(struct flexcan_priv *priv, bool enable)
+{
+   struct flexcan_regs __iomem *regs = priv->regs;
+   u32 reg_mcr;
+
+   reg_mcr = priv->read(>mcr);
+
+   if (enable)
+   reg_mcr |= FLEXCAN_MCR_WAK_MSK;
+   else
+   reg_mcr &= ~FLEXCAN_MCR_WAK_MSK;
+
+   priv->write(reg_mcr, >mcr);
+}
+
+static inline void flexcan_enter_stop_mode(struct flexcan_priv *priv)
+{
+   struct flexcan_regs __iomem *regs = priv->regs;
+   u32 reg_mcr;
+
+   reg_mcr = priv->read(>mcr);
+   reg_mcr |= FLEXCAN_MCR_SLF_WAK;
+   priv->write(reg_mcr, >mcr);
+
+   /* enable stop request */
+   regmap_update_bits(priv->stm.gpr, priv->stm.req_gpr,
+  1 << priv->stm.req_bit, 1 << priv->stm.req_bit);
+}
+
+static inline void flexcan_exit_stop_mode(struct flexcan_priv *priv)
+{
+   struct flexcan_regs __iomem *regs = priv->regs;
+   u32 reg_mcr;
+
+   /* remove stop request */
+   regmap_update_bits(priv->stm.gpr, priv->stm.req_gpr,
+  1 << priv->stm.req_bit, 0);
+
+   reg_mcr = priv->read(>mcr);
+   reg_mcr &= ~FLEXCAN_MCR_SLF_WAK;
+   priv->write(reg_mcr, >mcr);
+}
+
 static inline void flexcan_error_irq_enable(const struct flexcan_priv *priv)
 {
struct flexcan_regs __iomem *regs = priv->regs;
@@ -1244,6 +1302,57 @@ static void unregister_flexcandev(struct net_device *dev)
unregister_candev(dev);
 }
 
+static int flexcan_setup_stop_mode(struct platform_device *pdev)
+{
+   struct net_device *dev = platform_get_drvdata(pdev);
+ 

Re: [PATCH 4.9 00/59] 4.9.139-stable review

2018-11-22 Thread Naresh Kamboju
On Thu, 22 Nov 2018 at 00:40, Greg Kroah-Hartman
 wrote:
>
> This is the start of the stable review cycle for the 4.9.139 release.
> There are 59 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Fri Nov 23 18:34:55 UTC 2018.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
> 
> https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.139-rc1.gz
> or in the git tree and branch at:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> linux-4.9.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h

Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.

Summary


kernel: 4.9.139-rc1
git repo: 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.9.y
git commit: 70b13958eeae24843ed944e4f3d4a25a0cdec0dc
git describe: v4.9.138-60-g70b13958eeae
Test details: 
https://qa-reports.linaro.org/lkft/linux-stable-rc-4.9-oe/build/v4.9.138-60-g70b13958eeae

No regressions (compared to build v4.9.138)

No fixes (compared to build v4.9.138)

Ran 21044 total tests in the following environments and test suites.

Environments
--
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- i386
- juno-r2 - arm64
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15 - arm
- x86_64

Test Suites
---
* boot
* install-android-platform-tools-r2600
* kselftest
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-containers-tests
* ltp-cve-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-timers-tests
* ltp-sched-tests
* ltp-open-posix-tests
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none

-- 
Linaro LKFT
https://lkft.linaro.org


Re: [PATCH 4.9 00/59] 4.9.139-stable review

2018-11-22 Thread Naresh Kamboju
On Thu, 22 Nov 2018 at 00:40, Greg Kroah-Hartman
 wrote:
>
> This is the start of the stable review cycle for the 4.9.139 release.
> There are 59 patches in this series, all will be posted as a response
> to this one.  If anyone has any issues with these being applied, please
> let me know.
>
> Responses should be made by Fri Nov 23 18:34:55 UTC 2018.
> Anything received after that time might be too late.
>
> The whole patch series can be found in one patch at:
> 
> https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.9.139-rc1.gz
> or in the git tree and branch at:
> 
> git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> linux-4.9.y
> and the diffstat can be found below.
>
> thanks,
>
> greg k-h

Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.

Summary


kernel: 4.9.139-rc1
git repo: 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.9.y
git commit: 70b13958eeae24843ed944e4f3d4a25a0cdec0dc
git describe: v4.9.138-60-g70b13958eeae
Test details: 
https://qa-reports.linaro.org/lkft/linux-stable-rc-4.9-oe/build/v4.9.138-60-g70b13958eeae

No regressions (compared to build v4.9.138)

No fixes (compared to build v4.9.138)

Ran 21044 total tests in the following environments and test suites.

Environments
--
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- i386
- juno-r2 - arm64
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15 - arm
- x86_64

Test Suites
---
* boot
* install-android-platform-tools-r2600
* kselftest
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-containers-tests
* ltp-cve-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-timers-tests
* ltp-sched-tests
* ltp-open-posix-tests
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none

-- 
Linaro LKFT
https://lkft.linaro.org


Re: [PATCH 4.19 00/42] 4.19.4-stable review

2018-11-22 Thread Greg Kroah-Hartman
On Thu, Nov 22, 2018 at 08:36:12AM -0800, Guenter Roeck wrote:
> On 11/21/18 11:05 AM, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.19.4 release.
> > There are 42 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Fri Nov 23 18:31:31 UTC 2018.
> > Anything received after that time might be too late.
> > 
> 
> Build results:
>   total: 135 pass: 135 fail: 0
> Qemu test results:
>   total: 291 pass: 291 fail: 0
> 
> Details are available at https://kerneltests.org/builders/.

Thanks for testing all of these and letting me know.

greg k-h


Re: [PATCH 4.9 00/59] 4.9.139-stable review

2018-11-22 Thread Greg Kroah-Hartman
On Thu, Nov 22, 2018 at 11:49:55AM -0800, Guenter Roeck wrote:
> On 11/22/18 10:07 AM, Murilo Fossa Vicentini wrote:
> > On 22/11/18 14:33, Guenter Roeck wrote:
> > > drivers/net/ethernet/ibm/ibmvnic.c: In function 'ibmvnic_xmit':
> > > drivers/net/ethernet/ibm/ibmvnic.c:789:40: error: implicit declaration of 
> > > function 'skb_vlan_tag_present'
> > > 
> > > Caused by 5f51bb855fa1 ("ibmvnic: fix accelerated VLAN handling").
> > > Problem is missing include of linux/if_vlan.h, which was added upstream
> > > with commit 6052d5e2a1961b ("ibmvnic: Insert header on VLAN tagged
> > > received frame").
> > > 
> > > I have no idea if the offending patch fixes 6052d5e2a1961b, if both are
> > > independent, if both are needed, or if none is needed.
> > > Copying the authors of both patches.
> > 
> > Both address different parts of the code within the same VLAN 
> > functionality, patch 5f51bb855fa1 (or upstream e84b47941e15) is making a 
> > change on the transmit side, and the patch I sent upstream (6052d5e2a196) 
> > addresses an issue when the system firmware strips the VLAN tag on the 
> > receive side.
> > 
> > In the context of having proper VLAN support for the ibmvnic driver I would 
> > say both are needed, although potentially there are other patches needed 
> > for this functionality to work properly, for example upstream commit 
> > da75e3b6a029 (ibmvnic: Account for VLAN tag in L2 Header descriptor) and 
> > upstream commit 8dff66cc4195 (ibmvnic: Account for VLAN tag in L2 Header 
> > descriptor).
> > 
> 
> Not my call to make, but it seems to me that it might be better to drop
> the patch from 4.9.y and ask people to use a later kernel if they need
> vlan support for the ibmvnic driver.

Thanks all for figuring this out.  I'm just going to drop this patch
from the tree for now.

greg k-h


Re: [PATCH 4.19 00/42] 4.19.4-stable review

2018-11-22 Thread Greg Kroah-Hartman
On Thu, Nov 22, 2018 at 08:36:12AM -0800, Guenter Roeck wrote:
> On 11/21/18 11:05 AM, Greg Kroah-Hartman wrote:
> > This is the start of the stable review cycle for the 4.19.4 release.
> > There are 42 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> > 
> > Responses should be made by Fri Nov 23 18:31:31 UTC 2018.
> > Anything received after that time might be too late.
> > 
> 
> Build results:
>   total: 135 pass: 135 fail: 0
> Qemu test results:
>   total: 291 pass: 291 fail: 0
> 
> Details are available at https://kerneltests.org/builders/.

Thanks for testing all of these and letting me know.

greg k-h


Re: [PATCH 4.9 00/59] 4.9.139-stable review

2018-11-22 Thread Greg Kroah-Hartman
On Thu, Nov 22, 2018 at 11:49:55AM -0800, Guenter Roeck wrote:
> On 11/22/18 10:07 AM, Murilo Fossa Vicentini wrote:
> > On 22/11/18 14:33, Guenter Roeck wrote:
> > > drivers/net/ethernet/ibm/ibmvnic.c: In function 'ibmvnic_xmit':
> > > drivers/net/ethernet/ibm/ibmvnic.c:789:40: error: implicit declaration of 
> > > function 'skb_vlan_tag_present'
> > > 
> > > Caused by 5f51bb855fa1 ("ibmvnic: fix accelerated VLAN handling").
> > > Problem is missing include of linux/if_vlan.h, which was added upstream
> > > with commit 6052d5e2a1961b ("ibmvnic: Insert header on VLAN tagged
> > > received frame").
> > > 
> > > I have no idea if the offending patch fixes 6052d5e2a1961b, if both are
> > > independent, if both are needed, or if none is needed.
> > > Copying the authors of both patches.
> > 
> > Both address different parts of the code within the same VLAN 
> > functionality, patch 5f51bb855fa1 (or upstream e84b47941e15) is making a 
> > change on the transmit side, and the patch I sent upstream (6052d5e2a196) 
> > addresses an issue when the system firmware strips the VLAN tag on the 
> > receive side.
> > 
> > In the context of having proper VLAN support for the ibmvnic driver I would 
> > say both are needed, although potentially there are other patches needed 
> > for this functionality to work properly, for example upstream commit 
> > da75e3b6a029 (ibmvnic: Account for VLAN tag in L2 Header descriptor) and 
> > upstream commit 8dff66cc4195 (ibmvnic: Account for VLAN tag in L2 Header 
> > descriptor).
> > 
> 
> Not my call to make, but it seems to me that it might be better to drop
> the patch from 4.9.y and ask people to use a later kernel if they need
> vlan support for the ibmvnic driver.

Thanks all for figuring this out.  I'm just going to drop this patch
from the tree for now.

greg k-h


[PATCH 1/2] i3c: fix an error code in i3c_master_add_i3c_dev_locked()

2018-11-22 Thread Dan Carpenter
We should return "ret" as-is.  The "newdev" variable is a valid pointer.

Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure")
Signed-off-by: Dan Carpenter 
---
 drivers/i3c/master.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 0ea7bb045fad..bda4b9613e53 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -1823,10 +1823,8 @@ int i3c_master_add_i3c_dev_locked(struct 
i3c_master_controller *master,
return PTR_ERR(newdev);
 
ret = i3c_master_attach_i3c_dev(master, newdev);
-   if (ret) {
-   ret = PTR_ERR(newdev);
+   if (ret)
goto err_free_dev;
-   }
 
ret = i3c_master_retrieve_dev_info(newdev);
if (ret)
-- 
2.11.0



[PATCH 2/2] ic3: master: off by one in mode_show()

2018-11-22 Thread Dan Carpenter
This should be >= ARRAY_SIZE() to avoid reading one element beyond the
end of the array.

Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure")
Signed-off-by: Dan Carpenter 
---
 drivers/i3c/master.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index bda4b9613e53..c39f89d2deba 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -475,7 +475,7 @@ static ssize_t mode_show(struct device *dev,
 
i3c_bus_normaluse_lock(i3cbus);
if (i3cbus->mode < 0 ||
-   i3cbus->mode > ARRAY_SIZE(i3c_bus_mode_strings) ||
+   i3cbus->mode >= ARRAY_SIZE(i3c_bus_mode_strings) ||
!i3c_bus_mode_strings[i3cbus->mode])
ret = sprintf(buf, "unknown\n");
else
-- 
2.11.0



[PATCH 1/2] i3c: fix an error code in i3c_master_add_i3c_dev_locked()

2018-11-22 Thread Dan Carpenter
We should return "ret" as-is.  The "newdev" variable is a valid pointer.

Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure")
Signed-off-by: Dan Carpenter 
---
 drivers/i3c/master.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index 0ea7bb045fad..bda4b9613e53 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -1823,10 +1823,8 @@ int i3c_master_add_i3c_dev_locked(struct 
i3c_master_controller *master,
return PTR_ERR(newdev);
 
ret = i3c_master_attach_i3c_dev(master, newdev);
-   if (ret) {
-   ret = PTR_ERR(newdev);
+   if (ret)
goto err_free_dev;
-   }
 
ret = i3c_master_retrieve_dev_info(newdev);
if (ret)
-- 
2.11.0



[PATCH 2/2] ic3: master: off by one in mode_show()

2018-11-22 Thread Dan Carpenter
This should be >= ARRAY_SIZE() to avoid reading one element beyond the
end of the array.

Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure")
Signed-off-by: Dan Carpenter 
---
 drivers/i3c/master.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
index bda4b9613e53..c39f89d2deba 100644
--- a/drivers/i3c/master.c
+++ b/drivers/i3c/master.c
@@ -475,7 +475,7 @@ static ssize_t mode_show(struct device *dev,
 
i3c_bus_normaluse_lock(i3cbus);
if (i3cbus->mode < 0 ||
-   i3cbus->mode > ARRAY_SIZE(i3c_bus_mode_strings) ||
+   i3cbus->mode >= ARRAY_SIZE(i3c_bus_mode_strings) ||
!i3c_bus_mode_strings[i3cbus->mode])
ret = sprintf(buf, "unknown\n");
else
-- 
2.11.0



Re: [PATCH 4.14 00/21] 4.14.83-stable review

2018-11-22 Thread Greg Kroah-Hartman
On Fri, Nov 23, 2018 at 09:52:07AM +0530, Naresh Kamboju wrote:
> On Thu, 22 Nov 2018 at 00:39, Greg Kroah-Hartman
>  wrote:
> >
> > This is the start of the stable review cycle for the 4.14.83 release.
> > There are 21 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> >
> > Responses should be made by Fri Nov 23 18:34:13 UTC 2018.
> > Anything received after that time might be too late.
> >
> > The whole patch series can be found in one patch at:
> > 
> > https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.83-rc1.gz
> > or in the git tree and branch at:
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> > linux-4.14.y
> > and the diffstat can be found below.
> >
> > thanks,
> >
> > greg k-h
> 
> Results from Linaro’s test farm.
> No regressions on arm64, arm, x86_64, and i386.

Thanks for testing this and letting me know.

greg k-h


Re: [PATCH 4.14 00/21] 4.14.83-stable review

2018-11-22 Thread Greg Kroah-Hartman
On Fri, Nov 23, 2018 at 09:52:07AM +0530, Naresh Kamboju wrote:
> On Thu, 22 Nov 2018 at 00:39, Greg Kroah-Hartman
>  wrote:
> >
> > This is the start of the stable review cycle for the 4.14.83 release.
> > There are 21 patches in this series, all will be posted as a response
> > to this one.  If anyone has any issues with these being applied, please
> > let me know.
> >
> > Responses should be made by Fri Nov 23 18:34:13 UTC 2018.
> > Anything received after that time might be too late.
> >
> > The whole patch series can be found in one patch at:
> > 
> > https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.83-rc1.gz
> > or in the git tree and branch at:
> > 
> > git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git 
> > linux-4.14.y
> > and the diffstat can be found below.
> >
> > thanks,
> >
> > greg k-h
> 
> Results from Linaro’s test farm.
> No regressions on arm64, arm, x86_64, and i386.

Thanks for testing this and letting me know.

greg k-h


Re: [PATCH 0/7] ACPI HMAT memory sysfs representation

2018-11-22 Thread Anshuman Khandual



On 11/22/2018 11:38 PM, Dan Williams wrote:
> On Thu, Nov 22, 2018 at 3:52 AM Anshuman Khandual
>  wrote:
>>
>>
>>
>> On 11/19/2018 11:07 PM, Dave Hansen wrote:
>>> On 11/18/18 9:44 PM, Anshuman Khandual wrote:
 IIUC NUMA re-work in principle involves these functional changes

 1. Enumerating compute and memory nodes in heterogeneous environment 
 (short/medium term)
>>>
>>> This patch set _does_ that, though.
>>>
 2. Enumerating memory node attributes as seen from the compute nodes 
 (short/medium term)
>>>
>>> It does that as well (a subset at least).
>>>
>>> It sounds like the subset that's being exposed is insufficient for yo
>>> We did that because we think doing anything but a subset in sysfs will
>>> just blow up sysfs:  MAX_NUMNODES is as high as 1024, so if we have 4
>>> attributes, that's at _least_ 1024*1024*4 files if we expose *all*
>>> combinations.
>> Each permutation need not be a separate file inside all possible NODE X
>> (/sys/devices/system/node/nodeX) directories. It can be a top level file
>> enumerating various attribute values for a given (X, Y) node pair based
>> on an offset something like /proc/pid/pagemap.
>>
>>>
>>> Do we agree that sysfs is unsuitable for exposing attributes in this manner?
>>>
>>
>> Yes, for individual files. But this can be worked around with an offset
>> based access from a top level global attributes file as mentioned above.
>> Is there any particular advantage of using individual files for each
>> given attribute ? I was wondering that a single unsigned long (u64) will
>> be able to pack 8 different attributes where each individual attribute
>> values can be abstracted out in 8 bits.
> 
> sysfs has a 4K limit, and in general I don't think there is much
> incremental value to go describe the entirety of the system from sysfs
> or anywhere else in the kernel for that matter. It's simply too much> 
> information to reasonably consume. Instead the kernel can describe the

I agree that it may be some amount of information to parse but is crucial
for any task on a heterogeneous system to evaluate (probably re-evaluate
if the task moves around) its memory and CPU binding at runtime to make
sure it has got the right one.

> coarse boundaries and some semblance of "best" access initiator for a
> given target. That should cover the "80%" case of what applications

The current proposal just assumes that the best one is the nearest one.
This may be true for bandwidth and latency but may not be true for some
other properties. This assumptions should not be there while defining
new ABI.

> want to discover, for the other "20%" we likely need some userspace
> library that can go parse these platform specific information sources
> and supplement the kernel view. I also think a simpler kernel starting
> point gives us room to go pull in more commonly used attributes if it
> turns out they are useful, and avoid going down the path of exporting
> attributes that have questionable value in practice.
> 

Applications can just query platform information right now and just use
them for mbind() without requiring this new interface. We are not even
changing any core MM yet. So if it's just about identifying the node's
memory properties it can be scanned from platform itself. But I agree
we would like the kernel to start adding interfaces for multi attribute
memory but all I am saying is that it has to be comprehensive. Some of
the attributes have more usefulness now and some have less but the new
ABI interface has to accommodate exporting all of these.


Re: [PATCH 0/7] ACPI HMAT memory sysfs representation

2018-11-22 Thread Anshuman Khandual



On 11/22/2018 11:38 PM, Dan Williams wrote:
> On Thu, Nov 22, 2018 at 3:52 AM Anshuman Khandual
>  wrote:
>>
>>
>>
>> On 11/19/2018 11:07 PM, Dave Hansen wrote:
>>> On 11/18/18 9:44 PM, Anshuman Khandual wrote:
 IIUC NUMA re-work in principle involves these functional changes

 1. Enumerating compute and memory nodes in heterogeneous environment 
 (short/medium term)
>>>
>>> This patch set _does_ that, though.
>>>
 2. Enumerating memory node attributes as seen from the compute nodes 
 (short/medium term)
>>>
>>> It does that as well (a subset at least).
>>>
>>> It sounds like the subset that's being exposed is insufficient for yo
>>> We did that because we think doing anything but a subset in sysfs will
>>> just blow up sysfs:  MAX_NUMNODES is as high as 1024, so if we have 4
>>> attributes, that's at _least_ 1024*1024*4 files if we expose *all*
>>> combinations.
>> Each permutation need not be a separate file inside all possible NODE X
>> (/sys/devices/system/node/nodeX) directories. It can be a top level file
>> enumerating various attribute values for a given (X, Y) node pair based
>> on an offset something like /proc/pid/pagemap.
>>
>>>
>>> Do we agree that sysfs is unsuitable for exposing attributes in this manner?
>>>
>>
>> Yes, for individual files. But this can be worked around with an offset
>> based access from a top level global attributes file as mentioned above.
>> Is there any particular advantage of using individual files for each
>> given attribute ? I was wondering that a single unsigned long (u64) will
>> be able to pack 8 different attributes where each individual attribute
>> values can be abstracted out in 8 bits.
> 
> sysfs has a 4K limit, and in general I don't think there is much
> incremental value to go describe the entirety of the system from sysfs
> or anywhere else in the kernel for that matter. It's simply too much> 
> information to reasonably consume. Instead the kernel can describe the

I agree that it may be some amount of information to parse but is crucial
for any task on a heterogeneous system to evaluate (probably re-evaluate
if the task moves around) its memory and CPU binding at runtime to make
sure it has got the right one.

> coarse boundaries and some semblance of "best" access initiator for a
> given target. That should cover the "80%" case of what applications

The current proposal just assumes that the best one is the nearest one.
This may be true for bandwidth and latency but may not be true for some
other properties. This assumptions should not be there while defining
new ABI.

> want to discover, for the other "20%" we likely need some userspace
> library that can go parse these platform specific information sources
> and supplement the kernel view. I also think a simpler kernel starting
> point gives us room to go pull in more commonly used attributes if it
> turns out they are useful, and avoid going down the path of exporting
> attributes that have questionable value in practice.
> 

Applications can just query platform information right now and just use
them for mbind() without requiring this new interface. We are not even
changing any core MM yet. So if it's just about identifying the node's
memory properties it can be scanned from platform itself. But I agree
we would like the kernel to start adding interfaces for multi attribute
memory but all I am saying is that it has to be comprehensive. Some of
the attributes have more usefulness now and some have less but the new
ABI interface has to accommodate exporting all of these.


[tip:x86/cleanups] x86/process: Avoid unnecessary NULL check in get_wchan()

2018-11-22 Thread tip-bot for Yafang Shao
Commit-ID:  6e662ae7bce6db602f79e57791f5fb887fb7d371
Gitweb: https://git.kernel.org/tip/6e662ae7bce6db602f79e57791f5fb887fb7d371
Author: Yafang Shao 
AuthorDate: Wed, 21 Nov 2018 19:12:14 +0800
Committer:  Ingo Molnar 
CommitDate: Fri, 23 Nov 2018 07:58:23 +0100

x86/process: Avoid unnecessary NULL check in get_wchan()

Task 'p' is always guaranteed to be non-NULL, because the only call
sites are in fs/proc/ which all guarantee a non-NULL task pointer.

[ mingo: Improved the changelog. ]
Signed-off-by: Yafang Shao 
Cc: Andy Lutomirski 
Cc: Borislav Petkov 
Cc: Brian Gerst 
Cc: Denys Vlasenko 
Cc: H. Peter Anvin 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Link: 
http://lkml.kernel.org/r/1542798734-12532-1-git-send-email-laoar.s...@gmail.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/kernel/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index c93fcfdf1673..3c3ee8982577 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -730,7 +730,7 @@ unsigned long get_wchan(struct task_struct *p)
unsigned long start, bottom, top, sp, fp, ip, ret = 0;
int count = 0;
 
-   if (!p || p == current || p->state == TASK_RUNNING)
+   if (p == current || p->state == TASK_RUNNING)
return 0;
 
if (!try_get_task_stack(p))


[tip:x86/cleanups] x86/process: Avoid unnecessary NULL check in get_wchan()

2018-11-22 Thread tip-bot for Yafang Shao
Commit-ID:  6e662ae7bce6db602f79e57791f5fb887fb7d371
Gitweb: https://git.kernel.org/tip/6e662ae7bce6db602f79e57791f5fb887fb7d371
Author: Yafang Shao 
AuthorDate: Wed, 21 Nov 2018 19:12:14 +0800
Committer:  Ingo Molnar 
CommitDate: Fri, 23 Nov 2018 07:58:23 +0100

x86/process: Avoid unnecessary NULL check in get_wchan()

Task 'p' is always guaranteed to be non-NULL, because the only call
sites are in fs/proc/ which all guarantee a non-NULL task pointer.

[ mingo: Improved the changelog. ]
Signed-off-by: Yafang Shao 
Cc: Andy Lutomirski 
Cc: Borislav Petkov 
Cc: Brian Gerst 
Cc: Denys Vlasenko 
Cc: H. Peter Anvin 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Link: 
http://lkml.kernel.org/r/1542798734-12532-1-git-send-email-laoar.s...@gmail.com
Signed-off-by: Ingo Molnar 
---
 arch/x86/kernel/process.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index c93fcfdf1673..3c3ee8982577 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -730,7 +730,7 @@ unsigned long get_wchan(struct task_struct *p)
unsigned long start, bottom, top, sp, fp, ip, ret = 0;
int count = 0;
 
-   if (!p || p == current || p->state == TASK_RUNNING)
+   if (p == current || p->state == TASK_RUNNING)
return 0;
 
if (!try_get_task_stack(p))


[tip:x86/cleanups] x86/headers: Fix -Wmissing-prototypes warning

2018-11-22 Thread tip-bot for Yi Wang
Commit-ID:  89f579ce99f7e028e81885d3965f973c0f787611
Gitweb: https://git.kernel.org/tip/89f579ce99f7e028e81885d3965f973c0f787611
Author: Yi Wang 
AuthorDate: Thu, 22 Nov 2018 10:04:09 +0800
Committer:  Ingo Molnar 
CommitDate: Fri, 23 Nov 2018 07:59:59 +0100

x86/headers: Fix -Wmissing-prototypes warning

When building the kernel with W=1 we get a lot of -Wmissing-prototypes
warnings, which are trivial in nature and easy to fix - and which may
mask some real future bugs if the prototypes get out of sync with
the function definition.

This patch fixes most of -Wmissing-prototypes warnings which
are in the root directory of arch/x86/kernel, not including
the subdirectories.

These are the warnings fixed in this patch:

  arch/x86/kernel/signal.c:865:17: warning: no previous prototype for 
‘sys32_x32_rt_sigreturn’ [-Wmissing-prototypes]
  arch/x86/kernel/signal_compat.c:164:6: warning: no previous prototype for 
‘sigaction_compat_abi’ [-Wmissing-prototypes]
  arch/x86/kernel/traps.c:625:46: warning: no previous prototype for 
‘sync_regs’ [-Wmissing-prototypes]
  arch/x86/kernel/traps.c:640:24: warning: no previous prototype for 
‘fixup_bad_iret’ [-Wmissing-prototypes]
  arch/x86/kernel/traps.c:929:13: warning: no previous prototype for 
‘trap_init’ [-Wmissing-prototypes]
  arch/x86/kernel/irq.c:270:28: warning: no previous prototype for 
‘smp_x86_platform_ipi’ [-Wmissing-prototypes]
  arch/x86/kernel/irq.c:301:16: warning: no previous prototype for 
‘smp_kvm_posted_intr_ipi’ [-Wmissing-prototypes]
  arch/x86/kernel/irq.c:314:16: warning: no previous prototype for 
‘smp_kvm_posted_intr_wakeup_ipi’ [-Wmissing-prototypes]
  arch/x86/kernel/irq.c:328:16: warning: no previous prototype for 
‘smp_kvm_posted_intr_nested_ipi’ [-Wmissing-prototypes]
  arch/x86/kernel/irq_work.c:16:28: warning: no previous prototype for 
‘smp_irq_work_interrupt’ [-Wmissing-prototypes]
  arch/x86/kernel/irqinit.c:79:13: warning: no previous prototype for 
‘init_IRQ’ [-Wmissing-prototypes]
  arch/x86/kernel/quirks.c:672:13: warning: no previous prototype for 
‘early_platform_quirks’ [-Wmissing-prototypes]
  arch/x86/kernel/tsc.c:1499:15: warning: no previous prototype for 
‘calibrate_delay_is_known’ [-Wmissing-prototypes]
  arch/x86/kernel/process.c:653:13: warning: no previous prototype for 
‘arch_post_acpi_subsys_init’ [-Wmissing-prototypes]
  arch/x86/kernel/process.c:717:15: warning: no previous prototype for 
‘arch_randomize_brk’ [-Wmissing-prototypes]
  arch/x86/kernel/process.c:784:6: warning: no previous prototype for 
‘do_arch_prctl_common’ [-Wmissing-prototypes]
  arch/x86/kernel/reboot.c:869:6: warning: no previous prototype for 
‘nmi_panic_self_stop’ [-Wmissing-prototypes]
  arch/x86/kernel/smp.c:176:27: warning: no previous prototype for 
‘smp_reboot_interrupt’ [-Wmissing-prototypes]
  arch/x86/kernel/smp.c:260:28: warning: no previous prototype for 
‘smp_reschedule_interrupt’ [-Wmissing-prototypes]
  arch/x86/kernel/smp.c:281:28: warning: no previous prototype for 
‘smp_call_function_interrupt’ [-Wmissing-prototypes]
  arch/x86/kernel/smp.c:291:28: warning: no previous prototype for 
‘smp_call_function_single_interrupt’ [-Wmissing-prototypes]
  arch/x86/kernel/ftrace.c:840:6: warning: no previous prototype for 
‘arch_ftrace_update_trampoline’ [-Wmissing-prototypes]
  arch/x86/kernel/ftrace.c:934:7: warning: no previous prototype for 
‘arch_ftrace_trampoline_func’ [-Wmissing-prototypes]
  arch/x86/kernel/ftrace.c:946:6: warning: no previous prototype for 
‘arch_ftrace_trampoline_free’ [-Wmissing-prototypes]
  arch/x86/kernel/crash.c:114:6: warning: no previous prototype for 
‘crash_smp_send_stop’ [-Wmissing-prototypes]
  arch/x86/kernel/crash.c:351:5: warning: no previous prototype for 
‘crash_setup_memmap_entries’ [-Wmissing-prototypes]
  arch/x86/kernel/crash.c:424:5: warning: no previous prototype for 
‘crash_load_segments’ [-Wmissing-prototypes]
  arch/x86/kernel/machine_kexec_64.c:372:7: warning: no previous prototype for 
‘arch_kexec_kernel_image_load’ [-Wmissing-prototypes]
  arch/x86/kernel/paravirt-spinlocks.c:12:16: warning: no previous prototype 
for ‘__native_queued_spin_unlock’ [-Wmissing-prototypes]
  arch/x86/kernel/paravirt-spinlocks.c:18:6: warning: no previous prototype for 
‘pv_is_native_spin_unlock’ [-Wmissing-prototypes]
  arch/x86/kernel/paravirt-spinlocks.c:24:16: warning: no previous prototype 
for ‘__native_vcpu_is_preempted’ [-Wmissing-prototypes]
  arch/x86/kernel/paravirt-spinlocks.c:30:6: warning: no previous prototype for 
‘pv_is_native_vcpu_is_preempted’ [-Wmissing-prototypes]
  arch/x86/kernel/kvm.c:258:1: warning: no previous prototype for 
‘do_async_page_fault’ [-Wmissing-prototypes]
  arch/x86/kernel/jailhouse.c:200:6: warning: no previous prototype for 
‘jailhouse_paravirt’ [-Wmissing-prototypes]
  arch/x86/kernel/check.c:91:13: warning: no previous prototype for 
‘setup_bios_corruption_check’ [-Wmissing-prototypes]
  arch/x86/kernel/check.c:139:6: warning: no previous prototype 

Re: [v5, PATCH 1/2] net:stmmac: dwmac-mediatek: add support for mt2712

2018-11-22 Thread Sean Wang
< ... >

> > > +   /* select phy interface in top control domain */
> > > +   switch (plat->phy_mode) {
> > > +   case PHY_INTERFACE_MODE_MII:
> > > +   intf_val |= PHY_INTF_MII_GMII;
> > > +   break;
> > > +   case PHY_INTERFACE_MODE_RMII:
> > > +   intf_val |= PHY_INTF_RMII;
> > > +   intf_val |= rmii_rxc;
> > how about putting into one line such as intf_val |= (PHY_INTF_RMII | 
> > rmii_rxc) ?
> >
> ok, will change in next version.
> > > +   break;
> > > +   case PHY_INTERFACE_MODE_RGMII:
> > > +   case PHY_INTERFACE_MODE_RGMII_TXID:
> > > +   case PHY_INTERFACE_MODE_RGMII_RXID:
> > > +   case PHY_INTERFACE_MODE_RGMII_ID:
> > > +   intf_val |= PHY_INTF_RGMII;
> > > +   break;
> > > +   default:
> > > +   dev_err(plat->dev, "phy interface not supported\n");
> > > +   return -EINVAL;
> > > +   }
> > > +
> > > +   regmap_write(plat->peri_regmap, PERI_ETH_PHY_INTF_SEL, intf_val);
> > > +
> > > +   return 0;
> > > +}
> > > +
> > > +static int mt2712_set_delay(struct mediatek_dwmac_plat_data *plat)
> > > +{
> > > +   struct mac_delay_struct *mac_delay = >mac_delay;
> > > +   u32 delay_val = 0;
> > > +   u32 fine_val = 0;
> > The same type declaration can be put into the one line
> >
> Got it.
> > > +
> > > +   switch (plat->phy_mode) {
> >
> > There exists some room for code optimization in the switch statement
> > such as PHY_INTERFACE_MODE_MII and PHY_INTERFACE_MODE_RGMII both are
> > almost the same and even the configuration for the other PHY modes can
> > reuse their partial setup. It appears to be better using a common way
> > to set up various PHY modes.
> >
> I'll try define a function to handle it.
> And how about like this:
> static u32 delay_setting(u32 delay, bool inv, u32 en_bit, u32
> clk_shift, u32 clk_mask, u32 inv_bit) {
> u32 value = 0
>
> value |= delay ? en_bit : 0;
> value |= (delay << clk_shift) & clk_mask;
> value |= inv ? inv_bit : 0;
> }
>
> case PHY_INTERFACE_MODE_MII:
> delay_value |= delay_setting(mac_delay->tx_delay,
>  mac_delay->tx_inv,
>  PHY_DLY_TXC_ENABLE,
>  PHY_DLY_TXC_SHIFT,
>  PHY_DLY_TXC_STAGES,
>  PHY_DLY_TXC_INV);

We can reuse FIELD_PREP defined in include/linux/bitfield.h to make up
of the value instead of creating your own function delay_setting here,
 and also PHY_DLY_TXC_SHIFT macro can be trimmed while you're using
FIED_PREP

> delay_value |= delay_setting(mac_delay->rx_delay,
>  mac_delay->rx_inv,
>  PHY_DLY_RXC_ENABLE,
>  PHY_DLY_RXC_SHIFT,
>  PHY_DLY_RXC_STAGES,
>  PHY_DLY_RXC_INV);
>
> case PHY_INTERFACE_MODE_RMII:
> if (plat->rmii_rxc) {
>  delay_value |= delay_setting(mac_delay->rx_delay,
>  mac_delay->rx_inv,
>  PHY_DLY_RXC_ENABLE,
>  PHY_DLY_RXC_SHIFT,
>  PHY_DLY_RXC_STAGES,
>  PHY_DLY_RXC_INV);
> fine_val |= mac_delay->tx_inv ?
>ETH_RMII_DLY_TX_INV : 0;
> } else {
>  delay_value |= delay_setting(mac_delay->rx_delay,
>  mac_delay->rx_inv,

shoudn't the parametors be mac_delay->tx_delay and mac_delay->tx_inv?

>  PHY_DLY_TXC_ENABLE,
>  PHY_DLY_TXC_SHIFT,
>  PHY_DLY_TXC_STAGES,
>  PHY_DLY_TXC_INV);
> fine_val |= mac_delay->tx_inv ?
>ETH_RMII_DLY_TX_INV : 0;

if (plat->tx_inv)
  fine_val = ETH_RMII_DLY_TX_INV;
the default fine_val is zero so zero assignement can be trimmed when
!plat-> tx_inv

> }
> case PHY_INTERFACE_MODE_RGMII:
>   fine_val = plat->fine_tune ?
>   (ETH_FINE_DLY_GTXC | ETH_FINE_DLY_RXC) : 0;

if (plat->fine_tune)
  fine_val = ETH_FINE_DLY_GTXC | ETH_FINE_DLY_RXC;
the default fine_val is zero so zero assignement can be trimmed when
!plat->fine_tune

>   delay_value |= 

[tip:x86/cleanups] x86/headers: Fix -Wmissing-prototypes warning

2018-11-22 Thread tip-bot for Yi Wang
Commit-ID:  89f579ce99f7e028e81885d3965f973c0f787611
Gitweb: https://git.kernel.org/tip/89f579ce99f7e028e81885d3965f973c0f787611
Author: Yi Wang 
AuthorDate: Thu, 22 Nov 2018 10:04:09 +0800
Committer:  Ingo Molnar 
CommitDate: Fri, 23 Nov 2018 07:59:59 +0100

x86/headers: Fix -Wmissing-prototypes warning

When building the kernel with W=1 we get a lot of -Wmissing-prototypes
warnings, which are trivial in nature and easy to fix - and which may
mask some real future bugs if the prototypes get out of sync with
the function definition.

This patch fixes most of -Wmissing-prototypes warnings which
are in the root directory of arch/x86/kernel, not including
the subdirectories.

These are the warnings fixed in this patch:

  arch/x86/kernel/signal.c:865:17: warning: no previous prototype for 
‘sys32_x32_rt_sigreturn’ [-Wmissing-prototypes]
  arch/x86/kernel/signal_compat.c:164:6: warning: no previous prototype for 
‘sigaction_compat_abi’ [-Wmissing-prototypes]
  arch/x86/kernel/traps.c:625:46: warning: no previous prototype for 
‘sync_regs’ [-Wmissing-prototypes]
  arch/x86/kernel/traps.c:640:24: warning: no previous prototype for 
‘fixup_bad_iret’ [-Wmissing-prototypes]
  arch/x86/kernel/traps.c:929:13: warning: no previous prototype for 
‘trap_init’ [-Wmissing-prototypes]
  arch/x86/kernel/irq.c:270:28: warning: no previous prototype for 
‘smp_x86_platform_ipi’ [-Wmissing-prototypes]
  arch/x86/kernel/irq.c:301:16: warning: no previous prototype for 
‘smp_kvm_posted_intr_ipi’ [-Wmissing-prototypes]
  arch/x86/kernel/irq.c:314:16: warning: no previous prototype for 
‘smp_kvm_posted_intr_wakeup_ipi’ [-Wmissing-prototypes]
  arch/x86/kernel/irq.c:328:16: warning: no previous prototype for 
‘smp_kvm_posted_intr_nested_ipi’ [-Wmissing-prototypes]
  arch/x86/kernel/irq_work.c:16:28: warning: no previous prototype for 
‘smp_irq_work_interrupt’ [-Wmissing-prototypes]
  arch/x86/kernel/irqinit.c:79:13: warning: no previous prototype for 
‘init_IRQ’ [-Wmissing-prototypes]
  arch/x86/kernel/quirks.c:672:13: warning: no previous prototype for 
‘early_platform_quirks’ [-Wmissing-prototypes]
  arch/x86/kernel/tsc.c:1499:15: warning: no previous prototype for 
‘calibrate_delay_is_known’ [-Wmissing-prototypes]
  arch/x86/kernel/process.c:653:13: warning: no previous prototype for 
‘arch_post_acpi_subsys_init’ [-Wmissing-prototypes]
  arch/x86/kernel/process.c:717:15: warning: no previous prototype for 
‘arch_randomize_brk’ [-Wmissing-prototypes]
  arch/x86/kernel/process.c:784:6: warning: no previous prototype for 
‘do_arch_prctl_common’ [-Wmissing-prototypes]
  arch/x86/kernel/reboot.c:869:6: warning: no previous prototype for 
‘nmi_panic_self_stop’ [-Wmissing-prototypes]
  arch/x86/kernel/smp.c:176:27: warning: no previous prototype for 
‘smp_reboot_interrupt’ [-Wmissing-prototypes]
  arch/x86/kernel/smp.c:260:28: warning: no previous prototype for 
‘smp_reschedule_interrupt’ [-Wmissing-prototypes]
  arch/x86/kernel/smp.c:281:28: warning: no previous prototype for 
‘smp_call_function_interrupt’ [-Wmissing-prototypes]
  arch/x86/kernel/smp.c:291:28: warning: no previous prototype for 
‘smp_call_function_single_interrupt’ [-Wmissing-prototypes]
  arch/x86/kernel/ftrace.c:840:6: warning: no previous prototype for 
‘arch_ftrace_update_trampoline’ [-Wmissing-prototypes]
  arch/x86/kernel/ftrace.c:934:7: warning: no previous prototype for 
‘arch_ftrace_trampoline_func’ [-Wmissing-prototypes]
  arch/x86/kernel/ftrace.c:946:6: warning: no previous prototype for 
‘arch_ftrace_trampoline_free’ [-Wmissing-prototypes]
  arch/x86/kernel/crash.c:114:6: warning: no previous prototype for 
‘crash_smp_send_stop’ [-Wmissing-prototypes]
  arch/x86/kernel/crash.c:351:5: warning: no previous prototype for 
‘crash_setup_memmap_entries’ [-Wmissing-prototypes]
  arch/x86/kernel/crash.c:424:5: warning: no previous prototype for 
‘crash_load_segments’ [-Wmissing-prototypes]
  arch/x86/kernel/machine_kexec_64.c:372:7: warning: no previous prototype for 
‘arch_kexec_kernel_image_load’ [-Wmissing-prototypes]
  arch/x86/kernel/paravirt-spinlocks.c:12:16: warning: no previous prototype 
for ‘__native_queued_spin_unlock’ [-Wmissing-prototypes]
  arch/x86/kernel/paravirt-spinlocks.c:18:6: warning: no previous prototype for 
‘pv_is_native_spin_unlock’ [-Wmissing-prototypes]
  arch/x86/kernel/paravirt-spinlocks.c:24:16: warning: no previous prototype 
for ‘__native_vcpu_is_preempted’ [-Wmissing-prototypes]
  arch/x86/kernel/paravirt-spinlocks.c:30:6: warning: no previous prototype for 
‘pv_is_native_vcpu_is_preempted’ [-Wmissing-prototypes]
  arch/x86/kernel/kvm.c:258:1: warning: no previous prototype for 
‘do_async_page_fault’ [-Wmissing-prototypes]
  arch/x86/kernel/jailhouse.c:200:6: warning: no previous prototype for 
‘jailhouse_paravirt’ [-Wmissing-prototypes]
  arch/x86/kernel/check.c:91:13: warning: no previous prototype for 
‘setup_bios_corruption_check’ [-Wmissing-prototypes]
  arch/x86/kernel/check.c:139:6: warning: no previous prototype 

Re: [v5, PATCH 1/2] net:stmmac: dwmac-mediatek: add support for mt2712

2018-11-22 Thread Sean Wang
< ... >

> > > +   /* select phy interface in top control domain */
> > > +   switch (plat->phy_mode) {
> > > +   case PHY_INTERFACE_MODE_MII:
> > > +   intf_val |= PHY_INTF_MII_GMII;
> > > +   break;
> > > +   case PHY_INTERFACE_MODE_RMII:
> > > +   intf_val |= PHY_INTF_RMII;
> > > +   intf_val |= rmii_rxc;
> > how about putting into one line such as intf_val |= (PHY_INTF_RMII | 
> > rmii_rxc) ?
> >
> ok, will change in next version.
> > > +   break;
> > > +   case PHY_INTERFACE_MODE_RGMII:
> > > +   case PHY_INTERFACE_MODE_RGMII_TXID:
> > > +   case PHY_INTERFACE_MODE_RGMII_RXID:
> > > +   case PHY_INTERFACE_MODE_RGMII_ID:
> > > +   intf_val |= PHY_INTF_RGMII;
> > > +   break;
> > > +   default:
> > > +   dev_err(plat->dev, "phy interface not supported\n");
> > > +   return -EINVAL;
> > > +   }
> > > +
> > > +   regmap_write(plat->peri_regmap, PERI_ETH_PHY_INTF_SEL, intf_val);
> > > +
> > > +   return 0;
> > > +}
> > > +
> > > +static int mt2712_set_delay(struct mediatek_dwmac_plat_data *plat)
> > > +{
> > > +   struct mac_delay_struct *mac_delay = >mac_delay;
> > > +   u32 delay_val = 0;
> > > +   u32 fine_val = 0;
> > The same type declaration can be put into the one line
> >
> Got it.
> > > +
> > > +   switch (plat->phy_mode) {
> >
> > There exists some room for code optimization in the switch statement
> > such as PHY_INTERFACE_MODE_MII and PHY_INTERFACE_MODE_RGMII both are
> > almost the same and even the configuration for the other PHY modes can
> > reuse their partial setup. It appears to be better using a common way
> > to set up various PHY modes.
> >
> I'll try define a function to handle it.
> And how about like this:
> static u32 delay_setting(u32 delay, bool inv, u32 en_bit, u32
> clk_shift, u32 clk_mask, u32 inv_bit) {
> u32 value = 0
>
> value |= delay ? en_bit : 0;
> value |= (delay << clk_shift) & clk_mask;
> value |= inv ? inv_bit : 0;
> }
>
> case PHY_INTERFACE_MODE_MII:
> delay_value |= delay_setting(mac_delay->tx_delay,
>  mac_delay->tx_inv,
>  PHY_DLY_TXC_ENABLE,
>  PHY_DLY_TXC_SHIFT,
>  PHY_DLY_TXC_STAGES,
>  PHY_DLY_TXC_INV);

We can reuse FIELD_PREP defined in include/linux/bitfield.h to make up
of the value instead of creating your own function delay_setting here,
 and also PHY_DLY_TXC_SHIFT macro can be trimmed while you're using
FIED_PREP

> delay_value |= delay_setting(mac_delay->rx_delay,
>  mac_delay->rx_inv,
>  PHY_DLY_RXC_ENABLE,
>  PHY_DLY_RXC_SHIFT,
>  PHY_DLY_RXC_STAGES,
>  PHY_DLY_RXC_INV);
>
> case PHY_INTERFACE_MODE_RMII:
> if (plat->rmii_rxc) {
>  delay_value |= delay_setting(mac_delay->rx_delay,
>  mac_delay->rx_inv,
>  PHY_DLY_RXC_ENABLE,
>  PHY_DLY_RXC_SHIFT,
>  PHY_DLY_RXC_STAGES,
>  PHY_DLY_RXC_INV);
> fine_val |= mac_delay->tx_inv ?
>ETH_RMII_DLY_TX_INV : 0;
> } else {
>  delay_value |= delay_setting(mac_delay->rx_delay,
>  mac_delay->rx_inv,

shoudn't the parametors be mac_delay->tx_delay and mac_delay->tx_inv?

>  PHY_DLY_TXC_ENABLE,
>  PHY_DLY_TXC_SHIFT,
>  PHY_DLY_TXC_STAGES,
>  PHY_DLY_TXC_INV);
> fine_val |= mac_delay->tx_inv ?
>ETH_RMII_DLY_TX_INV : 0;

if (plat->tx_inv)
  fine_val = ETH_RMII_DLY_TX_INV;
the default fine_val is zero so zero assignement can be trimmed when
!plat-> tx_inv

> }
> case PHY_INTERFACE_MODE_RGMII:
>   fine_val = plat->fine_tune ?
>   (ETH_FINE_DLY_GTXC | ETH_FINE_DLY_RXC) : 0;

if (plat->fine_tune)
  fine_val = ETH_FINE_DLY_GTXC | ETH_FINE_DLY_RXC;
the default fine_val is zero so zero assignement can be trimmed when
!plat->fine_tune

>   delay_value |= 

Re: [PATCH 2/2] mm: ksm: do not block on page lock when searching stable tree

2018-11-22 Thread Kirill Tkhai
On 07.11.2018 22:16, Yang Shi wrote:
> ksmd need search stable tree to look for the suitable KSM page, but the
> KSM page might be locked for long time due to i.e. KSM page rmap walk.
> 
> It sounds not worth waiting for the lock, the page can be skip, then try
> to merge it in the next scan to avoid long stall if its content is
> still intact.
> 
> Introduce async mode to get_ksm_page() to not block on page lock, like
> what try_to_merge_one_page() does.
> 
> Return -EBUSY if trylock fails, since NULL means not find suitable KSM
> page, which is a valid case.
> 
> Signed-off-by: Yang Shi 

Reviewed-by: Kirill Tkhai 

> ---
>  mm/ksm.c | 29 +
>  1 file changed, 25 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/ksm.c b/mm/ksm.c
> index 5b0894b..576803d 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -667,7 +667,7 @@ static void remove_node_from_stable_tree(struct 
> stable_node *stable_node)
>  }
>  
>  /*
> - * get_ksm_page: checks if the page indicated by the stable node
> + * __get_ksm_page: checks if the page indicated by the stable node
>   * is still its ksm page, despite having held no reference to it.
>   * In which case we can trust the content of the page, and it
>   * returns the gotten page; but if the page has now been zapped,
> @@ -685,7 +685,8 @@ static void remove_node_from_stable_tree(struct 
> stable_node *stable_node)
>   * a page to put something that might look like our key in page->mapping.
>   * is on its way to being freed; but it is an anomaly to bear in mind.
>   */
> -static struct page *get_ksm_page(struct stable_node *stable_node, bool 
> lock_it)
> +static struct page *__get_ksm_page(struct stable_node *stable_node,
> +bool lock_it, bool async)
>  {
>   struct page *page;
>   void *expected_mapping;
> @@ -728,7 +729,14 @@ static struct page *get_ksm_page(struct stable_node 
> *stable_node, bool lock_it)
>   }
>  
>   if (lock_it) {
> - lock_page(page);
> + if (async) {
> + if (!trylock_page(page)) {
> + put_page(page);
> + return ERR_PTR(-EBUSY);
> + }
> + } else
> + lock_page(page);
> +
>   if (READ_ONCE(page->mapping) != expected_mapping) {
>   unlock_page(page);
>   put_page(page);
> @@ -751,6 +759,11 @@ static struct page *get_ksm_page(struct stable_node 
> *stable_node, bool lock_it)
>   return NULL;
>  }
>  
> +static struct page *get_ksm_page(struct stable_node *stable_node, bool 
> lock_it)
> +{
> + return __get_ksm_page(stable_node, lock_it, false);
> +}
> +
>  /*
>   * Removing rmap_item from stable or unstable tree.
>   * This function will clean the information from the stable/unstable tree.
> @@ -1675,7 +1688,11 @@ static struct page *stable_tree_search(struct page 
> *page)
>* It would be more elegant to return stable_node
>* than kpage, but that involves more changes.
>*/
> - tree_page = get_ksm_page(stable_node_dup, true);
> + tree_page = __get_ksm_page(stable_node_dup, true, true);
> +
> + if (PTR_ERR(tree_page) == -EBUSY)
> + return ERR_PTR(-EBUSY);
> +
>   if (unlikely(!tree_page))
>   /*
>* The tree may have been rebalanced,
> @@ -2062,6 +2079,10 @@ static void cmp_and_merge_page(struct page *page, 
> struct rmap_item *rmap_item)
>  
>   /* We first start with searching the page inside the stable tree */
>   kpage = stable_tree_search(page);
> +
> + if (PTR_ERR(kpage) == -EBUSY)
> + return;
> +
>   if (kpage == page && rmap_item->head == stable_node) {
>   put_page(kpage);
>   return;
> 


Re: [PATCH 2/2] mm: ksm: do not block on page lock when searching stable tree

2018-11-22 Thread Kirill Tkhai
On 07.11.2018 22:16, Yang Shi wrote:
> ksmd need search stable tree to look for the suitable KSM page, but the
> KSM page might be locked for long time due to i.e. KSM page rmap walk.
> 
> It sounds not worth waiting for the lock, the page can be skip, then try
> to merge it in the next scan to avoid long stall if its content is
> still intact.
> 
> Introduce async mode to get_ksm_page() to not block on page lock, like
> what try_to_merge_one_page() does.
> 
> Return -EBUSY if trylock fails, since NULL means not find suitable KSM
> page, which is a valid case.
> 
> Signed-off-by: Yang Shi 

Reviewed-by: Kirill Tkhai 

> ---
>  mm/ksm.c | 29 +
>  1 file changed, 25 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/ksm.c b/mm/ksm.c
> index 5b0894b..576803d 100644
> --- a/mm/ksm.c
> +++ b/mm/ksm.c
> @@ -667,7 +667,7 @@ static void remove_node_from_stable_tree(struct 
> stable_node *stable_node)
>  }
>  
>  /*
> - * get_ksm_page: checks if the page indicated by the stable node
> + * __get_ksm_page: checks if the page indicated by the stable node
>   * is still its ksm page, despite having held no reference to it.
>   * In which case we can trust the content of the page, and it
>   * returns the gotten page; but if the page has now been zapped,
> @@ -685,7 +685,8 @@ static void remove_node_from_stable_tree(struct 
> stable_node *stable_node)
>   * a page to put something that might look like our key in page->mapping.
>   * is on its way to being freed; but it is an anomaly to bear in mind.
>   */
> -static struct page *get_ksm_page(struct stable_node *stable_node, bool 
> lock_it)
> +static struct page *__get_ksm_page(struct stable_node *stable_node,
> +bool lock_it, bool async)
>  {
>   struct page *page;
>   void *expected_mapping;
> @@ -728,7 +729,14 @@ static struct page *get_ksm_page(struct stable_node 
> *stable_node, bool lock_it)
>   }
>  
>   if (lock_it) {
> - lock_page(page);
> + if (async) {
> + if (!trylock_page(page)) {
> + put_page(page);
> + return ERR_PTR(-EBUSY);
> + }
> + } else
> + lock_page(page);
> +
>   if (READ_ONCE(page->mapping) != expected_mapping) {
>   unlock_page(page);
>   put_page(page);
> @@ -751,6 +759,11 @@ static struct page *get_ksm_page(struct stable_node 
> *stable_node, bool lock_it)
>   return NULL;
>  }
>  
> +static struct page *get_ksm_page(struct stable_node *stable_node, bool 
> lock_it)
> +{
> + return __get_ksm_page(stable_node, lock_it, false);
> +}
> +
>  /*
>   * Removing rmap_item from stable or unstable tree.
>   * This function will clean the information from the stable/unstable tree.
> @@ -1675,7 +1688,11 @@ static struct page *stable_tree_search(struct page 
> *page)
>* It would be more elegant to return stable_node
>* than kpage, but that involves more changes.
>*/
> - tree_page = get_ksm_page(stable_node_dup, true);
> + tree_page = __get_ksm_page(stable_node_dup, true, true);
> +
> + if (PTR_ERR(tree_page) == -EBUSY)
> + return ERR_PTR(-EBUSY);
> +
>   if (unlikely(!tree_page))
>   /*
>* The tree may have been rebalanced,
> @@ -2062,6 +2079,10 @@ static void cmp_and_merge_page(struct page *page, 
> struct rmap_item *rmap_item)
>  
>   /* We first start with searching the page inside the stable tree */
>   kpage = stable_tree_search(page);
> +
> + if (PTR_ERR(kpage) == -EBUSY)
> + return;
> +
>   if (kpage == page && rmap_item->head == stable_node) {
>   put_page(kpage);
>   return;
> 


Re: [tip:x86/cleanups] x86/headers: Fix -Wmissing-prototypes warning

2018-11-22 Thread Ingo Molnar


* tip-bot for Yi Wang  wrote:

> Commit-ID:  d37904c5b14317a2c76efec6b9e4dbcaa17380e5
> Gitweb: 
> https://git.kernel.org/tip/d37904c5b14317a2c76efec6b9e4dbcaa17380e5
> Author: Yi Wang 
> AuthorDate: Thu, 22 Nov 2018 10:04:09 +0800
> Committer:  Ingo Molnar 
> CommitDate: Thu, 22 Nov 2018 09:52:28 +0100
> 
> x86/headers: Fix -Wmissing-prototypes warning


>  #endif /* _ASM_X86_CRASH_H */
> diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
> index eea40d52ca78..063f1d4d698e 100644
> --- a/arch/x86/include/asm/efi.h
> +++ b/arch/x86/include/asm/efi.h
> @@ -173,8 +173,6 @@ static inline bool efi_runtime_supported(void)
>  extern struct console early_efi_console;
>  extern void parse_efi_setup(u64 phys_addr, u32 data_len);
>  
> -extern void efifb_setup_from_dmi(struct screen_info *si, const char *opt);
> -
>  #ifdef CONFIG_EFI_MIXED
>  extern void efi_thunk_runtime_setup(void);
>  extern efi_status_t efi_thunk_set_virtual_address_map(

> diff --git a/include/linux/efi.h b/include/linux/efi.h
> index 845174e113ce..890c4cb37502 100644
> --- a/include/linux/efi.h
> +++ b/include/linux/efi.h
> @@ -1053,6 +1053,8 @@ extern struct kobject *efi_kobj;
>  extern int efi_reboot_quirk_mode;
>  extern bool efi_poweroff_required(void);
>  
> +extern void efifb_setup_from_dmi(struct screen_info *si, const char *opt);
> +
>  #ifdef CONFIG_EFI_FAKE_MEMMAP
>  extern void __init efi_fake_memmap(void);
>  #else

These efifb_setup_from_dmi() changes were completely bogus and broke 
every non-x86 EFI architecture, which a simple:

  git grep efifb_setup_from_dmi

should have already exposed.

Did you actually check the usage of every single prototype and think 
about them case by case? It doesn't seem to be the case.

Thanks,

Ingo


Re: [tip:x86/cleanups] x86/headers: Fix -Wmissing-prototypes warning

2018-11-22 Thread Ingo Molnar


* tip-bot for Yi Wang  wrote:

> Commit-ID:  d37904c5b14317a2c76efec6b9e4dbcaa17380e5
> Gitweb: 
> https://git.kernel.org/tip/d37904c5b14317a2c76efec6b9e4dbcaa17380e5
> Author: Yi Wang 
> AuthorDate: Thu, 22 Nov 2018 10:04:09 +0800
> Committer:  Ingo Molnar 
> CommitDate: Thu, 22 Nov 2018 09:52:28 +0100
> 
> x86/headers: Fix -Wmissing-prototypes warning


>  #endif /* _ASM_X86_CRASH_H */
> diff --git a/arch/x86/include/asm/efi.h b/arch/x86/include/asm/efi.h
> index eea40d52ca78..063f1d4d698e 100644
> --- a/arch/x86/include/asm/efi.h
> +++ b/arch/x86/include/asm/efi.h
> @@ -173,8 +173,6 @@ static inline bool efi_runtime_supported(void)
>  extern struct console early_efi_console;
>  extern void parse_efi_setup(u64 phys_addr, u32 data_len);
>  
> -extern void efifb_setup_from_dmi(struct screen_info *si, const char *opt);
> -
>  #ifdef CONFIG_EFI_MIXED
>  extern void efi_thunk_runtime_setup(void);
>  extern efi_status_t efi_thunk_set_virtual_address_map(

> diff --git a/include/linux/efi.h b/include/linux/efi.h
> index 845174e113ce..890c4cb37502 100644
> --- a/include/linux/efi.h
> +++ b/include/linux/efi.h
> @@ -1053,6 +1053,8 @@ extern struct kobject *efi_kobj;
>  extern int efi_reboot_quirk_mode;
>  extern bool efi_poweroff_required(void);
>  
> +extern void efifb_setup_from_dmi(struct screen_info *si, const char *opt);
> +
>  #ifdef CONFIG_EFI_FAKE_MEMMAP
>  extern void __init efi_fake_memmap(void);
>  #else

These efifb_setup_from_dmi() changes were completely bogus and broke 
every non-x86 EFI architecture, which a simple:

  git grep efifb_setup_from_dmi

should have already exposed.

Did you actually check the usage of every single prototype and think 
about them case by case? It doesn't seem to be the case.

Thanks,

Ingo


Re: [PATCH] s390: Remove obsolete bust_spinlock() implementation

2018-11-22 Thread Heiko Carstens
On Fri, Nov 23, 2018 at 11:17:48AM +0900, Sergey Senozhatsky wrote:
> On (11/22/18 15:15), Petr Mladek wrote:
> > The commit cefc8be82403cf ("Consolidate bust_spinlocks()") kept
> > the s390-specific implementation because of the absence of CONFIG_VT.
> > In fact, the only difference was calling console_unblank() instead of
> > unblank_screen().
> > 
> > The common implementation in lib/bust_spinlocks.c started to call
> > unblank_screen() explicitly since the commit b61312d353da187
> > ("oops handling: ensure that any oops is flushed to the mtdoops
> > console").
> > 
> > As a result, the custom implementation is not longer necessary.
> > And we could get all the other improvements of the common
> > implementation for free.
> 
> I believe I sent a similar patch several weeks ago and it's
> in s390 patch queue as of now, waiting for the next merge
> window.
> 
> lkml.kernel.org/r/20181025081108.GB26561@osiris

Yes, it will be added soon to the features branch of the
s390/linux.git repository on kernel.org and then hit linux-next.



Re: [PATCH] s390: Remove obsolete bust_spinlock() implementation

2018-11-22 Thread Heiko Carstens
On Fri, Nov 23, 2018 at 11:17:48AM +0900, Sergey Senozhatsky wrote:
> On (11/22/18 15:15), Petr Mladek wrote:
> > The commit cefc8be82403cf ("Consolidate bust_spinlocks()") kept
> > the s390-specific implementation because of the absence of CONFIG_VT.
> > In fact, the only difference was calling console_unblank() instead of
> > unblank_screen().
> > 
> > The common implementation in lib/bust_spinlocks.c started to call
> > unblank_screen() explicitly since the commit b61312d353da187
> > ("oops handling: ensure that any oops is flushed to the mtdoops
> > console").
> > 
> > As a result, the custom implementation is not longer necessary.
> > And we could get all the other improvements of the common
> > implementation for free.
> 
> I believe I sent a similar patch several weeks ago and it's
> in s390 patch queue as of now, waiting for the next merge
> window.
> 
> lkml.kernel.org/r/20181025081108.GB26561@osiris

Yes, it will be added soon to the features branch of the
s390/linux.git repository on kernel.org and then hit linux-next.



Re: [PATCH v7 05/16] tracing: Generalize hist trigger onmax and save action

2018-11-22 Thread Namhyung Kim
On Wed, Nov 14, 2018 at 02:18:02PM -0600, Tom Zanussi wrote:
> From: Tom Zanussi 
> 
> The action refactor code allowed actions and handlers to be separated,
> but the existing onmax handler and save action code is still not
> flexible enough to handle arbitrary coupling.  This change generalizes
> them and in the process makes additional handlers and actions easier
> to implement.
> 
> The onmax action can be broken up and thought of as two separate
> components - a variable to be tracked (the parameter given to the
> onmax($var_to_track) function) and an invisible variable created to
> save the ongoing result of doing something with that variable, such as
> saving the max value of that variable so far seen.
> 
> Separating it out like this and renaming it appropriately allows us to
> use the same code for similar tracking functions such as
> onchange($var_to_track), which would just track the last value seen
> rather than the max seen so far, which is useful in some situations.
> 
> Additionally, because different handlers and actions may want to save
> and access data differently e.g. save and retrieve tracking values as
> local variables vs something more global, save_val() and get_val()
> interface functions are introduced and max-specific implementations
> are used instead.
> 
> The same goes for the code that checks whether a maximum has been hit
> - a generic check_val() interface and max-checking implementation is
> used instead, which allows future patches to make use of he same code
> using their own implemetations of similar functionality.
> 
> Signed-off-by: Tom Zanussi 
> ---
>  kernel/trace/trace_events_hist.c | 225 
> ++-
>  1 file changed, 151 insertions(+), 74 deletions(-)
> 
> diff --git a/kernel/trace/trace_events_hist.c 
> b/kernel/trace/trace_events_hist.c
> index 54b78cfe2766..ac48ad1482c8 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -319,6 +319,15 @@ typedef void (*action_fn_t) (struct hist_trigger_data 
> *hist_data,
>struct ring_buffer_event *rbe,
>struct action_data *data, u64 *var_ref_vals);
>  
> +typedef bool (*check_track_val_fn_t) (u64 track_val, u64 var_val);
> +typedef bool (*save_track_val_fn_t) (struct hist_trigger_data *hist_data,
> +  struct tracing_map_elt *elt,
> +  struct action_data *data,
> +  unsigned int track_var_idx, u64 var_val);
> +typedef u64 (*get_track_val_fn_t) (struct hist_trigger_data *hist_data,
> +struct tracing_map_elt *elt,
> +struct action_data *data);
> +
>  enum handler_id {
>   HANDLER_ONMATCH = 1,
>   HANDLER_ONMAX,
> @@ -349,14 +358,18 @@ struct action_data {
>  
>   struct {
>   char*var_str;
> - unsigned intmax_var_ref_idx;
> - struct hist_field   *max_var;
> - struct hist_field   *var;
> - } onmax;
> + struct hist_field   *var_ref;
> + unsigned intvar_ref_idx;
> +
> + struct hist_field   *track_var;
> +
> + check_track_val_fn_tcheck_val;
> + save_track_val_fn_t save_val;
> + get_track_val_fn_t  get_val;
> + } track_data;
>   };
>  };
>  
> -
>  static char last_hist_cmd[MAX_FILTER_STR_VAL];
>  static char hist_err_str[MAX_FILTER_STR_VAL];
>  
> @@ -3133,10 +3146,10 @@ static void update_field_vars(struct 
> hist_trigger_data *hist_data,
>   hist_data->n_field_vars, 0);
>  }
>  
> -static void update_max_vars(struct hist_trigger_data *hist_data,
> - struct tracing_map_elt *elt,
> - struct ring_buffer_event *rbe,
> - void *rec)
> +static void update_save_vars(struct hist_trigger_data *hist_data,
> +  struct tracing_map_elt *elt,
> +  struct ring_buffer_event *rbe,
> +  void *rec)
>  {
>   __update_field_vars(elt, rbe, rec, hist_data->save_vars,
>   hist_data->n_save_vars, hist_data->n_field_var_str);
> @@ -3274,14 +3287,68 @@ create_target_field_var(struct hist_trigger_data 
> *target_hist_data,
>   return create_field_var(target_hist_data, file, var_name);
>  }
>  
> -static void onmax_print(struct seq_file *m,
> - struct hist_trigger_data *hist_data,
> - struct tracing_map_elt *elt,
> - struct action_data *data)
> +static bool check_track_val_max(u64 track_val, u64 var_val)
>  {
> - unsigned int i, save_var_idx, max_idx = data->onmax.max_var->var.idx;
> + if (var_val 

Re: [PATCH v7 05/16] tracing: Generalize hist trigger onmax and save action

2018-11-22 Thread Namhyung Kim
On Wed, Nov 14, 2018 at 02:18:02PM -0600, Tom Zanussi wrote:
> From: Tom Zanussi 
> 
> The action refactor code allowed actions and handlers to be separated,
> but the existing onmax handler and save action code is still not
> flexible enough to handle arbitrary coupling.  This change generalizes
> them and in the process makes additional handlers and actions easier
> to implement.
> 
> The onmax action can be broken up and thought of as two separate
> components - a variable to be tracked (the parameter given to the
> onmax($var_to_track) function) and an invisible variable created to
> save the ongoing result of doing something with that variable, such as
> saving the max value of that variable so far seen.
> 
> Separating it out like this and renaming it appropriately allows us to
> use the same code for similar tracking functions such as
> onchange($var_to_track), which would just track the last value seen
> rather than the max seen so far, which is useful in some situations.
> 
> Additionally, because different handlers and actions may want to save
> and access data differently e.g. save and retrieve tracking values as
> local variables vs something more global, save_val() and get_val()
> interface functions are introduced and max-specific implementations
> are used instead.
> 
> The same goes for the code that checks whether a maximum has been hit
> - a generic check_val() interface and max-checking implementation is
> used instead, which allows future patches to make use of he same code
> using their own implemetations of similar functionality.
> 
> Signed-off-by: Tom Zanussi 
> ---
>  kernel/trace/trace_events_hist.c | 225 
> ++-
>  1 file changed, 151 insertions(+), 74 deletions(-)
> 
> diff --git a/kernel/trace/trace_events_hist.c 
> b/kernel/trace/trace_events_hist.c
> index 54b78cfe2766..ac48ad1482c8 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -319,6 +319,15 @@ typedef void (*action_fn_t) (struct hist_trigger_data 
> *hist_data,
>struct ring_buffer_event *rbe,
>struct action_data *data, u64 *var_ref_vals);
>  
> +typedef bool (*check_track_val_fn_t) (u64 track_val, u64 var_val);
> +typedef bool (*save_track_val_fn_t) (struct hist_trigger_data *hist_data,
> +  struct tracing_map_elt *elt,
> +  struct action_data *data,
> +  unsigned int track_var_idx, u64 var_val);
> +typedef u64 (*get_track_val_fn_t) (struct hist_trigger_data *hist_data,
> +struct tracing_map_elt *elt,
> +struct action_data *data);
> +
>  enum handler_id {
>   HANDLER_ONMATCH = 1,
>   HANDLER_ONMAX,
> @@ -349,14 +358,18 @@ struct action_data {
>  
>   struct {
>   char*var_str;
> - unsigned intmax_var_ref_idx;
> - struct hist_field   *max_var;
> - struct hist_field   *var;
> - } onmax;
> + struct hist_field   *var_ref;
> + unsigned intvar_ref_idx;
> +
> + struct hist_field   *track_var;
> +
> + check_track_val_fn_tcheck_val;
> + save_track_val_fn_t save_val;
> + get_track_val_fn_t  get_val;
> + } track_data;
>   };
>  };
>  
> -
>  static char last_hist_cmd[MAX_FILTER_STR_VAL];
>  static char hist_err_str[MAX_FILTER_STR_VAL];
>  
> @@ -3133,10 +3146,10 @@ static void update_field_vars(struct 
> hist_trigger_data *hist_data,
>   hist_data->n_field_vars, 0);
>  }
>  
> -static void update_max_vars(struct hist_trigger_data *hist_data,
> - struct tracing_map_elt *elt,
> - struct ring_buffer_event *rbe,
> - void *rec)
> +static void update_save_vars(struct hist_trigger_data *hist_data,
> +  struct tracing_map_elt *elt,
> +  struct ring_buffer_event *rbe,
> +  void *rec)
>  {
>   __update_field_vars(elt, rbe, rec, hist_data->save_vars,
>   hist_data->n_save_vars, hist_data->n_field_var_str);
> @@ -3274,14 +3287,68 @@ create_target_field_var(struct hist_trigger_data 
> *target_hist_data,
>   return create_field_var(target_hist_data, file, var_name);
>  }
>  
> -static void onmax_print(struct seq_file *m,
> - struct hist_trigger_data *hist_data,
> - struct tracing_map_elt *elt,
> - struct action_data *data)
> +static bool check_track_val_max(u64 track_val, u64 var_val)
>  {
> - unsigned int i, save_var_idx, max_idx = data->onmax.max_var->var.idx;
> + if (var_val 

Re: [PATCH 4.19 00/42] 4.19.4-stable review

2018-11-22 Thread Greg Kroah-Hartman
On Thu, Nov 22, 2018 at 02:30:58PM -0800, Guenter Roeck wrote:
> On 11/22/18 2:01 PM, Thomas Voegtle wrote:
> > On Thu, 22 Nov 2018, Thomas Voegtle wrote:
> > 
> > > 
> > > Doesn't compile for me on OpenSuSE 15.0 (gcc 7.3.1):
> > > 
> > >   CALL    scripts/checksyscalls.sh
> > >   DESCEND  objtool
> > >   CHK include/generated/compile.h
> > >   CC [M]  drivers/gpu/drm/i915/i915_gem_gtt.o
> > > drivers/gpu/drm/i915/i915_gem_gtt.c: In function ‘gen6_dump_ppgtt’:
> > > drivers/gpu/drm/i915/i915_gem_gtt.c:1771:41: error: format ‘%llx’ expects
> > > argument of type ‘long long unsigned int’, but argument 5 has type ‘long
> > > unsigned int’ [-Werror=format=]
> > >    seq_printf(m, "\t\t(%03d, %04d) %08llx: ",
> > >    ~ ^
> > >    %08lx
> > > cc1: all warnings being treated as errors
> > > make[4]: *** [scripts/Makefile.build:306:
> > > drivers/gpu/drm/i915/i915_gem_gtt.o] Error 1
> > > make[3]: *** [scripts/Makefile.build:546: drivers/gpu/drm/i915] Error 2
> > > make[2]: *** [scripts/Makefile.build:546: drivers/gpu/drm] Error 2
> > > make[1]: *** [scripts/Makefile.build:546: drivers/gpu] Error 2
> > > make: *** [Makefile:1052: drivers] Error 2
> > > 
> > > 
> > > 
> > > 4.19.3 is broken for me, too. 4.19.2 is works.
> > > 4.20-rc tree works.
> > > 
> > > Config attached.
> > 
> > 
> > quick bisect shows problem is:
> > 
> > commit 1a25e1a1be71a49ee7f34fb14b5a26191e6cf501
> > Author: Chris Wilson 
> > Date:   Thu Oct 25 10:18:22 2018 +0100
> > 
> >      drm/i915: Mark up GTT sizes as u64
> > 
> >      commit c58281056a8b26d5d9dc15c19859a7880835ef44 upstream.
> > 
> > 
> > reverted on 4.19.4-rc1 it compiles for me. I guess something is missing 
> > here?
> > 
> AFAICS someone was not careful with the backport. Upstream doesn't have %llx
> at that place.

Ugh, odd.  I'll go fix this up for the next round after this release,
thans for tracking it down.

greg k-h


Re: [PATCH 4.19 00/42] 4.19.4-stable review

2018-11-22 Thread Greg Kroah-Hartman
On Thu, Nov 22, 2018 at 02:30:58PM -0800, Guenter Roeck wrote:
> On 11/22/18 2:01 PM, Thomas Voegtle wrote:
> > On Thu, 22 Nov 2018, Thomas Voegtle wrote:
> > 
> > > 
> > > Doesn't compile for me on OpenSuSE 15.0 (gcc 7.3.1):
> > > 
> > >   CALL    scripts/checksyscalls.sh
> > >   DESCEND  objtool
> > >   CHK include/generated/compile.h
> > >   CC [M]  drivers/gpu/drm/i915/i915_gem_gtt.o
> > > drivers/gpu/drm/i915/i915_gem_gtt.c: In function ‘gen6_dump_ppgtt’:
> > > drivers/gpu/drm/i915/i915_gem_gtt.c:1771:41: error: format ‘%llx’ expects
> > > argument of type ‘long long unsigned int’, but argument 5 has type ‘long
> > > unsigned int’ [-Werror=format=]
> > >    seq_printf(m, "\t\t(%03d, %04d) %08llx: ",
> > >    ~ ^
> > >    %08lx
> > > cc1: all warnings being treated as errors
> > > make[4]: *** [scripts/Makefile.build:306:
> > > drivers/gpu/drm/i915/i915_gem_gtt.o] Error 1
> > > make[3]: *** [scripts/Makefile.build:546: drivers/gpu/drm/i915] Error 2
> > > make[2]: *** [scripts/Makefile.build:546: drivers/gpu/drm] Error 2
> > > make[1]: *** [scripts/Makefile.build:546: drivers/gpu] Error 2
> > > make: *** [Makefile:1052: drivers] Error 2
> > > 
> > > 
> > > 
> > > 4.19.3 is broken for me, too. 4.19.2 is works.
> > > 4.20-rc tree works.
> > > 
> > > Config attached.
> > 
> > 
> > quick bisect shows problem is:
> > 
> > commit 1a25e1a1be71a49ee7f34fb14b5a26191e6cf501
> > Author: Chris Wilson 
> > Date:   Thu Oct 25 10:18:22 2018 +0100
> > 
> >      drm/i915: Mark up GTT sizes as u64
> > 
> >      commit c58281056a8b26d5d9dc15c19859a7880835ef44 upstream.
> > 
> > 
> > reverted on 4.19.4-rc1 it compiles for me. I guess something is missing 
> > here?
> > 
> AFAICS someone was not careful with the backport. Upstream doesn't have %llx
> at that place.

Ugh, odd.  I'll go fix this up for the next round after this release,
thans for tracking it down.

greg k-h


Re: [PATCH v2 1/3] thermal: tegra: continue if sensor register fails

2018-11-22 Thread Daniel Lezcano


Hi wei,

On 23/11/2018 07:15, Wei Ni wrote:
> 
> 
> On 22/11/2018 9:07 PM, Daniel Lezcano wrote:
>> On 22/11/2018 08:10, Wei Ni wrote:
>>>
>>>
>>> On 21/11/2018 8:51 PM, Daniel Lezcano wrote:
 On 21/11/2018 11:23, Wei Ni wrote:
>
>
> On 21/11/2018 4:55 PM, Daniel Lezcano wrote:
>> On 13/11/2018 11:06, Wei Ni wrote:
>>> Don't bail when a sensor fails to register with the
>>> thermal zone and allow other sensors to register.
>>> This allows other sensors to register with thermal
>>> framework even if one sensor fails registration.
>>
>> I'm not sure if ignoring the error is really safe. Can you describe the
>> real situation you want to overcome ? How do you differentiate critical
>> sensors ?
>
> The driver will always try to register 4 thermal zones, including cpu,
> gpu, mem and pll, but if the dts file doesn't set the corresponding
> sensors, then the register will be failed.
> Normally, the dts file will set all 4 sensors, but there may have some
> platform doesn't support them all. So we post this patch.

 Ignoring errors is not the way to go to support different platforms. Fix
 the DT.
>>>
>>> The issue isn't in DT file. The Tegra soc thermal include 4 sensors:
>>> cpu, gpu, mem, pll. But in some platforms, for example, we may only need
>>> to support 2 sensors, such as cpu and gpu, so we only configure these
>>> two senors in DT file. But the driver will always try to register 4
>>> sensors, cpu/gpu/mem/pll, so mem and pll will be registered failed. So
>>> in this case we need to ignoring the failure, and continue to enable the
>>> driver.
>>
>> You can fix this by changing the driver to support the platform and
>> register the sensor you are interested in.
>>
>> Ignoring errors is not a good idea.
> 
> If hit the errors, the driver will print out the warning. In current
> code, the driver probe routine will return failure directly, indeed it
> didn't do anything either except print out warnings.
> I think this error should not block other sensors' registration. Let's
> consider this case, we have four sensors, if the one sensor register
> failed, then the driver return probe failure, so the drive will not be
> enabled, and other sensor can't work either, it mean the device may boot
> up without any thermal sensors.
> Or if the error is the -ENODEV, that mean the we didn't set
> corresponding sensor id in the dt file, so we can continue to register.
> If the error is other value, then we can return directly.

It is a possibility but may be there are a couple of alternatives:

1. If there is a compatible string for the platform variant, use it to
probe the right sensors

or

2. Use the qoriq driver approach by reparsing the DT and find out the
thermal zone and their respective sensor id.


> BTW, what do you mean "critical sensors"? We will set critical trip temp
> for all sensors.

 I meant sensor for thermal zone getting really high temperature.
>>>
>>> We doesn't have the critical sensors. We set the critical trip temp for
>>> all registered sensors. And these trip temp is set to the Tegra
>>> hardware. So it mean if the temperature reached the critical trip point,
>>> then the system will be shutdown directly.
>>>


>>> Signed-off-by: Wei Ni 
>>> ---
>>>  drivers/thermal/tegra/soctherm.c | 8 +---
>>>  1 file changed, 5 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/thermal/tegra/soctherm.c 
>>> b/drivers/thermal/tegra/soctherm.c
>>> index ed28110a3535..a824d2e63af3 100644
>>> --- a/drivers/thermal/tegra/soctherm.c
>>> +++ b/drivers/thermal/tegra/soctherm.c
>>> @@ -1370,9 +1370,9 @@ static int tegra_soctherm_probe(struct 
>>> platform_device *pdev)
>>>  
>>> _of_thermal_ops);
>>> if (IS_ERR(z)) {
>>> err = PTR_ERR(z);
>>> -   dev_err(>dev, "failed to register sensor: 
>>> %d\n",
>>> -   err);
>>> -   goto disable_clocks;
>>> +   dev_warn(>dev, "failed to register sensor 
>>> %s: %d\n",
>>> +soc->ttgs[i]->name, err);
>>> +   continue;
>>> }
>>>  
>>> zone->tz = z;
>>> @@ -1434,6 +1434,8 @@ static int __maybe_unused soctherm_resume(struct 
>>> device *dev)
>>> struct thermal_zone_device *tz;
>>>  
>>> tz = tegra->thermctl_tzs[soc->ttgs[i]->id];
>>> +   if (!tz)
>>> +   continue;
>>> err = tegra_soctherm_set_hwtrips(dev, soc->ttgs[i], tz);
>>> if (err) {
>>> dev_err(>dev,
>>>
>>
>>


>>
>>


-- 
  

Re: [PATCH v2 1/3] thermal: tegra: continue if sensor register fails

2018-11-22 Thread Daniel Lezcano


Hi wei,

On 23/11/2018 07:15, Wei Ni wrote:
> 
> 
> On 22/11/2018 9:07 PM, Daniel Lezcano wrote:
>> On 22/11/2018 08:10, Wei Ni wrote:
>>>
>>>
>>> On 21/11/2018 8:51 PM, Daniel Lezcano wrote:
 On 21/11/2018 11:23, Wei Ni wrote:
>
>
> On 21/11/2018 4:55 PM, Daniel Lezcano wrote:
>> On 13/11/2018 11:06, Wei Ni wrote:
>>> Don't bail when a sensor fails to register with the
>>> thermal zone and allow other sensors to register.
>>> This allows other sensors to register with thermal
>>> framework even if one sensor fails registration.
>>
>> I'm not sure if ignoring the error is really safe. Can you describe the
>> real situation you want to overcome ? How do you differentiate critical
>> sensors ?
>
> The driver will always try to register 4 thermal zones, including cpu,
> gpu, mem and pll, but if the dts file doesn't set the corresponding
> sensors, then the register will be failed.
> Normally, the dts file will set all 4 sensors, but there may have some
> platform doesn't support them all. So we post this patch.

 Ignoring errors is not the way to go to support different platforms. Fix
 the DT.
>>>
>>> The issue isn't in DT file. The Tegra soc thermal include 4 sensors:
>>> cpu, gpu, mem, pll. But in some platforms, for example, we may only need
>>> to support 2 sensors, such as cpu and gpu, so we only configure these
>>> two senors in DT file. But the driver will always try to register 4
>>> sensors, cpu/gpu/mem/pll, so mem and pll will be registered failed. So
>>> in this case we need to ignoring the failure, and continue to enable the
>>> driver.
>>
>> You can fix this by changing the driver to support the platform and
>> register the sensor you are interested in.
>>
>> Ignoring errors is not a good idea.
> 
> If hit the errors, the driver will print out the warning. In current
> code, the driver probe routine will return failure directly, indeed it
> didn't do anything either except print out warnings.
> I think this error should not block other sensors' registration. Let's
> consider this case, we have four sensors, if the one sensor register
> failed, then the driver return probe failure, so the drive will not be
> enabled, and other sensor can't work either, it mean the device may boot
> up without any thermal sensors.
> Or if the error is the -ENODEV, that mean the we didn't set
> corresponding sensor id in the dt file, so we can continue to register.
> If the error is other value, then we can return directly.

It is a possibility but may be there are a couple of alternatives:

1. If there is a compatible string for the platform variant, use it to
probe the right sensors

or

2. Use the qoriq driver approach by reparsing the DT and find out the
thermal zone and their respective sensor id.


> BTW, what do you mean "critical sensors"? We will set critical trip temp
> for all sensors.

 I meant sensor for thermal zone getting really high temperature.
>>>
>>> We doesn't have the critical sensors. We set the critical trip temp for
>>> all registered sensors. And these trip temp is set to the Tegra
>>> hardware. So it mean if the temperature reached the critical trip point,
>>> then the system will be shutdown directly.
>>>


>>> Signed-off-by: Wei Ni 
>>> ---
>>>  drivers/thermal/tegra/soctherm.c | 8 +---
>>>  1 file changed, 5 insertions(+), 3 deletions(-)
>>>
>>> diff --git a/drivers/thermal/tegra/soctherm.c 
>>> b/drivers/thermal/tegra/soctherm.c
>>> index ed28110a3535..a824d2e63af3 100644
>>> --- a/drivers/thermal/tegra/soctherm.c
>>> +++ b/drivers/thermal/tegra/soctherm.c
>>> @@ -1370,9 +1370,9 @@ static int tegra_soctherm_probe(struct 
>>> platform_device *pdev)
>>>  
>>> _of_thermal_ops);
>>> if (IS_ERR(z)) {
>>> err = PTR_ERR(z);
>>> -   dev_err(>dev, "failed to register sensor: 
>>> %d\n",
>>> -   err);
>>> -   goto disable_clocks;
>>> +   dev_warn(>dev, "failed to register sensor 
>>> %s: %d\n",
>>> +soc->ttgs[i]->name, err);
>>> +   continue;
>>> }
>>>  
>>> zone->tz = z;
>>> @@ -1434,6 +1434,8 @@ static int __maybe_unused soctherm_resume(struct 
>>> device *dev)
>>> struct thermal_zone_device *tz;
>>>  
>>> tz = tegra->thermctl_tzs[soc->ttgs[i]->id];
>>> +   if (!tz)
>>> +   continue;
>>> err = tegra_soctherm_set_hwtrips(dev, soc->ttgs[i], tz);
>>> if (err) {
>>> dev_err(>dev,
>>>
>>
>>


>>
>>


-- 
  

Re: [PATCH 4.19 00/42] 4.19.4-stable review

2018-11-22 Thread Greg Kroah-Hartman
On Thu, Nov 22, 2018 at 09:53:35PM +0100, Thomas Voegtle wrote:
> 
> Doesn't compile for me on OpenSuSE 15.0 (gcc 7.3.1):
> 
>   CALLscripts/checksyscalls.sh
>   DESCEND  objtool
>   CHK include/generated/compile.h
>   CC [M]  drivers/gpu/drm/i915/i915_gem_gtt.o
> drivers/gpu/drm/i915/i915_gem_gtt.c: In function ‘gen6_dump_ppgtt’:
> drivers/gpu/drm/i915/i915_gem_gtt.c:1771:41: error: format ‘%llx’ expects
> argument of type ‘long long unsigned int’, but argument 5 has type ‘long
> unsigned int’ [-Werror=format=]
> seq_printf(m, "\t\t(%03d, %04d) %08llx: ",
> ~^
> %08lx
> cc1: all warnings being treated as errors

Warnings treated as errors?  That's rough, sorry, don't do that :)

I did see this, need to track it down, got distracted by other things...

thanks,

greg k-h


Re: [PATCH 4.19 00/42] 4.19.4-stable review

2018-11-22 Thread Greg Kroah-Hartman
On Thu, Nov 22, 2018 at 09:53:35PM +0100, Thomas Voegtle wrote:
> 
> Doesn't compile for me on OpenSuSE 15.0 (gcc 7.3.1):
> 
>   CALLscripts/checksyscalls.sh
>   DESCEND  objtool
>   CHK include/generated/compile.h
>   CC [M]  drivers/gpu/drm/i915/i915_gem_gtt.o
> drivers/gpu/drm/i915/i915_gem_gtt.c: In function ‘gen6_dump_ppgtt’:
> drivers/gpu/drm/i915/i915_gem_gtt.c:1771:41: error: format ‘%llx’ expects
> argument of type ‘long long unsigned int’, but argument 5 has type ‘long
> unsigned int’ [-Werror=format=]
> seq_printf(m, "\t\t(%03d, %04d) %08llx: ",
> ~^
> %08lx
> cc1: all warnings being treated as errors

Warnings treated as errors?  That's rough, sorry, don't do that :)

I did see this, need to track it down, got distracted by other things...

thanks,

greg k-h


Re: [PATCH 0/7] ACPI HMAT memory sysfs representation

2018-11-22 Thread Anshuman Khandual



On 11/22/2018 11:31 PM, Dave Hansen wrote:
> On 11/22/18 3:52 AM, Anshuman Khandual wrote:
>>>
>>> It sounds like the subset that's being exposed is insufficient for yo
>>> We did that because we think doing anything but a subset in sysfs will
>>> just blow up sysfs:  MAX_NUMNODES is as high as 1024, so if we have 4
>>> attributes, that's at _least_ 1024*1024*4 files if we expose *all*
>>> combinations.
>> Each permutation need not be a separate file inside all possible NODE X
>> (/sys/devices/system/node/nodeX) directories. It can be a top level file
>> enumerating various attribute values for a given (X, Y) node pair based
>> on an offset something like /proc/pid/pagemap.
> 
> My assumption has been that this kind of thing is too fancy for sysfs:

Applications need to know the matrix of multi attribute properties as
seen from various memory accessors/initiators to be able to bind them
to desired CPUs and memory. That gives applications true view of an
heterogeneous system. While I understand your concern here about the
sysfs (which can be worked around with probably multiple global files
may be if the size is a problem etc) but an insufficient interface is
definitely problematic in longer term. This is going to be an ABI which
is locked in for good. Hence even it might appear over engineering at
the moment but IMHO is the right thing to do.

> 
> Documentation/filesystems/sysfs.txt:
>> Attributes should be ASCII text files, preferably with only one value
>> per file. It is noted that it may not be efficient to contain only one
>> value per file, so it is socially acceptable to express an array of
>> values of the same type. 
>>
>> Mixing types, expressing multiple lines of data, and doing fancy
>> formatting of data is heavily frowned upon. Doing these things may get
>> you publicly humiliated and your code rewritten without notice. 
> 
> /proc/pid/pagemap is binary, not one-value-per-file and relatively
> complicated to parse.

I agree but it does provide user space really valuable information about
the faulted pages for it's VA space. Was there any better way of getting
it ? May be but at this point in time it is essential.

> 
> Do you really think following something like pagemap is the right model
> for sysfs.> 
> BTW, I'm not saying we don't need *some* interface like you propose.  We
> almost certainly will at some point.  I just don't think it will be in
> sysfs.

I am not saying doing this in sysfs is very elegant. I would rather have
a syscall read back (MAX_NODES * MAX_NODES * u64) attribute matrix from
the kernel. Probably a subset of that information can appear on sysfs to
speed of queries for various optimizations as Keith mentioned before. But
we will have to first evaluate and come to an agreement what constitutes
a comprehensive set for multi attribute properties. Are we willing to go
in the direction for inclusion of a new system call, subset of it appears
on sysfs etc ? My primary concern is not how the attribute information
appears on the sysfs but lack of it's completeness.


Re: [PATCH 0/7] ACPI HMAT memory sysfs representation

2018-11-22 Thread Anshuman Khandual



On 11/22/2018 11:31 PM, Dave Hansen wrote:
> On 11/22/18 3:52 AM, Anshuman Khandual wrote:
>>>
>>> It sounds like the subset that's being exposed is insufficient for yo
>>> We did that because we think doing anything but a subset in sysfs will
>>> just blow up sysfs:  MAX_NUMNODES is as high as 1024, so if we have 4
>>> attributes, that's at _least_ 1024*1024*4 files if we expose *all*
>>> combinations.
>> Each permutation need not be a separate file inside all possible NODE X
>> (/sys/devices/system/node/nodeX) directories. It can be a top level file
>> enumerating various attribute values for a given (X, Y) node pair based
>> on an offset something like /proc/pid/pagemap.
> 
> My assumption has been that this kind of thing is too fancy for sysfs:

Applications need to know the matrix of multi attribute properties as
seen from various memory accessors/initiators to be able to bind them
to desired CPUs and memory. That gives applications true view of an
heterogeneous system. While I understand your concern here about the
sysfs (which can be worked around with probably multiple global files
may be if the size is a problem etc) but an insufficient interface is
definitely problematic in longer term. This is going to be an ABI which
is locked in for good. Hence even it might appear over engineering at
the moment but IMHO is the right thing to do.

> 
> Documentation/filesystems/sysfs.txt:
>> Attributes should be ASCII text files, preferably with only one value
>> per file. It is noted that it may not be efficient to contain only one
>> value per file, so it is socially acceptable to express an array of
>> values of the same type. 
>>
>> Mixing types, expressing multiple lines of data, and doing fancy
>> formatting of data is heavily frowned upon. Doing these things may get
>> you publicly humiliated and your code rewritten without notice. 
> 
> /proc/pid/pagemap is binary, not one-value-per-file and relatively
> complicated to parse.

I agree but it does provide user space really valuable information about
the faulted pages for it's VA space. Was there any better way of getting
it ? May be but at this point in time it is essential.

> 
> Do you really think following something like pagemap is the right model
> for sysfs.> 
> BTW, I'm not saying we don't need *some* interface like you propose.  We
> almost certainly will at some point.  I just don't think it will be in
> sysfs.

I am not saying doing this in sysfs is very elegant. I would rather have
a syscall read back (MAX_NODES * MAX_NODES * u64) attribute matrix from
the kernel. Probably a subset of that information can appear on sysfs to
speed of queries for various optimizations as Keith mentioned before. But
we will have to first evaluate and come to an agreement what constitutes
a comprehensive set for multi attribute properties. Are we willing to go
in the direction for inclusion of a new system call, subset of it appears
on sysfs etc ? My primary concern is not how the attribute information
appears on the sysfs but lack of it's completeness.


[ANNOUNCE] 4.4.164-rt176

2018-11-22 Thread Daniel Wagner
Hello RT Folks!

I'm pleased to announce the 4.4.164-rt176 stable release.

This release is just an update to the new stable 4.4.164 version
and no RT specific changes have been made.

The previously reported cache line starvation bug has been resolved
via the stable tree (see 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.4.y=97b8ca659ab410c6955da052592959244d041fa8)

You can get this release via the git tree at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git

  branch: v4.4-rt
  Head SHA1: 726ccc5cab11ae1ac086642f022d0abf8cb85530

Or to build 4.4.164-rt176 directly, the following patches should be applied:

  http://www.kernel.org/pub/linux/kernel/v4.x/linux-4.4.tar.xz

  http://www.kernel.org/pub/linux/kernel/v4.x/patch-4.4.164.xz

  
http://www.kernel.org/pub/linux/kernel/projects/rt/4.4/4.4/patch-4.4.164-rt176.patch.xz


You can also build from 4.4.162-rt175 by applying the incremental patch:

  
http://www.kernel.org/pub/linux/kernel/projects/rt/4.4/4.4/incr/patch-4.4.162-rt175-rt176.patch.xz

Enjoy!
   Daniel


[ANNOUNCE] 4.4.164-rt176

2018-11-22 Thread Daniel Wagner
Hello RT Folks!

I'm pleased to announce the 4.4.164-rt176 stable release.

This release is just an update to the new stable 4.4.164 version
and no RT specific changes have been made.

The previously reported cache line starvation bug has been resolved
via the stable tree (see 
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?h=linux-4.4.y=97b8ca659ab410c6955da052592959244d041fa8)

You can get this release via the git tree at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-stable-rt.git

  branch: v4.4-rt
  Head SHA1: 726ccc5cab11ae1ac086642f022d0abf8cb85530

Or to build 4.4.164-rt176 directly, the following patches should be applied:

  http://www.kernel.org/pub/linux/kernel/v4.x/linux-4.4.tar.xz

  http://www.kernel.org/pub/linux/kernel/v4.x/patch-4.4.164.xz

  
http://www.kernel.org/pub/linux/kernel/projects/rt/4.4/4.4/patch-4.4.164-rt176.patch.xz


You can also build from 4.4.162-rt175 by applying the incremental patch:

  
http://www.kernel.org/pub/linux/kernel/projects/rt/4.4/4.4/incr/patch-4.4.162-rt175-rt176.patch.xz

Enjoy!
   Daniel


[PATCH] [PATCH for v3.18] zram: close udev startup race condition as default groups

2018-11-22 Thread Minchan Kim
commit fef912bf860e upstream.
commit 98af4d4df889 upstream.

I got a report from Howard Chen that he saw zram and sysfs race(ie,
zram block device file is created but sysfs for it isn't yet)
when he tried to create new zram devices via hotadd knob.

v4.20 kernel fixes it by [1, 2] but it's too large size to merge
into -stable so this patch fixes the problem by registering defualt
group by Greg KH's approach[3].

This patch should be applied to every stable tree [3.16+] currently
existing from kernel.org because the problem was introduced at 2.6.37
by [4].

[1] fef912bf860e, block: genhd: add 'groups' argument to device_add_disk
[2] 98af4d4df889, zram: register default groups with device_add_disk()
[3] http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/
[4] 33863c21e69e9, Staging: zram: Replace ioctls with sysfs interface

Cc: Sergey Senozhatsky 
Cc: Hannes Reinecke 
Tested-by: Howard Chen 
Signed-off-by: Minchan Kim 
---
 drivers/block/zram/zram_drv.c | 18 ++
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 7e94459a489a..5f4e6a3c2dde 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -999,6 +999,11 @@ static struct attribute_group zram_disk_attr_group = {
.attrs = zram_disk_attrs,
 };
 
+static const struct attribute_group *zram_disk_attr_groups[] = {
+   _disk_attr_group,
+   NULL,
+};
+
 static int create_device(struct zram *zram, int device_id)
 {
int ret = -ENOMEM;
@@ -1060,22 +1065,14 @@ static int create_device(struct zram *zram, int 
device_id)
zram->disk->queue->limits.discard_zeroes_data = 0;
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, zram->disk->queue);
 
+   disk_to_dev(zram->disk)->groups = zram_disk_attr_groups;
add_disk(zram->disk);
 
-   ret = sysfs_create_group(_to_dev(zram->disk)->kobj,
-   _disk_attr_group);
-   if (ret < 0) {
-   pr_warn("Error creating sysfs group");
-   goto out_free_disk;
-   }
strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor));
zram->meta = NULL;
zram->max_comp_streams = 1;
return 0;
 
-out_free_disk:
-   del_gendisk(zram->disk);
-   put_disk(zram->disk);
 out_free_queue:
blk_cleanup_queue(zram->queue);
 out:
@@ -1084,9 +1081,6 @@ static int create_device(struct zram *zram, int device_id)
 
 static void destroy_device(struct zram *zram)
 {
-   sysfs_remove_group(_to_dev(zram->disk)->kobj,
-   _disk_attr_group);
-
del_gendisk(zram->disk);
put_disk(zram->disk);
 
-- 
2.20.0.rc0.387.gc7a69e6b6c-goog



[PATCH] [PATCH for v3.18] zram: close udev startup race condition as default groups

2018-11-22 Thread Minchan Kim
commit fef912bf860e upstream.
commit 98af4d4df889 upstream.

I got a report from Howard Chen that he saw zram and sysfs race(ie,
zram block device file is created but sysfs for it isn't yet)
when he tried to create new zram devices via hotadd knob.

v4.20 kernel fixes it by [1, 2] but it's too large size to merge
into -stable so this patch fixes the problem by registering defualt
group by Greg KH's approach[3].

This patch should be applied to every stable tree [3.16+] currently
existing from kernel.org because the problem was introduced at 2.6.37
by [4].

[1] fef912bf860e, block: genhd: add 'groups' argument to device_add_disk
[2] 98af4d4df889, zram: register default groups with device_add_disk()
[3] http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/
[4] 33863c21e69e9, Staging: zram: Replace ioctls with sysfs interface

Cc: Sergey Senozhatsky 
Cc: Hannes Reinecke 
Tested-by: Howard Chen 
Signed-off-by: Minchan Kim 
---
 drivers/block/zram/zram_drv.c | 18 ++
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 7e94459a489a..5f4e6a3c2dde 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -999,6 +999,11 @@ static struct attribute_group zram_disk_attr_group = {
.attrs = zram_disk_attrs,
 };
 
+static const struct attribute_group *zram_disk_attr_groups[] = {
+   _disk_attr_group,
+   NULL,
+};
+
 static int create_device(struct zram *zram, int device_id)
 {
int ret = -ENOMEM;
@@ -1060,22 +1065,14 @@ static int create_device(struct zram *zram, int 
device_id)
zram->disk->queue->limits.discard_zeroes_data = 0;
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, zram->disk->queue);
 
+   disk_to_dev(zram->disk)->groups = zram_disk_attr_groups;
add_disk(zram->disk);
 
-   ret = sysfs_create_group(_to_dev(zram->disk)->kobj,
-   _disk_attr_group);
-   if (ret < 0) {
-   pr_warn("Error creating sysfs group");
-   goto out_free_disk;
-   }
strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor));
zram->meta = NULL;
zram->max_comp_streams = 1;
return 0;
 
-out_free_disk:
-   del_gendisk(zram->disk);
-   put_disk(zram->disk);
 out_free_queue:
blk_cleanup_queue(zram->queue);
 out:
@@ -1084,9 +1081,6 @@ static int create_device(struct zram *zram, int device_id)
 
 static void destroy_device(struct zram *zram)
 {
-   sysfs_remove_group(_to_dev(zram->disk)->kobj,
-   _disk_attr_group);
-
del_gendisk(zram->disk);
put_disk(zram->disk);
 
-- 
2.20.0.rc0.387.gc7a69e6b6c-goog



[PATCH] [PATCH for v4.4] zram: close udev startup race condition as default groups

2018-11-22 Thread Minchan Kim
commit fef912bf860e upstream.
commit 98af4d4df889 upstream.

I got a report from Howard Chen that he saw zram and sysfs race(ie,
zram block device file is created but sysfs for it isn't yet)
when he tried to create new zram devices via hotadd knob.

v4.20 kernel fixes it by [1, 2] but it's too large size to merge
into -stable so this patch fixes the problem by registering defualt
group by Greg KH's approach[3].

This patch should be applied to every stable tree [3.16+] currently
existing from kernel.org because the problem was introduced at 2.6.37
by [4].

[1] fef912bf860e, block: genhd: add 'groups' argument to device_add_disk
[2] 98af4d4df889, zram: register default groups with device_add_disk()
[3] http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/
[4] 33863c21e69e9, Staging: zram: Replace ioctls with sysfs interface

Cc: Sergey Senozhatsky 
Cc: Hannes Reinecke 
Tested-by: Howard Chen 
Signed-off-by: Minchan Kim 
---
 drivers/block/zram/zram_drv.c | 26 ++
 1 file changed, 6 insertions(+), 20 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 502406c9e6e1..616ee4f9c233 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1184,6 +1184,11 @@ static struct attribute_group zram_disk_attr_group = {
.attrs = zram_disk_attrs,
 };
 
+static const struct attribute_group *zram_disk_attr_groups[] = {
+   _disk_attr_group,
+   NULL,
+};
+
 /*
  * Allocate and initialize new zram device. the function returns
  * '>= 0' device_id upon success, and negative value otherwise.
@@ -1264,15 +1269,9 @@ static int zram_add(void)
zram->disk->queue->limits.discard_zeroes_data = 0;
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, zram->disk->queue);
 
+   disk_to_dev(zram->disk)->groups = zram_disk_attr_groups;
add_disk(zram->disk);
 
-   ret = sysfs_create_group(_to_dev(zram->disk)->kobj,
-   _disk_attr_group);
-   if (ret < 0) {
-   pr_err("Error creating sysfs group for device %d\n",
-   device_id);
-   goto out_free_disk;
-   }
strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor));
zram->meta = NULL;
zram->max_comp_streams = 1;
@@ -1280,9 +1279,6 @@ static int zram_add(void)
pr_info("Added device: %s\n", zram->disk->disk_name);
return device_id;
 
-out_free_disk:
-   del_gendisk(zram->disk);
-   put_disk(zram->disk);
 out_free_queue:
blk_cleanup_queue(queue);
 out_free_idr:
@@ -1310,16 +1306,6 @@ static int zram_remove(struct zram *zram)
zram->claim = true;
mutex_unlock(>bd_mutex);
 
-   /*
-* Remove sysfs first, so no one will perform a disksize
-* store while we destroy the devices. This also helps during
-* hot_remove -- zram_reset_device() is the last holder of
-* ->init_lock, no later/concurrent disksize_store() or any
-* other sysfs handlers are possible.
-*/
-   sysfs_remove_group(_to_dev(zram->disk)->kobj,
-   _disk_attr_group);
-
/* Make sure all the pending I/O are finished */
fsync_bdev(bdev);
zram_reset_device(zram);
-- 
2.20.0.rc0.387.gc7a69e6b6c-goog



[PATCH] [PATCH for v4.4] zram: close udev startup race condition as default groups

2018-11-22 Thread Minchan Kim
commit fef912bf860e upstream.
commit 98af4d4df889 upstream.

I got a report from Howard Chen that he saw zram and sysfs race(ie,
zram block device file is created but sysfs for it isn't yet)
when he tried to create new zram devices via hotadd knob.

v4.20 kernel fixes it by [1, 2] but it's too large size to merge
into -stable so this patch fixes the problem by registering defualt
group by Greg KH's approach[3].

This patch should be applied to every stable tree [3.16+] currently
existing from kernel.org because the problem was introduced at 2.6.37
by [4].

[1] fef912bf860e, block: genhd: add 'groups' argument to device_add_disk
[2] 98af4d4df889, zram: register default groups with device_add_disk()
[3] http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/
[4] 33863c21e69e9, Staging: zram: Replace ioctls with sysfs interface

Cc: Sergey Senozhatsky 
Cc: Hannes Reinecke 
Tested-by: Howard Chen 
Signed-off-by: Minchan Kim 
---
 drivers/block/zram/zram_drv.c | 26 ++
 1 file changed, 6 insertions(+), 20 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 502406c9e6e1..616ee4f9c233 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1184,6 +1184,11 @@ static struct attribute_group zram_disk_attr_group = {
.attrs = zram_disk_attrs,
 };
 
+static const struct attribute_group *zram_disk_attr_groups[] = {
+   _disk_attr_group,
+   NULL,
+};
+
 /*
  * Allocate and initialize new zram device. the function returns
  * '>= 0' device_id upon success, and negative value otherwise.
@@ -1264,15 +1269,9 @@ static int zram_add(void)
zram->disk->queue->limits.discard_zeroes_data = 0;
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, zram->disk->queue);
 
+   disk_to_dev(zram->disk)->groups = zram_disk_attr_groups;
add_disk(zram->disk);
 
-   ret = sysfs_create_group(_to_dev(zram->disk)->kobj,
-   _disk_attr_group);
-   if (ret < 0) {
-   pr_err("Error creating sysfs group for device %d\n",
-   device_id);
-   goto out_free_disk;
-   }
strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor));
zram->meta = NULL;
zram->max_comp_streams = 1;
@@ -1280,9 +1279,6 @@ static int zram_add(void)
pr_info("Added device: %s\n", zram->disk->disk_name);
return device_id;
 
-out_free_disk:
-   del_gendisk(zram->disk);
-   put_disk(zram->disk);
 out_free_queue:
blk_cleanup_queue(queue);
 out_free_idr:
@@ -1310,16 +1306,6 @@ static int zram_remove(struct zram *zram)
zram->claim = true;
mutex_unlock(>bd_mutex);
 
-   /*
-* Remove sysfs first, so no one will perform a disksize
-* store while we destroy the devices. This also helps during
-* hot_remove -- zram_reset_device() is the last holder of
-* ->init_lock, no later/concurrent disksize_store() or any
-* other sysfs handlers are possible.
-*/
-   sysfs_remove_group(_to_dev(zram->disk)->kobj,
-   _disk_attr_group);
-
/* Make sure all the pending I/O are finished */
fsync_bdev(bdev);
zram_reset_device(zram);
-- 
2.20.0.rc0.387.gc7a69e6b6c-goog



[PATCH for 4.9] zram: close udev startup race condition as default groups

2018-11-22 Thread Minchan Kim
commit fef912bf860e upstream.
commit 98af4d4df889 upstream.

I got a report from Howard Chen that he saw zram and sysfs race(ie,
zram block device file is created but sysfs for it isn't yet)
when he tried to create new zram devices via hotadd knob.

v4.20 kernel fixes it by [1, 2] but it's too large size to merge
into -stable so this patch fixes the problem by registering defualt
group by Greg KH's approach[3].

This patch should be applied to every stable tree [3.16+] currently
existing from kernel.org because the problem was introduced at 2.6.37
by [4].

[1] fef912bf860e, block: genhd: add 'groups' argument to device_add_disk
[2] 98af4d4df889, zram: register default groups with device_add_disk()
[3] http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/
[4] 33863c21e69e9, Staging: zram: Replace ioctls with sysfs interface

Cc: Sergey Senozhatsky 
Cc: Hannes Reinecke 
Tested-by: Howard Chen 
Signed-off-by: Minchan Kim 
---
 drivers/block/zram/zram_drv.c | 26 ++
 1 file changed, 6 insertions(+), 20 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index b7c0b69a02f5..d64a53d3270a 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1223,6 +1223,11 @@ static struct attribute_group zram_disk_attr_group = {
.attrs = zram_disk_attrs,
 };
 
+static const struct attribute_group *zram_disk_attr_groups[] = {
+   _disk_attr_group,
+   NULL,
+};
+
 /*
  * Allocate and initialize new zram device. the function returns
  * '>= 0' device_id upon success, and negative value otherwise.
@@ -1303,24 +1308,15 @@ static int zram_add(void)
zram->disk->queue->limits.discard_zeroes_data = 0;
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, zram->disk->queue);
 
+   disk_to_dev(zram->disk)->groups = zram_disk_attr_groups;
add_disk(zram->disk);
 
-   ret = sysfs_create_group(_to_dev(zram->disk)->kobj,
-   _disk_attr_group);
-   if (ret < 0) {
-   pr_err("Error creating sysfs group for device %d\n",
-   device_id);
-   goto out_free_disk;
-   }
strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor));
zram->meta = NULL;
 
pr_info("Added device: %s\n", zram->disk->disk_name);
return device_id;
 
-out_free_disk:
-   del_gendisk(zram->disk);
-   put_disk(zram->disk);
 out_free_queue:
blk_cleanup_queue(queue);
 out_free_idr:
@@ -1348,16 +1344,6 @@ static int zram_remove(struct zram *zram)
zram->claim = true;
mutex_unlock(>bd_mutex);
 
-   /*
-* Remove sysfs first, so no one will perform a disksize
-* store while we destroy the devices. This also helps during
-* hot_remove -- zram_reset_device() is the last holder of
-* ->init_lock, no later/concurrent disksize_store() or any
-* other sysfs handlers are possible.
-*/
-   sysfs_remove_group(_to_dev(zram->disk)->kobj,
-   _disk_attr_group);
-
/* Make sure all the pending I/O are finished */
fsync_bdev(bdev);
zram_reset_device(zram);
-- 
2.20.0.rc0.387.gc7a69e6b6c-goog



[PATCH for 4.9] zram: close udev startup race condition as default groups

2018-11-22 Thread Minchan Kim
commit fef912bf860e upstream.
commit 98af4d4df889 upstream.

I got a report from Howard Chen that he saw zram and sysfs race(ie,
zram block device file is created but sysfs for it isn't yet)
when he tried to create new zram devices via hotadd knob.

v4.20 kernel fixes it by [1, 2] but it's too large size to merge
into -stable so this patch fixes the problem by registering defualt
group by Greg KH's approach[3].

This patch should be applied to every stable tree [3.16+] currently
existing from kernel.org because the problem was introduced at 2.6.37
by [4].

[1] fef912bf860e, block: genhd: add 'groups' argument to device_add_disk
[2] 98af4d4df889, zram: register default groups with device_add_disk()
[3] http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/
[4] 33863c21e69e9, Staging: zram: Replace ioctls with sysfs interface

Cc: Sergey Senozhatsky 
Cc: Hannes Reinecke 
Tested-by: Howard Chen 
Signed-off-by: Minchan Kim 
---
 drivers/block/zram/zram_drv.c | 26 ++
 1 file changed, 6 insertions(+), 20 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index b7c0b69a02f5..d64a53d3270a 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1223,6 +1223,11 @@ static struct attribute_group zram_disk_attr_group = {
.attrs = zram_disk_attrs,
 };
 
+static const struct attribute_group *zram_disk_attr_groups[] = {
+   _disk_attr_group,
+   NULL,
+};
+
 /*
  * Allocate and initialize new zram device. the function returns
  * '>= 0' device_id upon success, and negative value otherwise.
@@ -1303,24 +1308,15 @@ static int zram_add(void)
zram->disk->queue->limits.discard_zeroes_data = 0;
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, zram->disk->queue);
 
+   disk_to_dev(zram->disk)->groups = zram_disk_attr_groups;
add_disk(zram->disk);
 
-   ret = sysfs_create_group(_to_dev(zram->disk)->kobj,
-   _disk_attr_group);
-   if (ret < 0) {
-   pr_err("Error creating sysfs group for device %d\n",
-   device_id);
-   goto out_free_disk;
-   }
strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor));
zram->meta = NULL;
 
pr_info("Added device: %s\n", zram->disk->disk_name);
return device_id;
 
-out_free_disk:
-   del_gendisk(zram->disk);
-   put_disk(zram->disk);
 out_free_queue:
blk_cleanup_queue(queue);
 out_free_idr:
@@ -1348,16 +1344,6 @@ static int zram_remove(struct zram *zram)
zram->claim = true;
mutex_unlock(>bd_mutex);
 
-   /*
-* Remove sysfs first, so no one will perform a disksize
-* store while we destroy the devices. This also helps during
-* hot_remove -- zram_reset_device() is the last holder of
-* ->init_lock, no later/concurrent disksize_store() or any
-* other sysfs handlers are possible.
-*/
-   sysfs_remove_group(_to_dev(zram->disk)->kobj,
-   _disk_attr_group);
-
/* Make sure all the pending I/O are finished */
fsync_bdev(bdev);
zram_reset_device(zram);
-- 
2.20.0.rc0.387.gc7a69e6b6c-goog



[PATCH for v4.14] zram: close udev startup race condition as default groups

2018-11-22 Thread Minchan Kim
commit fef912bf860e upstream.
commit 98af4d4df889 upstream.

I got a report from Howard Chen that he saw zram and sysfs race(ie,
zram block device file is created but sysfs for it isn't yet)
when he tried to create new zram devices via hotadd knob.

v4.20 kernel fixes it by [1, 2] but it's too large size to merge
into -stable so this patch fixes the problem by registering defualt
group by Greg KH's approach[3].

This patch should be applied to every stable tree [3.16+] currently
existing from kernel.org because the problem was introduced at 2.6.37
by [4].

[1] fef912bf860e, block: genhd: add 'groups' argument to device_add_disk
[2] 98af4d4df889, zram: register default groups with device_add_disk()
[3] http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/
[4] 33863c21e69e9, Staging: zram: Replace ioctls with sysfs interface

Cc: Sergey Senozhatsky 
Cc: Hannes Reinecke 
Tested-by: Howard Chen 
Signed-off-by: Minchan Kim 
---
 drivers/block/zram/zram_drv.c | 26 ++
 1 file changed, 6 insertions(+), 20 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 1e2648e4c286..27b202c64c84 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1491,6 +1491,11 @@ static const struct attribute_group zram_disk_attr_group 
= {
.attrs = zram_disk_attrs,
 };
 
+static const struct attribute_group *zram_disk_attr_groups[] = {
+   _disk_attr_group,
+   NULL,
+};
+
 /*
  * Allocate and initialize new zram device. the function returns
  * '>= 0' device_id upon success, and negative value otherwise.
@@ -1568,23 +1573,14 @@ static int zram_add(void)
if (ZRAM_LOGICAL_BLOCK_SIZE == PAGE_SIZE)
blk_queue_max_write_zeroes_sectors(zram->disk->queue, UINT_MAX);
 
+   disk_to_dev(zram->disk)->groups = zram_disk_attr_groups;
add_disk(zram->disk);
 
-   ret = sysfs_create_group(_to_dev(zram->disk)->kobj,
-   _disk_attr_group);
-   if (ret < 0) {
-   pr_err("Error creating sysfs group for device %d\n",
-   device_id);
-   goto out_free_disk;
-   }
strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor));
 
pr_info("Added device: %s\n", zram->disk->disk_name);
return device_id;
 
-out_free_disk:
-   del_gendisk(zram->disk);
-   put_disk(zram->disk);
 out_free_queue:
blk_cleanup_queue(queue);
 out_free_idr:
@@ -1612,16 +1608,6 @@ static int zram_remove(struct zram *zram)
zram->claim = true;
mutex_unlock(>bd_mutex);
 
-   /*
-* Remove sysfs first, so no one will perform a disksize
-* store while we destroy the devices. This also helps during
-* hot_remove -- zram_reset_device() is the last holder of
-* ->init_lock, no later/concurrent disksize_store() or any
-* other sysfs handlers are possible.
-*/
-   sysfs_remove_group(_to_dev(zram->disk)->kobj,
-   _disk_attr_group);
-
/* Make sure all the pending I/O are finished */
fsync_bdev(bdev);
zram_reset_device(zram);
-- 
2.20.0.rc0.387.gc7a69e6b6c-goog



[PATCH for v4.14] zram: close udev startup race condition as default groups

2018-11-22 Thread Minchan Kim
commit fef912bf860e upstream.
commit 98af4d4df889 upstream.

I got a report from Howard Chen that he saw zram and sysfs race(ie,
zram block device file is created but sysfs for it isn't yet)
when he tried to create new zram devices via hotadd knob.

v4.20 kernel fixes it by [1, 2] but it's too large size to merge
into -stable so this patch fixes the problem by registering defualt
group by Greg KH's approach[3].

This patch should be applied to every stable tree [3.16+] currently
existing from kernel.org because the problem was introduced at 2.6.37
by [4].

[1] fef912bf860e, block: genhd: add 'groups' argument to device_add_disk
[2] 98af4d4df889, zram: register default groups with device_add_disk()
[3] http://kroah.com/log/blog/2013/06/26/how-to-create-a-sysfs-file-correctly/
[4] 33863c21e69e9, Staging: zram: Replace ioctls with sysfs interface

Cc: Sergey Senozhatsky 
Cc: Hannes Reinecke 
Tested-by: Howard Chen 
Signed-off-by: Minchan Kim 
---
 drivers/block/zram/zram_drv.c | 26 ++
 1 file changed, 6 insertions(+), 20 deletions(-)

diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index 1e2648e4c286..27b202c64c84 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -1491,6 +1491,11 @@ static const struct attribute_group zram_disk_attr_group 
= {
.attrs = zram_disk_attrs,
 };
 
+static const struct attribute_group *zram_disk_attr_groups[] = {
+   _disk_attr_group,
+   NULL,
+};
+
 /*
  * Allocate and initialize new zram device. the function returns
  * '>= 0' device_id upon success, and negative value otherwise.
@@ -1568,23 +1573,14 @@ static int zram_add(void)
if (ZRAM_LOGICAL_BLOCK_SIZE == PAGE_SIZE)
blk_queue_max_write_zeroes_sectors(zram->disk->queue, UINT_MAX);
 
+   disk_to_dev(zram->disk)->groups = zram_disk_attr_groups;
add_disk(zram->disk);
 
-   ret = sysfs_create_group(_to_dev(zram->disk)->kobj,
-   _disk_attr_group);
-   if (ret < 0) {
-   pr_err("Error creating sysfs group for device %d\n",
-   device_id);
-   goto out_free_disk;
-   }
strlcpy(zram->compressor, default_compressor, sizeof(zram->compressor));
 
pr_info("Added device: %s\n", zram->disk->disk_name);
return device_id;
 
-out_free_disk:
-   del_gendisk(zram->disk);
-   put_disk(zram->disk);
 out_free_queue:
blk_cleanup_queue(queue);
 out_free_idr:
@@ -1612,16 +1608,6 @@ static int zram_remove(struct zram *zram)
zram->claim = true;
mutex_unlock(>bd_mutex);
 
-   /*
-* Remove sysfs first, so no one will perform a disksize
-* store while we destroy the devices. This also helps during
-* hot_remove -- zram_reset_device() is the last holder of
-* ->init_lock, no later/concurrent disksize_store() or any
-* other sysfs handlers are possible.
-*/
-   sysfs_remove_group(_to_dev(zram->disk)->kobj,
-   _disk_attr_group);
-
/* Make sure all the pending I/O are finished */
fsync_bdev(bdev);
zram_reset_device(zram);
-- 
2.20.0.rc0.387.gc7a69e6b6c-goog



Re: [PATCH 4/6] zram: support idle page writeback

2018-11-22 Thread Minchan Kim
On Thu, Nov 22, 2018 at 03:59:26PM +0900, Sergey Senozhatsky wrote:
> On (11/22/18 15:31), Minchan Kim wrote:
> > > 
> > > I got what you mean now. Let's call it as "incompressible page wrieback"
> > > to prevent confusing.
> > > 
> > > "incompressible page writeback" would be orthgonal feature. The goal is
> > > "let's save memory at the cost of *latency*". If the page is swapped-in
> > > soon, it's unfortunate. However, the design expects once it's swapped out,
> > > it means it's non-workingset so soonish swappined-in would be rather not
> > > many, theoritically compared to other workingset.
> > > If's it's too frequent, it means system were heavily overcommitted.
> > 
> > Havid said, I agree it's not a good idea to enable incompressible page
> > writeback with idle page writeback. If you don't oppose, I want to add
> > new knob to "enable incompressible page writeback" so by default,
> > although we enable CONFIG_ZRAM_WRITEBACK, incompressible page writeback
> > is off until we enable the knob.
> > It would make some regressison if someone have used the feature but
> > I guess we are not too late.
> > 
> > What do you think?
> 
> Yes, totally works for me!
> 
> 
> "IDLE writeback" is superior to "incompressible writeback".
> 
> "incompressible writeback" is completely unpredictable and
> uncontrollable; it depens on data patterns and compression algorithms.
> While "IDLE writeback" is predictable.
> 
> I even suspect, that, *ideally*, we can remove "incompressible
> writeback". "IDLE pages" is a super set which also includes
> "incompressible" pages. So, technically, we still can do
> "incompressible writeback" from "IDLE writeback" path; but a much
> more reasonable one, based on a page idling period.
> 
> I understand that you want to keep "direct incompressible writeback"
> around. ZRAM is especially popular on devices which do suffer from
> flash wearout, so I can see "incompressible writeback" path becoming
> a dead code, long term.

Okay, both options makes regression if someone use it. Then, let's try
to remove it. It would make more clean with new idle writeback.

Thanks!



Re: [PATCH 4/6] zram: support idle page writeback

2018-11-22 Thread Minchan Kim
On Thu, Nov 22, 2018 at 03:59:26PM +0900, Sergey Senozhatsky wrote:
> On (11/22/18 15:31), Minchan Kim wrote:
> > > 
> > > I got what you mean now. Let's call it as "incompressible page wrieback"
> > > to prevent confusing.
> > > 
> > > "incompressible page writeback" would be orthgonal feature. The goal is
> > > "let's save memory at the cost of *latency*". If the page is swapped-in
> > > soon, it's unfortunate. However, the design expects once it's swapped out,
> > > it means it's non-workingset so soonish swappined-in would be rather not
> > > many, theoritically compared to other workingset.
> > > If's it's too frequent, it means system were heavily overcommitted.
> > 
> > Havid said, I agree it's not a good idea to enable incompressible page
> > writeback with idle page writeback. If you don't oppose, I want to add
> > new knob to "enable incompressible page writeback" so by default,
> > although we enable CONFIG_ZRAM_WRITEBACK, incompressible page writeback
> > is off until we enable the knob.
> > It would make some regressison if someone have used the feature but
> > I guess we are not too late.
> > 
> > What do you think?
> 
> Yes, totally works for me!
> 
> 
> "IDLE writeback" is superior to "incompressible writeback".
> 
> "incompressible writeback" is completely unpredictable and
> uncontrollable; it depens on data patterns and compression algorithms.
> While "IDLE writeback" is predictable.
> 
> I even suspect, that, *ideally*, we can remove "incompressible
> writeback". "IDLE pages" is a super set which also includes
> "incompressible" pages. So, technically, we still can do
> "incompressible writeback" from "IDLE writeback" path; but a much
> more reasonable one, based on a page idling period.
> 
> I understand that you want to keep "direct incompressible writeback"
> around. ZRAM is especially popular on devices which do suffer from
> flash wearout, so I can see "incompressible writeback" path becoming
> a dead code, long term.

Okay, both options makes regression if someone use it. Then, let's try
to remove it. It would make more clean with new idle writeback.

Thanks!



  1   2   3   4   5   6   7   8   9   10   >