general protection fault in kstrtouint

2018-08-11 Thread syzbot

Hello,

syzbot found the following crash on:

HEAD commit:2b769bb85b48 Add linux-next specific files for 20180807
git tree:   linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=1525beac40
kernel config:  https://syzkaller.appspot.com/x/.config?x=547d800b8773c2c5
dashboard link: https://syzkaller.appspot.com/bug?extid=657c927f261cbdd5c50f
compiler:   gcc (GCC) 8.0.1 20180413 (experimental)
syzkaller repro:https://syzkaller.appspot.com/x/repro.syz?x=170cdffc40
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=160f783040

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+657c927f261cbdd5c...@syzkaller.appspotmail.com

random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault:  [#1] SMP KASAN
CPU: 0 PID: 4328 Comm: syz-executor623 Not tainted  
4.18.0-rc8-next-20180807+ #33
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011

RIP: 0010:kstrtoull lib/kstrtox.c:123 [inline]
RIP: 0010:kstrtouint+0x83/0x1b0 lib/kstrtox.c:222
Code: f1 f1 c7 40 04 00 f2 f2 f2 65 48 8b 04 25 28 00 00 00 48 89 45 d0 31  
c0 e8 1a 31 18 fe 48 89 d8 48 89 da 48 c1 e8 03 83 e2 07 <42> 0f b6 04 30  
38 d0 7f 08 84 c0 0f 85 e8 00 00 00 44 0f b6 33 bf

RSP: 0018:8801ad63f888 EFLAGS: 00010246
RAX:  RBX:  RCX: 110035ac7f5f
RDX:  RSI: 8364fc96 RDI: 
RBP: 8801ad63f918 R08: 8801ad5da3c0 R09: 8801ad588580
R10: 900ed4cc R11: 8801db0236b3 R12: 110035ac7f12
R13: 8801ad63fa18 R14: dc00 R15: 8801ad63f8f0
FS:  01d3b880() GS:8801db00() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 7fbd50b94518 CR3: 0001c46c3000 CR4: 001406f0
DR0:  DR1:  DR2: 
DR3:  DR6: fffe0ff0 DR7: 0400
Call Trace:
 fs_parse+0xb8d/0x1130 fs/fs_parser.c:164
 hugetlbfs_parse_param+0xd1/0xa50 fs/hugetlbfs/inode.c:1210
 vfs_parse_fs_param+0x196/0x2c0 fs/fs_context.c:162
 vfs_parse_fs_string+0x1d5/0x2b0 fs/fs_context.c:191
 generic_parse_monolithic+0x17c/0x210 fs/fs_context.c:228
 parse_monolithic_mount_data fs/namespace.c:2320 [inline]
 do_new_mount fs/namespace.c:2599 [inline]
 do_mount+0x6d8/0x1e30 fs/namespace.c:2927
 ksys_mount+0x12d/0x140 fs/namespace.c:3143
 __do_sys_mount fs/namespace.c:3157 [inline]
 __se_sys_mount fs/namespace.c:3154 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3154
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4441a9
Code: 0d d8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7  
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff  
ff 0f 83 db d7 fb ff c3 66 2e 0f 1f 84 00 00 00 00

RSP: 002b:7ffcb4f5f8a8 EFLAGS: 0206 ORIG_RAX: 00a5
RAX: ffda RBX: 0030656c69662f2e RCX: 004441a9
RDX: 2300 RSI: 2340 RDI: 2000
RBP: 006cf018 R08: 21c0 R09: 21c0
R10:  R11: 0206 R12: 00401e10
R13: 00401ea0 R14:  R15: 
Modules linked in:
Dumping ftrace buffer:
   (ftrace buffer empty)
---[ end trace 3277e6ee2f78e7e4 ]---
RIP: 0010:kstrtoull lib/kstrtox.c:123 [inline]
RIP: 0010:kstrtouint+0x83/0x1b0 lib/kstrtox.c:222
Code: f1 f1 c7 40 04 00 f2 f2 f2 65 48 8b 04 25 28 00 00 00 48 89 45 d0 31  
c0 e8 1a 31 18 fe 48 89 d8 48 89 da 48 c1 e8 03 83 e2 07 <42> 0f b6 04 30  
38 d0 7f 08 84 c0 0f 85 e8 00 00 00 44 0f b6 33 bf

RSP: 0018:8801ad63f888 EFLAGS: 00010246
RAX:  RBX:  RCX: 110035ac7f5f
RDX:  RSI: 8364fc96 RDI: 
RBP: 8801ad63f918 R08: 8801ad5da3c0 R09: 8801ad588580
R10: 900ed4cc R11: 8801db0236b3 R12: 110035ac7f12
R13: 8801ad63fa18 R14: dc00 R15: 8801ad63f8f0
FS:  01d3b880() GS:8801db00() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 7fbd50b94518 CR3: 0001c46c3000 CR4: 001406f0
DR0:  DR1:  DR2: 
DR3:  DR6: fffe0ff0 DR7: 0400


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkal...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with  
syzbot.

syzbot can test patches for this bug, 

general protection fault in kstrtouint

2018-08-11 Thread syzbot

Hello,

syzbot found the following crash on:

HEAD commit:2b769bb85b48 Add linux-next specific files for 20180807
git tree:   linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=1525beac40
kernel config:  https://syzkaller.appspot.com/x/.config?x=547d800b8773c2c5
dashboard link: https://syzkaller.appspot.com/bug?extid=657c927f261cbdd5c50f
compiler:   gcc (GCC) 8.0.1 20180413 (experimental)
syzkaller repro:https://syzkaller.appspot.com/x/repro.syz?x=170cdffc40
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=160f783040

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+657c927f261cbdd5c...@syzkaller.appspotmail.com

random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault:  [#1] SMP KASAN
CPU: 0 PID: 4328 Comm: syz-executor623 Not tainted  
4.18.0-rc8-next-20180807+ #33
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011

RIP: 0010:kstrtoull lib/kstrtox.c:123 [inline]
RIP: 0010:kstrtouint+0x83/0x1b0 lib/kstrtox.c:222
Code: f1 f1 c7 40 04 00 f2 f2 f2 65 48 8b 04 25 28 00 00 00 48 89 45 d0 31  
c0 e8 1a 31 18 fe 48 89 d8 48 89 da 48 c1 e8 03 83 e2 07 <42> 0f b6 04 30  
38 d0 7f 08 84 c0 0f 85 e8 00 00 00 44 0f b6 33 bf

RSP: 0018:8801ad63f888 EFLAGS: 00010246
RAX:  RBX:  RCX: 110035ac7f5f
RDX:  RSI: 8364fc96 RDI: 
RBP: 8801ad63f918 R08: 8801ad5da3c0 R09: 8801ad588580
R10: 900ed4cc R11: 8801db0236b3 R12: 110035ac7f12
R13: 8801ad63fa18 R14: dc00 R15: 8801ad63f8f0
FS:  01d3b880() GS:8801db00() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 7fbd50b94518 CR3: 0001c46c3000 CR4: 001406f0
DR0:  DR1:  DR2: 
DR3:  DR6: fffe0ff0 DR7: 0400
Call Trace:
 fs_parse+0xb8d/0x1130 fs/fs_parser.c:164
 hugetlbfs_parse_param+0xd1/0xa50 fs/hugetlbfs/inode.c:1210
 vfs_parse_fs_param+0x196/0x2c0 fs/fs_context.c:162
 vfs_parse_fs_string+0x1d5/0x2b0 fs/fs_context.c:191
 generic_parse_monolithic+0x17c/0x210 fs/fs_context.c:228
 parse_monolithic_mount_data fs/namespace.c:2320 [inline]
 do_new_mount fs/namespace.c:2599 [inline]
 do_mount+0x6d8/0x1e30 fs/namespace.c:2927
 ksys_mount+0x12d/0x140 fs/namespace.c:3143
 __do_sys_mount fs/namespace.c:3157 [inline]
 __se_sys_mount fs/namespace.c:3154 [inline]
 __x64_sys_mount+0xbe/0x150 fs/namespace.c:3154
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4441a9
Code: 0d d8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7  
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff  
ff 0f 83 db d7 fb ff c3 66 2e 0f 1f 84 00 00 00 00

RSP: 002b:7ffcb4f5f8a8 EFLAGS: 0206 ORIG_RAX: 00a5
RAX: ffda RBX: 0030656c69662f2e RCX: 004441a9
RDX: 2300 RSI: 2340 RDI: 2000
RBP: 006cf018 R08: 21c0 R09: 21c0
R10:  R11: 0206 R12: 00401e10
R13: 00401ea0 R14:  R15: 
Modules linked in:
Dumping ftrace buffer:
   (ftrace buffer empty)
---[ end trace 3277e6ee2f78e7e4 ]---
RIP: 0010:kstrtoull lib/kstrtox.c:123 [inline]
RIP: 0010:kstrtouint+0x83/0x1b0 lib/kstrtox.c:222
Code: f1 f1 c7 40 04 00 f2 f2 f2 65 48 8b 04 25 28 00 00 00 48 89 45 d0 31  
c0 e8 1a 31 18 fe 48 89 d8 48 89 da 48 c1 e8 03 83 e2 07 <42> 0f b6 04 30  
38 d0 7f 08 84 c0 0f 85 e8 00 00 00 44 0f b6 33 bf

RSP: 0018:8801ad63f888 EFLAGS: 00010246
RAX:  RBX:  RCX: 110035ac7f5f
RDX:  RSI: 8364fc96 RDI: 
RBP: 8801ad63f918 R08: 8801ad5da3c0 R09: 8801ad588580
R10: 900ed4cc R11: 8801db0236b3 R12: 110035ac7f12
R13: 8801ad63fa18 R14: dc00 R15: 8801ad63f8f0
FS:  01d3b880() GS:8801db00() knlGS:
CS:  0010 DS:  ES:  CR0: 80050033
CR2: 7fbd50b94518 CR3: 0001c46c3000 CR4: 001406f0
DR0:  DR1:  DR2: 
DR3:  DR6: fffe0ff0 DR7: 0400


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkal...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with  
syzbot.

syzbot can test patches for this bug, 

[PATCH] tools/memory-model: Fix a couple of typos

2018-08-11 Thread SeongJae Park
This commit fixes a couple of typos in README and recipies.txt.

Signed-off-by: SeongJae Park 
---
 tools/memory-model/Documentation/recipes.txt | 2 +-
 tools/memory-model/README| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/memory-model/Documentation/recipes.txt 
b/tools/memory-model/Documentation/recipes.txt
index a40802fa1099..29df496c1c77 100644
--- a/tools/memory-model/Documentation/recipes.txt
+++ b/tools/memory-model/Documentation/recipes.txt
@@ -311,7 +311,7 @@ The smp_wmb() macro orders prior stores against later 
stores, and the
 smp_rmb() macro orders prior loads against later loads.  Therefore, if
 the final value of r0 is 1, the final value of r1 must also be 1.
 
-The the xlog_state_switch_iclogs() function in fs/xfs/xfs_log.c contains
+The xlog_state_switch_iclogs() function in fs/xfs/xfs_log.c contains
 the following write-side code fragment:
 
log->l_curr_block -= log->l_logBBsize;
diff --git a/tools/memory-model/README b/tools/memory-model/README
index ee987ce20aae..73313faf4036 100644
--- a/tools/memory-model/README
+++ b/tools/memory-model/README
@@ -89,7 +89,7 @@ The corresponding output includes:
   Observation SB+fencembonceonces Never 0 200
   Time SB+fencembonceonces 0.16
 
-The "Positive: 0 Negative: 200" and the "Never 0 200" indicate
+The "Positive: 0, Negative: 200" and the "Never 0 200" indicate
 that during two million trials, the state specified in this litmus
 test's "exists" clause was not reached.
 
-- 
2.13.0



[PATCH] tools/memory-model: Fix a couple of typos

2018-08-11 Thread SeongJae Park
This commit fixes a couple of typos in README and recipies.txt.

Signed-off-by: SeongJae Park 
---
 tools/memory-model/Documentation/recipes.txt | 2 +-
 tools/memory-model/README| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/memory-model/Documentation/recipes.txt 
b/tools/memory-model/Documentation/recipes.txt
index a40802fa1099..29df496c1c77 100644
--- a/tools/memory-model/Documentation/recipes.txt
+++ b/tools/memory-model/Documentation/recipes.txt
@@ -311,7 +311,7 @@ The smp_wmb() macro orders prior stores against later 
stores, and the
 smp_rmb() macro orders prior loads against later loads.  Therefore, if
 the final value of r0 is 1, the final value of r1 must also be 1.
 
-The the xlog_state_switch_iclogs() function in fs/xfs/xfs_log.c contains
+The xlog_state_switch_iclogs() function in fs/xfs/xfs_log.c contains
 the following write-side code fragment:
 
log->l_curr_block -= log->l_logBBsize;
diff --git a/tools/memory-model/README b/tools/memory-model/README
index ee987ce20aae..73313faf4036 100644
--- a/tools/memory-model/README
+++ b/tools/memory-model/README
@@ -89,7 +89,7 @@ The corresponding output includes:
   Observation SB+fencembonceonces Never 0 200
   Time SB+fencembonceonces 0.16
 
-The "Positive: 0 Negative: 200" and the "Never 0 200" indicate
+The "Positive: 0, Negative: 200" and the "Never 0 200" indicate
 that during two million trials, the state specified in this litmus
 test's "exists" clause was not reached.
 
-- 
2.13.0



Re: [PATCH] arm64: dts: sdm630 SoC and Sony Pioneer (Xperia XA2) support

2018-08-11 Thread kbuild test robot
Hi Craig,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on agross/for-next]
[also build test ERROR on v4.18-rc8 next-20180810]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Craig-Tatlor/arm64-dts-sdm630-SoC-and-Sony-Pioneer-Xperia-XA2-support/20180812-061913
base:   https://git.kernel.org/pub/scm/linux/kernel/git/agross/linux.git 
for-next
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=arm64 

All errors (new ones prefixed by >>):

   In file included from arch/arm64/boot/dts/qcom/sdm630-pioneer.dtsi:4:0,
from arch/arm64/boot/dts/qcom/sdm630-pioneer.dts:6:
>> arch/arm64/boot/dts/qcom/sdm630.dtsi:5:10: fatal error: 
>> dt-bindings/clock/qcom,gcc-sdm660.h: No such file or directory
#include 
 ^
   compilation terminated.

vim +5 arch/arm64/boot/dts/qcom/sdm630.dtsi

 3  
 4  #include 
   > 5  #include 
 6  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH] arm64: dts: sdm630 SoC and Sony Pioneer (Xperia XA2) support

2018-08-11 Thread kbuild test robot
Hi Craig,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on agross/for-next]
[also build test ERROR on v4.18-rc8 next-20180810]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Craig-Tatlor/arm64-dts-sdm630-SoC-and-Sony-Pioneer-Xperia-XA2-support/20180812-061913
base:   https://git.kernel.org/pub/scm/linux/kernel/git/agross/linux.git 
for-next
config: arm64-defconfig (attached as .config)
compiler: aarch64-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=arm64 

All errors (new ones prefixed by >>):

   In file included from arch/arm64/boot/dts/qcom/sdm630-pioneer.dtsi:4:0,
from arch/arm64/boot/dts/qcom/sdm630-pioneer.dts:6:
>> arch/arm64/boot/dts/qcom/sdm630.dtsi:5:10: fatal error: 
>> dt-bindings/clock/qcom,gcc-sdm660.h: No such file or directory
#include 
 ^
   compilation terminated.

vim +5 arch/arm64/boot/dts/qcom/sdm630.dtsi

 3  
 4  #include 
   > 5  #include 
 6  

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


[PATCH] f2fs-tools:: Use srcdir prefix to denote include path

2018-08-11 Thread Khem Raj
This helps builds when builddir != srcdir

Signed-off-by: Khem Raj 
---
 tools/sg_write_buffer/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/sg_write_buffer/Makefile.am 
b/tools/sg_write_buffer/Makefile.am
index 922c328..19c438d 100644
--- a/tools/sg_write_buffer/Makefile.am
+++ b/tools/sg_write_buffer/Makefile.am
@@ -1,7 +1,7 @@
 ## Makefile.am
 
 if LINUX
-AM_CPPFLAGS = -I./include
+AM_CPPFLAGS = -I$(srcdir)/include
 AM_CFLAGS = -Wall
 sbin_PROGRAMS = sg_write_buffer
 sg_write_buffer_SOURCES = sg_write_buffer.c \
-- 
2.18.0



GNU censorship hit me again = Fed up, I am just going to say this.

2018-08-11 Thread Ywe Cærlyn
GNU senorship hit me again, on Phoronix. This is LKML, a usenet mailing 
list. So lets try again here.


Linus Torvalds, Richard Stallman, and Andrew Tanenbaum all are 
pedophilia victims. And oddly enough think they are gods because of  this.


On Linux forums, fanboys attack, because they sympathize, with this 
pantheon.


In source, GNU zealousy and the same means among others

1000 HZ Kernel Patch.
10 ms filter in sched.c
and this is just from a quick look at source.

And Phoronix mails the list and Linus pulls patches from the kernel, 
without knowing what they were, based on average performance testing. 
Average performance in a lot of cases, is not important, but rather peak 
 jitter. Gettig peak jitter down, means best performance, or "average 
performance" will not even be displayed on screen, because of jitter 
bottlenecks.


And in earlier "ricer" (abuse victim slang?) discussions it is 
supposedly obvious that turning certain optimizations on is useless. Yet 
 nobody sees "defer pop" being on, as usless, that only contributes 
jitter.


Obviously this is poor patching, poor understanding, and a poor 
internet. And LKML still is ascii, when most of the world has moved to 
better technology. Better technology, with more ID, for less obscure 
behaviour.


Will Linus scubadiving help?

No.

Tanenbaum writing books with circus on them?

No.

Stallman dancing strange dances?

No.

What is needed is a coherent monotheistic philosophy. That is where 
civilization comes from, and a good word to all, also abuse victims, 
that this is not about abuse. Neither communism, nor facism.


I am even trying a zén-concept for maximal desirelessness.

"Hacker"-space was actually already quite monotheistic. And it was never 
 intended to be poor, neither spiritually nor financially.


This is what needs to happen in computing space. Obviously.

A good and moral behaviour pattern, an adhérance to religion that 
teaches monotheism. Overriding vain egoes, and diciplining it to 
understand reality, and society at large.


I hope you understand.

Peace.

www.nyt.cloud


[PATCH] f2fs-tools:: Use srcdir prefix to denote include path

2018-08-11 Thread Khem Raj
This helps builds when builddir != srcdir

Signed-off-by: Khem Raj 
---
 tools/sg_write_buffer/Makefile.am | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/sg_write_buffer/Makefile.am 
b/tools/sg_write_buffer/Makefile.am
index 922c328..19c438d 100644
--- a/tools/sg_write_buffer/Makefile.am
+++ b/tools/sg_write_buffer/Makefile.am
@@ -1,7 +1,7 @@
 ## Makefile.am
 
 if LINUX
-AM_CPPFLAGS = -I./include
+AM_CPPFLAGS = -I$(srcdir)/include
 AM_CFLAGS = -Wall
 sbin_PROGRAMS = sg_write_buffer
 sg_write_buffer_SOURCES = sg_write_buffer.c \
-- 
2.18.0



GNU censorship hit me again = Fed up, I am just going to say this.

2018-08-11 Thread Ywe Cærlyn
GNU senorship hit me again, on Phoronix. This is LKML, a usenet mailing 
list. So lets try again here.


Linus Torvalds, Richard Stallman, and Andrew Tanenbaum all are 
pedophilia victims. And oddly enough think they are gods because of  this.


On Linux forums, fanboys attack, because they sympathize, with this 
pantheon.


In source, GNU zealousy and the same means among others

1000 HZ Kernel Patch.
10 ms filter in sched.c
and this is just from a quick look at source.

And Phoronix mails the list and Linus pulls patches from the kernel, 
without knowing what they were, based on average performance testing. 
Average performance in a lot of cases, is not important, but rather peak 
 jitter. Gettig peak jitter down, means best performance, or "average 
performance" will not even be displayed on screen, because of jitter 
bottlenecks.


And in earlier "ricer" (abuse victim slang?) discussions it is 
supposedly obvious that turning certain optimizations on is useless. Yet 
 nobody sees "defer pop" being on, as usless, that only contributes 
jitter.


Obviously this is poor patching, poor understanding, and a poor 
internet. And LKML still is ascii, when most of the world has moved to 
better technology. Better technology, with more ID, for less obscure 
behaviour.


Will Linus scubadiving help?

No.

Tanenbaum writing books with circus on them?

No.

Stallman dancing strange dances?

No.

What is needed is a coherent monotheistic philosophy. That is where 
civilization comes from, and a good word to all, also abuse victims, 
that this is not about abuse. Neither communism, nor facism.


I am even trying a zén-concept for maximal desirelessness.

"Hacker"-space was actually already quite monotheistic. And it was never 
 intended to be poor, neither spiritually nor financially.


This is what needs to happen in computing space. Obviously.

A good and moral behaviour pattern, an adhérance to religion that 
teaches monotheism. Overriding vain egoes, and diciplining it to 
understand reality, and society at large.


I hope you understand.

Peace.

www.nyt.cloud


Sehr geehrte / r Fondsempfänger

2018-08-11 Thread ANWALTSKANZLEI JULIA SCHNEIDER & CO.







ANWALTSKANZLEI JULIA SCHNEIDER & CO.
AV/DE GRAN VIA NO.38, 28008 MADRID. SPAIN
TEL.+34 638 580 441. FAX: +34 931-702-120
E-MAIL: infoofic...@collector.org
Eingetragener Fall NR: UNCCORG / KA749IMF
Sehr geehrte / r Fondsempfänger / E-Mail-Adresse Eigentümer,

Abschließende Mitteilung für die Zahlung des nicht beanspruchten Preisgeldes
Dies soll Sie offiziell darüber informieren, dass wir Ihnen schon
geschrieben haben, ohne von Ihnen zu antworten. Tatsächlich glauben wir,
dass unsere vorherige Post Ihnen nicht erhalten hat, deshalb schreiben wir
Ihnen wieder.

Wir möchten Sie informieren, dass das Büro des nicht Beanspruchten
Preisgeldes in Spanien, unsere Anwaltskanzlei ernannt hat,als gesetzliche
Berater zu handeln, in der Verarbeitung und der Zahlung eines Preisgeldes,
das auf Ihrem Namen gutgeschriebenwurde, und nun seit über zwei Jahren
nicht beansprucht wurde..

Der Gesamtbetrag, auf den Sie Anspruch haben, beträgt derzeit
1.250.000,00€. Das ursprüngliche Preisgeld hat sich aufgrund mangelnder
Reklamation erhöht. Diese Summe wurde nun mehr als zwei Jahre in den
Gewinn investiert, daher die Erhöhung auf den oben genannten Gesamtbetrag.
Nach Angaben des Büros der nicht beanspruchten Preisgelder wurde dieses
Geld als nicht beanspruchter Gewinn einer Lotteriegesellschaft bei ihnen
deponiert, um sie in ihrem Namen zu verwalten und zu versichern. Laut der
Lotteriegesellschaft wurde das Geld nach einer Sommerpromotionslotterie an
sie vergeben..

 Die Kupons wurden von einer Investmentgesellschaft gekauft.Nach Ansicht
der Lotteriefirma wurden sie damals Angeschrieben um Sie über dieses Geld
zu informieren, es hat sich aber leider bis zum Ablauf der gesetzten
Frist keiner gemeldet um den Gewinn zu Beanspruchen.. Dieses war der
Grund weshalb das Geld zum verwalten niedergelegt wurde. Gemäß des
Spanischen Gesetzes muss der inhaber alle zwei Jahre über seinen
vorhanden Gewinn informiert werden. Sollte dass Geld wieder nicht
beansprucht warden, wird der Gewinn abermals über eine
Investmentgesellschaft für eine weitere Periode von zwei Jahren angelegt
werden.Wir sind daher, durch das Büro des nicht Beanspruchten Preisgelds
beauftragt worden sie anzuschreiben. Dies ist eine Notifikation für das
Beanspruchen dieses Gelds

 Wir möchten sie darauf hinweisen, dass die Lotterie Gesellschaft
überprüfen und bestätigen wird ob ihre Identität übereinstimmt bevor
ihnen ihr Geld  ausbezahlt wird. Wir werden sie beraten wie sie ihren
Anspruch geltend machen.Bitte setztzen sie sich dafuer mit unserer
Deutsch Sprachigen  Rechtsanwaeltin in Verbindung Dr.Julia Schneider
TEL.+34-638-580 441.
FAX:+34-931-702-120.Email:julia.schin...@europemail.com  ist  zustaendig
für Auszahlungen ins Ausland und wird ihnen in dieser sache zur seite
stehen. Der Anspruch sollte vor den 30-08-2018 geltend gemacht  werden,da
sonst dass Geld wieder angelegt werden wuerde.Wir freuen uns, von Ihnen
zu hören, während wir Ihnen unsere Rechtshilfe Versichern.

Mitfreundlichen Grüßen
DR. JULIA SCHNEIDER
ANWALT.

ANMELDEFORMULAR FÜR DEN GEWINNANSPRUCH VOM 09th August bos 30th August
2018 Bitte geben Sie die folgenden Informationen, wie unten gefordert,
faxen es order email zurück in mein Büro sofort für uns in der Lage zu
sein die Legalisierung  Prozess Ihrer Personliche investiertes Preisgeld
zu vervollständigen, und das Geld wird Ihnen von der Mutual Finance Bank
ausgezahlt. Alle Prozess  Überprüfung durch unsere Kanzlei ist für Sie
kostenlos, weil unsere Kosten werden von der internationalen Lotto
Kommission am Ende des Prozesses  zu zahlen, wenn Sie Ihr Geld
erhalten.Wenn Sie nicht die erforderlichen Informationen vor der Zeit
gegeben hat, können ist Anwaltskanzlei nicht  haftbar gemacht werden, wenn
Ihr Geld reinvestiert wurde.

Ein Bestätigungsschreiben wird Ihnen gefaxt werden sofort wenn wir
komplette Überprüfung der Informationen die Sie uns zur Verfügung stellen
habe,  Ich werde die Investmentbank unverzüglich über die von Ihnen
angegebene Informationen zu kommen, bevor sie werden mit Ihnen Kontakt 
aufnehmen für die aus Zahlung von Ihrem Geld . Ihre Daten werden
vertraulich gehalten nach der Europäischen Unionn Datenschutzrecht.
Private E-Mail  julia.schin...@europemail.com

Name:___Vorname:__
Referenz:AKXD01//17/ESP: *Gewinn-Summe:___
Adresse___
Straße:__PLZ: /Ort:___
Wohnort:__Geburtsdatum:___
Nationalität:__Beruf:_
Telefon:__Mobiltelefon:___
E-Email:__

ZAHLUNG OPTION: A/ BANKUBERWEISUNG B/ BARSCHECK
(BANKDATEN SIND NUR NOTWENDIG WENN SIE SICH FUR EINE BANKUBERWEISUNG
ENTSCHIEDEN HABEN)12.
Barscheck:_

13. Bankuberweisung:

14.BANKADDRESS:__

Rechtsanwältin Julia & Asociados, Abogados, 

Sehr geehrte / r Fondsempfänger

2018-08-11 Thread ANWALTSKANZLEI JULIA SCHNEIDER & CO.







ANWALTSKANZLEI JULIA SCHNEIDER & CO.
AV/DE GRAN VIA NO.38, 28008 MADRID. SPAIN
TEL.+34 638 580 441. FAX: +34 931-702-120
E-MAIL: infoofic...@collector.org
Eingetragener Fall NR: UNCCORG / KA749IMF
Sehr geehrte / r Fondsempfänger / E-Mail-Adresse Eigentümer,

Abschließende Mitteilung für die Zahlung des nicht beanspruchten Preisgeldes
Dies soll Sie offiziell darüber informieren, dass wir Ihnen schon
geschrieben haben, ohne von Ihnen zu antworten. Tatsächlich glauben wir,
dass unsere vorherige Post Ihnen nicht erhalten hat, deshalb schreiben wir
Ihnen wieder.

Wir möchten Sie informieren, dass das Büro des nicht Beanspruchten
Preisgeldes in Spanien, unsere Anwaltskanzlei ernannt hat,als gesetzliche
Berater zu handeln, in der Verarbeitung und der Zahlung eines Preisgeldes,
das auf Ihrem Namen gutgeschriebenwurde, und nun seit über zwei Jahren
nicht beansprucht wurde..

Der Gesamtbetrag, auf den Sie Anspruch haben, beträgt derzeit
1.250.000,00€. Das ursprüngliche Preisgeld hat sich aufgrund mangelnder
Reklamation erhöht. Diese Summe wurde nun mehr als zwei Jahre in den
Gewinn investiert, daher die Erhöhung auf den oben genannten Gesamtbetrag.
Nach Angaben des Büros der nicht beanspruchten Preisgelder wurde dieses
Geld als nicht beanspruchter Gewinn einer Lotteriegesellschaft bei ihnen
deponiert, um sie in ihrem Namen zu verwalten und zu versichern. Laut der
Lotteriegesellschaft wurde das Geld nach einer Sommerpromotionslotterie an
sie vergeben..

 Die Kupons wurden von einer Investmentgesellschaft gekauft.Nach Ansicht
der Lotteriefirma wurden sie damals Angeschrieben um Sie über dieses Geld
zu informieren, es hat sich aber leider bis zum Ablauf der gesetzten
Frist keiner gemeldet um den Gewinn zu Beanspruchen.. Dieses war der
Grund weshalb das Geld zum verwalten niedergelegt wurde. Gemäß des
Spanischen Gesetzes muss der inhaber alle zwei Jahre über seinen
vorhanden Gewinn informiert werden. Sollte dass Geld wieder nicht
beansprucht warden, wird der Gewinn abermals über eine
Investmentgesellschaft für eine weitere Periode von zwei Jahren angelegt
werden.Wir sind daher, durch das Büro des nicht Beanspruchten Preisgelds
beauftragt worden sie anzuschreiben. Dies ist eine Notifikation für das
Beanspruchen dieses Gelds

 Wir möchten sie darauf hinweisen, dass die Lotterie Gesellschaft
überprüfen und bestätigen wird ob ihre Identität übereinstimmt bevor
ihnen ihr Geld  ausbezahlt wird. Wir werden sie beraten wie sie ihren
Anspruch geltend machen.Bitte setztzen sie sich dafuer mit unserer
Deutsch Sprachigen  Rechtsanwaeltin in Verbindung Dr.Julia Schneider
TEL.+34-638-580 441.
FAX:+34-931-702-120.Email:julia.schin...@europemail.com  ist  zustaendig
für Auszahlungen ins Ausland und wird ihnen in dieser sache zur seite
stehen. Der Anspruch sollte vor den 30-08-2018 geltend gemacht  werden,da
sonst dass Geld wieder angelegt werden wuerde.Wir freuen uns, von Ihnen
zu hören, während wir Ihnen unsere Rechtshilfe Versichern.

Mitfreundlichen Grüßen
DR. JULIA SCHNEIDER
ANWALT.

ANMELDEFORMULAR FÜR DEN GEWINNANSPRUCH VOM 09th August bos 30th August
2018 Bitte geben Sie die folgenden Informationen, wie unten gefordert,
faxen es order email zurück in mein Büro sofort für uns in der Lage zu
sein die Legalisierung  Prozess Ihrer Personliche investiertes Preisgeld
zu vervollständigen, und das Geld wird Ihnen von der Mutual Finance Bank
ausgezahlt. Alle Prozess  Überprüfung durch unsere Kanzlei ist für Sie
kostenlos, weil unsere Kosten werden von der internationalen Lotto
Kommission am Ende des Prozesses  zu zahlen, wenn Sie Ihr Geld
erhalten.Wenn Sie nicht die erforderlichen Informationen vor der Zeit
gegeben hat, können ist Anwaltskanzlei nicht  haftbar gemacht werden, wenn
Ihr Geld reinvestiert wurde.

Ein Bestätigungsschreiben wird Ihnen gefaxt werden sofort wenn wir
komplette Überprüfung der Informationen die Sie uns zur Verfügung stellen
habe,  Ich werde die Investmentbank unverzüglich über die von Ihnen
angegebene Informationen zu kommen, bevor sie werden mit Ihnen Kontakt 
aufnehmen für die aus Zahlung von Ihrem Geld . Ihre Daten werden
vertraulich gehalten nach der Europäischen Unionn Datenschutzrecht.
Private E-Mail  julia.schin...@europemail.com

Name:___Vorname:__
Referenz:AKXD01//17/ESP: *Gewinn-Summe:___
Adresse___
Straße:__PLZ: /Ort:___
Wohnort:__Geburtsdatum:___
Nationalität:__Beruf:_
Telefon:__Mobiltelefon:___
E-Email:__

ZAHLUNG OPTION: A/ BANKUBERWEISUNG B/ BARSCHECK
(BANKDATEN SIND NUR NOTWENDIG WENN SIE SICH FUR EINE BANKUBERWEISUNG
ENTSCHIEDEN HABEN)12.
Barscheck:_

13. Bankuberweisung:

14.BANKADDRESS:__

Rechtsanwältin Julia & Asociados, Abogados, 

Re: [PATCH] x86/PCI: Claim the resources of firmware enabled IOAPIC before children bus

2018-08-11 Thread joeyli
On Fri, Aug 10, 2018 at 08:58:37AM -0500, Bjorn Helgaas wrote:
> On Fri, Aug 10, 2018 at 05:25:01PM +0800, joeyli wrote:
> > On Wed, Aug 08, 2018 at 04:23:22PM -0500, Bjorn Helgaas wrote:
> > ...
[...snip]
> > hm... I have another question that it may not relates to this issue. I
> > was tracing the code path of PCI hot-remove/hotplug. Base on spec, looks
> > that the RST# should be asserted when hot-remove. And the memory decode
> > bit must be set to zero after RST# be asserted. But I didn't see that
> > any kernel PCI/ACPI code set RST#. The only possible code to set RST# is
> > in POWER architecture. Do you know who assert the RST# when hot-remove?
> 
> RST# is a conventional PCI signal (not a PCIe signal).  In any case, I
> would expect signals like that to be handled by hardware, not by
> software.  What section of the spec are you looking at?  I wouldn't

In PCI Hot-Plug Spec v1.1

2.2.1 Hot Removal
The Hot-Plug System Driver uses the Hot-Plug Controller to do the following:
a) Assert RST# to the slot and isolate the slot from the rest of the bus, in
   either order.
b) Power down the slot.
c) Change the optional slot-state indicator, as defined in Section 3.1.1, to 
show
   that the slot is off.

In the above description, it said that "Hot-Plug System Driver" should done
the job. So I was think that kernel driver must asserts RST#, but I didn't
find that in kernel code.

Then, in PCI Local Bus spec v2.2, it mentions:

Table 6-1: Command Register Bits
Bit LocationDescription
0   ...State after RST# is 0.
1   ...State after RST# is 0.

So, after hot-remove the RST# must be asserted and the IO/memory
decode bit should also be set to zero.

I was tracing the kerenl hot-remove code for RST# because I
want to make sure that kernel didn't change the RST# state from
firmware.

> expect any requirements for doing things to a device when the device
> is being hot-removed, since the device may already be inaccessible,
> e.g., physically unreachable.

I see! It makes sense.

But I still confused about the "Hot-Plug System Driver" wording in
PCI Hot-Plug Spec. The "Hot-Plug System Driver " means a kernel
driver?

> 
> On a hot-*add*, there would of course be requirements about how the
> device powers up and comes out of reset.  For native drivers like
> pciehp/shpcpd/etc, there are often ways for software to control power
> to the slot, e.g., the "Power Controller Control" bit in the PCIe Slot
> Control register.
> 
> For ACPI-mediated hotplug (as in your situation), the actual hardware
> details are handled by the firmware and all the OS sees are things
> like ACPI Notify events and it uses methods like _STA and other things
> mentioned in ACPI v6.2, sec 6.3.
> 
> > > What are the chances of getting a firmware fix?  Has this firmware
> > > already shipped to customers?
> > 
> > The good news is that the machine has not shipped yet. As I know
> > that manufacturer is also finding the root cause for why firmware
> > enabled memory decode bit and also set the wrong addresses.
> 
> I don't think it's necessarily a problem that firmware enables the
> IOAPIC.  This is ACPI-mediated hotplug and it looks like it adds CPUs,
> memory, and I/O.  I wouldn't be surprised if the firmware has to make
> the IOAPIC operational to make some parts of the hot-add work.
> 
> The address conflict is the real problem.

Thanks for your explanation. It's really useful to me.

Thanks a lot!
Joey Lee


Re: [PATCH] x86/PCI: Claim the resources of firmware enabled IOAPIC before children bus

2018-08-11 Thread joeyli
On Fri, Aug 10, 2018 at 08:58:37AM -0500, Bjorn Helgaas wrote:
> On Fri, Aug 10, 2018 at 05:25:01PM +0800, joeyli wrote:
> > On Wed, Aug 08, 2018 at 04:23:22PM -0500, Bjorn Helgaas wrote:
> > ...
[...snip]
> > hm... I have another question that it may not relates to this issue. I
> > was tracing the code path of PCI hot-remove/hotplug. Base on spec, looks
> > that the RST# should be asserted when hot-remove. And the memory decode
> > bit must be set to zero after RST# be asserted. But I didn't see that
> > any kernel PCI/ACPI code set RST#. The only possible code to set RST# is
> > in POWER architecture. Do you know who assert the RST# when hot-remove?
> 
> RST# is a conventional PCI signal (not a PCIe signal).  In any case, I
> would expect signals like that to be handled by hardware, not by
> software.  What section of the spec are you looking at?  I wouldn't

In PCI Hot-Plug Spec v1.1

2.2.1 Hot Removal
The Hot-Plug System Driver uses the Hot-Plug Controller to do the following:
a) Assert RST# to the slot and isolate the slot from the rest of the bus, in
   either order.
b) Power down the slot.
c) Change the optional slot-state indicator, as defined in Section 3.1.1, to 
show
   that the slot is off.

In the above description, it said that "Hot-Plug System Driver" should done
the job. So I was think that kernel driver must asserts RST#, but I didn't
find that in kernel code.

Then, in PCI Local Bus spec v2.2, it mentions:

Table 6-1: Command Register Bits
Bit LocationDescription
0   ...State after RST# is 0.
1   ...State after RST# is 0.

So, after hot-remove the RST# must be asserted and the IO/memory
decode bit should also be set to zero.

I was tracing the kerenl hot-remove code for RST# because I
want to make sure that kernel didn't change the RST# state from
firmware.

> expect any requirements for doing things to a device when the device
> is being hot-removed, since the device may already be inaccessible,
> e.g., physically unreachable.

I see! It makes sense.

But I still confused about the "Hot-Plug System Driver" wording in
PCI Hot-Plug Spec. The "Hot-Plug System Driver " means a kernel
driver?

> 
> On a hot-*add*, there would of course be requirements about how the
> device powers up and comes out of reset.  For native drivers like
> pciehp/shpcpd/etc, there are often ways for software to control power
> to the slot, e.g., the "Power Controller Control" bit in the PCIe Slot
> Control register.
> 
> For ACPI-mediated hotplug (as in your situation), the actual hardware
> details are handled by the firmware and all the OS sees are things
> like ACPI Notify events and it uses methods like _STA and other things
> mentioned in ACPI v6.2, sec 6.3.
> 
> > > What are the chances of getting a firmware fix?  Has this firmware
> > > already shipped to customers?
> > 
> > The good news is that the machine has not shipped yet. As I know
> > that manufacturer is also finding the root cause for why firmware
> > enabled memory decode bit and also set the wrong addresses.
> 
> I don't think it's necessarily a problem that firmware enables the
> IOAPIC.  This is ACPI-mediated hotplug and it looks like it adds CPUs,
> memory, and I/O.  I wouldn't be surprised if the firmware has to make
> the IOAPIC operational to make some parts of the hot-add work.
> 
> The address conflict is the real problem.

Thanks for your explanation. It's really useful to me.

Thanks a lot!
Joey Lee


Re: [PATCH 28/33] vfs: syscall: Add fsconfig() for configuring and managing a context [ver #11]

2018-08-11 Thread Andy Lutomirski
On Sat, Aug 11, 2018 at 1:20 PM, David Howells  wrote:
> Miklos Szeredi  wrote:
>
>> You can determine at fsopen() time whether the filesystem is able to
>> support the O_EXCL behavior?  If so, then it's trivial to enable this
>> conditionally.  I think that's what Eric is asking for, it's obviously
>> not fair to ask for a change in behavior of the legacy interface.
>
> It's not trivial, see btrfs and nfs :-/
>

I'm not convinced that btrfs and nfs are the same situation.  As far
as I can tell, in NFS's case, NFS shares superblocks as an
implementation detail.  With Al's example, someone can do:

mount -t nfs4 wank.example.org:/foo/bar /mnt/a
mount -t nfs4 wank.example.org:/baz/barf /mnt/b
mount -t nfs4 wank.example.org:/foo/bar -o wsize=16384 /mnt/c

or equivalently create three fscontexts and FSCONFIG_CMD_CREATE all of
them, and the kernel creates one superblock for /mnt/a and /mnt/b and
a second one for /mnt/c.  That seems like a good optimization, but I
think it really is just an optimization.  In any sane implementation,
all three calls should succeed, and it should in general be possible
to create as many totally fresh mounts of the same network file system
as anyone wants.

Given this example, I think that it may be important to give
FSCONFIG_CMD_RECONFIGURE a very clear definition, and possibly a
definition that doesn't use the word superblock.  After all, if
someone does FSCONFIG_CMD_RECONFIGURE on /mnt/a, if it really
reconfigures a *superblock*, then it will change /mnt/b as a side
effect but will not change /mnt/c.  This seems like a mistake.

But I think that btrfs is quite a bit different.  With btrfs, I can do:

mount -t btrfs /dev/sda1 -o subvol=a /mnt/a
mount -t btrfs /dev/sda1 -o subvol=b /mnt/b

and I get two mounts, each pointing at a different subvolume, that
(I'm pretty sure) share a superblock

mount -t btrfs /dev/sda1 -o subvol=c,foo=bar /mnt/c

where foo is a per-superblock option, it probably gets ignored.  If I
set up /dev/mapper/foo as a linear alias for /dev/sda1 and I do:

mount -t btrfs /dev/mapper/foo -o subvol=d /mnt/d

then I get a fresh superblock.  If /dev/sda1 is still mounted and the
various O_EXCL-like checks don'e catch it, then I get massive
corruption.

The btrfs case seems quite fragile to me, and it seems like a bit of
an abuse of mount(2).  (Of course, basically everything anyone does
with mount(2) is a bit of an abuse.)

I would hope that the new fs mounting API would clean this up.  The
NFS case seems just fine, but for btrfs, it seems like maybe the whole
CMD_CREATE operation should be more fine grained.  There seem to be
*two* actions going on in a btrfs mount.  First there's the act of
instantiating the filesystem driver backed by the device (I think this
is open_ctree()), and *then* there's the act of instantiating a dentry
tree pointing at some subvolume, etc.

ZFS seems to handle this quite nicely.  First you fire up a zpool, and
then you start mounting its volumes.


Re: [PATCH 28/33] vfs: syscall: Add fsconfig() for configuring and managing a context [ver #11]

2018-08-11 Thread Andy Lutomirski
On Sat, Aug 11, 2018 at 1:20 PM, David Howells  wrote:
> Miklos Szeredi  wrote:
>
>> You can determine at fsopen() time whether the filesystem is able to
>> support the O_EXCL behavior?  If so, then it's trivial to enable this
>> conditionally.  I think that's what Eric is asking for, it's obviously
>> not fair to ask for a change in behavior of the legacy interface.
>
> It's not trivial, see btrfs and nfs :-/
>

I'm not convinced that btrfs and nfs are the same situation.  As far
as I can tell, in NFS's case, NFS shares superblocks as an
implementation detail.  With Al's example, someone can do:

mount -t nfs4 wank.example.org:/foo/bar /mnt/a
mount -t nfs4 wank.example.org:/baz/barf /mnt/b
mount -t nfs4 wank.example.org:/foo/bar -o wsize=16384 /mnt/c

or equivalently create three fscontexts and FSCONFIG_CMD_CREATE all of
them, and the kernel creates one superblock for /mnt/a and /mnt/b and
a second one for /mnt/c.  That seems like a good optimization, but I
think it really is just an optimization.  In any sane implementation,
all three calls should succeed, and it should in general be possible
to create as many totally fresh mounts of the same network file system
as anyone wants.

Given this example, I think that it may be important to give
FSCONFIG_CMD_RECONFIGURE a very clear definition, and possibly a
definition that doesn't use the word superblock.  After all, if
someone does FSCONFIG_CMD_RECONFIGURE on /mnt/a, if it really
reconfigures a *superblock*, then it will change /mnt/b as a side
effect but will not change /mnt/c.  This seems like a mistake.

But I think that btrfs is quite a bit different.  With btrfs, I can do:

mount -t btrfs /dev/sda1 -o subvol=a /mnt/a
mount -t btrfs /dev/sda1 -o subvol=b /mnt/b

and I get two mounts, each pointing at a different subvolume, that
(I'm pretty sure) share a superblock

mount -t btrfs /dev/sda1 -o subvol=c,foo=bar /mnt/c

where foo is a per-superblock option, it probably gets ignored.  If I
set up /dev/mapper/foo as a linear alias for /dev/sda1 and I do:

mount -t btrfs /dev/mapper/foo -o subvol=d /mnt/d

then I get a fresh superblock.  If /dev/sda1 is still mounted and the
various O_EXCL-like checks don'e catch it, then I get massive
corruption.

The btrfs case seems quite fragile to me, and it seems like a bit of
an abuse of mount(2).  (Of course, basically everything anyone does
with mount(2) is a bit of an abuse.)

I would hope that the new fs mounting API would clean this up.  The
NFS case seems just fine, but for btrfs, it seems like maybe the whole
CMD_CREATE operation should be more fine grained.  There seem to be
*two* actions going on in a btrfs mount.  First there's the act of
instantiating the filesystem driver backed by the device (I think this
is open_ctree()), and *then* there's the act of instantiating a dentry
tree pointing at some subvolume, etc.

ZFS seems to handle this quite nicely.  First you fire up a zpool, and
then you start mounting its volumes.


[PATCH] staging: gasket: remove null ptr check before kfree

2018-08-11 Thread Sumit Kumar
Remove null ptr check before kfree because kfree is null ptr safe.
Issue found by checkpatch.

Signed-off-by: Sumit Kumar 
---
 drivers/staging/gasket/gasket_page_table.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/gasket/gasket_page_table.c 
b/drivers/staging/gasket/gasket_page_table.c
index d4c5f8a..bd921dc 100644
--- a/drivers/staging/gasket/gasket_page_table.c
+++ b/drivers/staging/gasket/gasket_page_table.c
@@ -1328,10 +1328,8 @@ int gasket_alloc_coherent_memory(struct gasket_dev 
*gasket_dev, u64 size,
  num_pages * PAGE_SIZE, mem, handle);
}
 
-   if (gasket_dev->page_table[index]->coherent_pages) {
-   kfree(gasket_dev->page_table[index]->coherent_pages);
-   gasket_dev->page_table[index]->coherent_pages = NULL;
-   }
+   kfree(gasket_dev->page_table[index]->coherent_pages);
+   gasket_dev->page_table[index]->coherent_pages = NULL;
gasket_dev->page_table[index]->num_coherent_pages = 0;
return -ENOMEM;
 }
-- 
2.7.4



[PATCH] staging: gasket: remove null ptr check before kfree

2018-08-11 Thread Sumit Kumar
Remove null ptr check before kfree because kfree is null ptr safe.
Issue found by checkpatch.

Signed-off-by: Sumit Kumar 
---
 drivers/staging/gasket/gasket_page_table.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/gasket/gasket_page_table.c 
b/drivers/staging/gasket/gasket_page_table.c
index d4c5f8a..bd921dc 100644
--- a/drivers/staging/gasket/gasket_page_table.c
+++ b/drivers/staging/gasket/gasket_page_table.c
@@ -1328,10 +1328,8 @@ int gasket_alloc_coherent_memory(struct gasket_dev 
*gasket_dev, u64 size,
  num_pages * PAGE_SIZE, mem, handle);
}
 
-   if (gasket_dev->page_table[index]->coherent_pages) {
-   kfree(gasket_dev->page_table[index]->coherent_pages);
-   gasket_dev->page_table[index]->coherent_pages = NULL;
-   }
+   kfree(gasket_dev->page_table[index]->coherent_pages);
+   gasket_dev->page_table[index]->coherent_pages = NULL;
gasket_dev->page_table[index]->num_coherent_pages = 0;
return -ENOMEM;
 }
-- 
2.7.4



[RFC PATCH] clk: qcom: gcc_sdm660_hws[] can be static

2018-08-11 Thread kbuild test robot


Fixes: 851e534f5d75 ("clk: qcom: Add Global Clock controller (GCC) driver for 
SDM660")
Signed-off-by: kbuild test robot 
---
 gcc-sdm660.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/gcc-sdm660.c b/drivers/clk/qcom/gcc-sdm660.c
index bdb445a..cec8b41 100644
--- a/drivers/clk/qcom/gcc-sdm660.c
+++ b/drivers/clk/qcom/gcc-sdm660.c
@@ -2252,7 +2252,7 @@ static struct gdsc pcie_0_gdsc = {
.flags = VOTABLE,
 };
 
-struct clk_hw *gcc_sdm660_hws[] = {
+static struct clk_hw *gcc_sdm660_hws[] = {
[GCC_XO] = ,
[GCC_GPLL0_EARLY_DIV] = _early_div.hw,
[GCC_GPLL1_EARLY_DIV] = _early_div.hw,


[RFC PATCH] clk: qcom: gcc_sdm660_hws[] can be static

2018-08-11 Thread kbuild test robot


Fixes: 851e534f5d75 ("clk: qcom: Add Global Clock controller (GCC) driver for 
SDM660")
Signed-off-by: kbuild test robot 
---
 gcc-sdm660.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/qcom/gcc-sdm660.c b/drivers/clk/qcom/gcc-sdm660.c
index bdb445a..cec8b41 100644
--- a/drivers/clk/qcom/gcc-sdm660.c
+++ b/drivers/clk/qcom/gcc-sdm660.c
@@ -2252,7 +2252,7 @@ static struct gdsc pcie_0_gdsc = {
.flags = VOTABLE,
 };
 
-struct clk_hw *gcc_sdm660_hws[] = {
+static struct clk_hw *gcc_sdm660_hws[] = {
[GCC_XO] = ,
[GCC_GPLL0_EARLY_DIV] = _early_div.hw,
[GCC_GPLL1_EARLY_DIV] = _early_div.hw,


Re: [PATCH] clk: qcom: Add Global Clock controller (GCC) driver for SDM660

2018-08-11 Thread kbuild test robot
Hi Craig,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on agross/for-next]
[also build test WARNING on v4.18-rc8]
[cannot apply to next-20180810]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Craig-Tatlor/clk-qcom-Add-Global-Clock-controller-GCC-driver-for-SDM660/20180811-150111
base:   https://git.kernel.org/pub/scm/linux/kernel/git/agross/linux.git 
for-next
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> drivers/clk/qcom/gcc-sdm660.c:2255:15: sparse: symbol 'gcc_sdm660_hws' was 
>> not declared. Should it be static?
   drivers/clk/qcom/gcc-sdm660.c:2304:10: sparse: Initializer entry defined 
twice
   drivers/clk/qcom/gcc-sdm660.c:2306:10:   also defined here

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


Re: [PATCH] clk: qcom: Add Global Clock controller (GCC) driver for SDM660

2018-08-11 Thread kbuild test robot
Hi Craig,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on agross/for-next]
[also build test WARNING on v4.18-rc8]
[cannot apply to next-20180810]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Craig-Tatlor/clk-qcom-Add-Global-Clock-controller-GCC-driver-for-SDM660/20180811-150111
base:   https://git.kernel.org/pub/scm/linux/kernel/git/agross/linux.git 
for-next
reproduce:
# apt-get install sparse
make ARCH=x86_64 allmodconfig
make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> drivers/clk/qcom/gcc-sdm660.c:2255:15: sparse: symbol 'gcc_sdm660_hws' was 
>> not declared. Should it be static?
   drivers/clk/qcom/gcc-sdm660.c:2304:10: sparse: Initializer entry defined 
twice
   drivers/clk/qcom/gcc-sdm660.c:2306:10:   also defined here

Please review and possibly fold the followup patch.

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


next-20180810: Traceback observed at at arch/x86/mm/pageattr.c:1211 __cpa_process_fault

2018-08-11 Thread Guenter Roeck

Hi,

I noticed the following spurious traceback in next-20180810 when booting an 
i386 image in qemu.

[0.00] [ cut here ]
[0.00] CPA: called for zero pte. vaddr = cffe cpa->vaddr = cffe
[0.00] WARNING: CPU: 0 PID: 0 at arch/x86/mm/pageattr.c:1211 
__cpa_process_fault+0x327/0x350
[0.00] Modules linked in:
[0.00] CPU: 0 PID: 0 Comm: swapper Not tainted 4.18.0-rc8-next-20180810 
#1
[0.00] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
rel-1.11.1-0-g0551a4be2c-prebuilt.qemu-project.org 04/01/2014
[0.00] EIP: __cpa_process_fault+0x327/0x350
[0.00] Code: 10 c1 e0 0c 03 45 e0 89 45 f0 8b 45 d0 85 c0 75 28 8b 75 d4 e9 
12 ff ff ff 8b 07 ff 30 ff 75 e0 68 c0 fc a7 cf e8 99 a1 00 00 <0f> 0b bb f2 ff 
ff ff 83 c4 0c e9 1c fe ff ff 8b 45 e0 8d b0 00 00
[0.00] EAX: 0040 EBX: ffdf ECX: cfba6a3c EDX: cfba6a3c
[0.00] ESI: cffe EDI: cfb81f20 EBP: cfb81e6c ESP: cfb81e30
[0.00] DS: 007b ES: 007b FS:  GS: 00e0 SS: 0068 EFLAGS: 00200096
[0.00] CR0: 80050033 CR2: ffda3000 CR3: 0fd1 CR4: 0690
[0.00] Call Trace:
[0.00]  __change_page_attr_set_clr+0x2e3/0x790
[0.00]  ? serial_putc+0x26/0x40
[0.00]  ? uart_console_write+0x48/0x60
[0.00]  ? 0xcf00
[0.00]  ? 0xcf00
[0.00]  ? 0xcf00
[0.00]  change_page_attr_set_clr+0x109/0x3a0
[0.00]  set_memory_nonglobal+0x1e/0x20
[0.00]  pti_init+0xc7/0xdd
[0.00]  start_kernel+0x1ca/0x3c0
[0.00]  i386_start_kernel+0x94/0x98
[0.00]  startup_32_smp+0x164/0x168
[0.00] ---[ end trace 638bf57ca2d37b0e ]---

I have seen this only once; I did not see it when repeating the test.

Qemu command line:

qemu-system-i386 -kernel arch/x86/boot/bzImage -M pc -cpu Conroe \
-no-reboot -m 256 -drive file=rootfs.ext2,if=ide,format=raw \
--append 'earlycon=uart8250,io,0x3f8,9600n8 root=/dev/sda rw mem=256M 
vga=0 uvesafb.mode_option=640x480-32 oprofile.timer=1 console=ttyS0 console=tty'
-nographic

Configuration is i386:defconfig+CONFIG_SMP=n.

Guenter


next-20180810: Traceback observed at at arch/x86/mm/pageattr.c:1211 __cpa_process_fault

2018-08-11 Thread Guenter Roeck

Hi,

I noticed the following spurious traceback in next-20180810 when booting an 
i386 image in qemu.

[0.00] [ cut here ]
[0.00] CPA: called for zero pte. vaddr = cffe cpa->vaddr = cffe
[0.00] WARNING: CPU: 0 PID: 0 at arch/x86/mm/pageattr.c:1211 
__cpa_process_fault+0x327/0x350
[0.00] Modules linked in:
[0.00] CPU: 0 PID: 0 Comm: swapper Not tainted 4.18.0-rc8-next-20180810 
#1
[0.00] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 
rel-1.11.1-0-g0551a4be2c-prebuilt.qemu-project.org 04/01/2014
[0.00] EIP: __cpa_process_fault+0x327/0x350
[0.00] Code: 10 c1 e0 0c 03 45 e0 89 45 f0 8b 45 d0 85 c0 75 28 8b 75 d4 e9 
12 ff ff ff 8b 07 ff 30 ff 75 e0 68 c0 fc a7 cf e8 99 a1 00 00 <0f> 0b bb f2 ff 
ff ff 83 c4 0c e9 1c fe ff ff 8b 45 e0 8d b0 00 00
[0.00] EAX: 0040 EBX: ffdf ECX: cfba6a3c EDX: cfba6a3c
[0.00] ESI: cffe EDI: cfb81f20 EBP: cfb81e6c ESP: cfb81e30
[0.00] DS: 007b ES: 007b FS:  GS: 00e0 SS: 0068 EFLAGS: 00200096
[0.00] CR0: 80050033 CR2: ffda3000 CR3: 0fd1 CR4: 0690
[0.00] Call Trace:
[0.00]  __change_page_attr_set_clr+0x2e3/0x790
[0.00]  ? serial_putc+0x26/0x40
[0.00]  ? uart_console_write+0x48/0x60
[0.00]  ? 0xcf00
[0.00]  ? 0xcf00
[0.00]  ? 0xcf00
[0.00]  change_page_attr_set_clr+0x109/0x3a0
[0.00]  set_memory_nonglobal+0x1e/0x20
[0.00]  pti_init+0xc7/0xdd
[0.00]  start_kernel+0x1ca/0x3c0
[0.00]  i386_start_kernel+0x94/0x98
[0.00]  startup_32_smp+0x164/0x168
[0.00] ---[ end trace 638bf57ca2d37b0e ]---

I have seen this only once; I did not see it when repeating the test.

Qemu command line:

qemu-system-i386 -kernel arch/x86/boot/bzImage -M pc -cpu Conroe \
-no-reboot -m 256 -drive file=rootfs.ext2,if=ide,format=raw \
--append 'earlycon=uart8250,io,0x3f8,9600n8 root=/dev/sda rw mem=256M 
vga=0 uvesafb.mode_option=640x480-32 oprofile.timer=1 console=ttyS0 console=tty'
-nographic

Configuration is i386:defconfig+CONFIG_SMP=n.

Guenter


Re: [PATCH] ARM: drop experimental mark for ARM stack unwinding

2018-08-11 Thread Stefan Agner
On 11.08.2018 18:57, Russell King - ARM Linux wrote:
> On Sat, Aug 11, 2018 at 12:31:27PM +0200, Stefan Agner wrote:
>> ARM stack unwinding is upstream since 2009 and has been proven
>> working well. At this time it is the preferred stack unwinding
>> support since it also supports Thumb 2. Do not scare people
>> and drop the EXPERIMENTAL mark.
> 
> Actually, there are still cases where we're missing the annotations -
> I've seen them in various oops dumps, but I forget where they are.
> What I do remember is that they didn't seem trivial to fix at the
> time, so it's still recommended that frame pointers are used if you
> want to guarantee getting a debuggable oops dump.

Ok, but does that warrants the experimental mark?

Experimental sounds rather harsh to me. People might disable it because
of that... I'd rather have a >90% chance of having a good stack trace
than none at all.

--
Stefan


Re: [PATCH] ARM: drop experimental mark for ARM stack unwinding

2018-08-11 Thread Stefan Agner
On 11.08.2018 18:57, Russell King - ARM Linux wrote:
> On Sat, Aug 11, 2018 at 12:31:27PM +0200, Stefan Agner wrote:
>> ARM stack unwinding is upstream since 2009 and has been proven
>> working well. At this time it is the preferred stack unwinding
>> support since it also supports Thumb 2. Do not scare people
>> and drop the EXPERIMENTAL mark.
> 
> Actually, there are still cases where we're missing the annotations -
> I've seen them in various oops dumps, but I forget where they are.
> What I do remember is that they didn't seem trivial to fix at the
> time, so it's still recommended that frame pointers are used if you
> want to guarantee getting a debuggable oops dump.

Ok, but does that warrants the experimental mark?

Experimental sounds rather harsh to me. People might disable it because
of that... I'd rather have a >90% chance of having a good stack trace
than none at all.

--
Stefan


[PATCH 1/3] iio: dac: add support for ltc166x

2018-08-11 Thread Marcus Folkesson
LTC1665/LTC1660 is a 8/10-bit Digital-to-Analog Converter
(DAC) with eight individual channels.

Signed-off-by: Marcus Folkesson 
---
 drivers/iio/dac/Kconfig   |  10 ++
 drivers/iio/dac/Makefile  |   1 +
 drivers/iio/dac/ltc166x.c | 244 ++
 3 files changed, 255 insertions(+)
 create mode 100644 drivers/iio/dac/ltc166x.c

diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig
index 76db0768e454..04cfa6bb9dc1 100644
--- a/drivers/iio/dac/Kconfig
+++ b/drivers/iio/dac/Kconfig
@@ -120,6 +120,16 @@ config AD5624R_SPI
  Say yes here to build support for Analog Devices AD5624R, AD5644R and
  AD5664R converters (DAC). This driver uses the common SPI interface.
 
+config LTC166X
+   tristate "Linear Technology LTC1660/LTC1665 DAC SPI driver"
+   depends on SPI
+   help
+ Say yes here to build support for Linear Technology
+ LTC1660 and LTC1665 Digital to Analog Converters.
+
+ To compile this driver as a module, choose M here: the
+ module will be called ltc166x.
+
 config LTC2632
tristate "Linear Technology LTC2632-12/10/8 DAC spi driver"
depends on SPI
diff --git a/drivers/iio/dac/Makefile b/drivers/iio/dac/Makefile
index 81e710ed7491..380749c87c26 100644
--- a/drivers/iio/dac/Makefile
+++ b/drivers/iio/dac/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_CIO_DAC) += cio-dac.o
 obj-$(CONFIG_DPOT_DAC) += dpot-dac.o
 obj-$(CONFIG_DS4424) += ds4424.o
 obj-$(CONFIG_LPC18XX_DAC) += lpc18xx_dac.o
+obj-$(CONFIG_LTC166X) += ltc166x.o
 obj-$(CONFIG_LTC2632) += ltc2632.o
 obj-$(CONFIG_M62332) += m62332.o
 obj-$(CONFIG_MAX517) += max517.o
diff --git a/drivers/iio/dac/ltc166x.c b/drivers/iio/dac/ltc166x.c
new file mode 100644
index ..0031f2b50f14
--- /dev/null
+++ b/drivers/iio/dac/ltc166x.c
@@ -0,0 +1,244 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Driver for Linear Technology LTC1665/LTC1660, 8 channels DAC
+ *
+ * Copyright (C) 2018 Marcus Folkesson 
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define LTC166X_REG_WAKE   0x0
+#define LTC166X_REG_DAC_A  0x1
+#define LTC166X_REG_DAC_B  0x2
+#define LTC166X_REG_DAC_C  0x3
+#define LTC166X_REG_DAC_D  0x4
+#define LTC166X_REG_DAC_E  0x5
+#define LTC166X_REG_DAC_F  0x6
+#define LTC166X_REG_DAC_G  0x7
+#define LTC166X_REG_DAC_H  0x8
+#define LTC166X_REG_SLEEP  0xe
+
+#define LTC166X_NUM_CHANNELS   8
+
+static const struct regmap_config ltc166x_regmap_config = {
+   .reg_bits = 4,
+   .val_bits = 12,
+};
+
+enum ltc166x_supported_device_ids {
+   ID_LTC1660,
+   ID_LTC1665,
+};
+
+struct ltc166x_priv {
+   struct spi_device *spi;
+   struct regmap *regmap;
+   struct regulator *vref_reg;
+   unsigned int value[LTC166X_NUM_CHANNELS];
+   unsigned int vref_mv;
+};
+
+static int ltc166x_read_raw(struct iio_dev *indio_dev,
+   struct iio_chan_spec const *chan,
+   int *val,
+   int *val2,
+   long mask)
+{
+   struct ltc166x_priv *priv = iio_priv(indio_dev);
+
+   switch (mask) {
+   case IIO_CHAN_INFO_RAW:
+   *val = priv->value[chan->channel];
+   return IIO_VAL_INT;
+   case IIO_CHAN_INFO_SCALE:
+   *val = priv->vref_mv;
+   *val2 = chan->scan_type.realbits;
+   return IIO_VAL_FRACTIONAL_LOG2;
+   default:
+   return -EINVAL;
+   }
+}
+
+static int ltc166x_write_raw(struct iio_dev *indio_dev,
+   struct iio_chan_spec const *chan,
+   int val,
+   int val2,
+   long mask)
+{
+   struct ltc166x_priv *priv = iio_priv(indio_dev);
+
+   switch (mask) {
+   case IIO_CHAN_INFO_RAW:
+   if (val2 != 0)
+   return -EINVAL;
+   if (val > GENMASK(chan->scan_type.realbits-1, 0))
+   return -EINVAL;
+   priv->value[chan->channel] = val;
+   val <<= chan->scan_type.shift;
+   return regmap_write(priv->regmap, chan->channel, val);
+   default:
+   return -EINVAL;
+   }
+}
+
+#define LTC166X_CHAN(chan, bits) { \
+   .type = IIO_VOLTAGE,\
+   .indexed = 1,   \
+   .output = 1,\
+   .channel = chan,\
+   .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),   \
+   .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),   \
+   .scan_type = {  \
+   .sign = 'u',\
+   .realbits = (bits), \
+   .storagebits = 16,  \
+   .shift = 12 - (bits),   \
+   },  

[PATCH 2/3] dt-bindings: iio: dac: add bindings for ltc166x

2018-08-11 Thread Marcus Folkesson
LTC1665/LTC1660 is a 8/10-bit Digital-to-Analog Converter (DAC)
with eight individual channels.

Signed-off-by: Marcus Folkesson 
---
 .../devicetree/bindings/iio/dac/ltc166x.txt | 21 +
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/dac/ltc166x.txt

diff --git a/Documentation/devicetree/bindings/iio/dac/ltc166x.txt 
b/Documentation/devicetree/bindings/iio/dac/ltc166x.txt
new file mode 100644
index ..c5b5f22d6c64
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/dac/ltc166x.txt
@@ -0,0 +1,21 @@
+* Linear Technology Micropower octal 8-Bit and 10-Bit DACs
+
+Required properties:
+ - compatible: Must be one of the following:
+   "lltc,ltc1660"
+   "lltc,ltc1665"
+ - reg: SPI chip select number for the device
+ - vref-supply: Phandle to the voltage reference supply
+
+Recommended properties:
+ - spi-max-frequency: Definition as per
+Documentation/devicetree/bindings/spi/spi-bus.txt.
+Max frequency for this chip is 5 MHz.
+
+Example:
+dac@0 {
+   compatible = "lltc,ltc1660";
+   reg = <0>;
+   spi-max-frequency = <500>;
+   vref-supply = <_reg>;
+};
-- 
2.11.0.rc2



[PATCH 1/3] iio: dac: add support for ltc166x

2018-08-11 Thread Marcus Folkesson
LTC1665/LTC1660 is a 8/10-bit Digital-to-Analog Converter
(DAC) with eight individual channels.

Signed-off-by: Marcus Folkesson 
---
 drivers/iio/dac/Kconfig   |  10 ++
 drivers/iio/dac/Makefile  |   1 +
 drivers/iio/dac/ltc166x.c | 244 ++
 3 files changed, 255 insertions(+)
 create mode 100644 drivers/iio/dac/ltc166x.c

diff --git a/drivers/iio/dac/Kconfig b/drivers/iio/dac/Kconfig
index 76db0768e454..04cfa6bb9dc1 100644
--- a/drivers/iio/dac/Kconfig
+++ b/drivers/iio/dac/Kconfig
@@ -120,6 +120,16 @@ config AD5624R_SPI
  Say yes here to build support for Analog Devices AD5624R, AD5644R and
  AD5664R converters (DAC). This driver uses the common SPI interface.
 
+config LTC166X
+   tristate "Linear Technology LTC1660/LTC1665 DAC SPI driver"
+   depends on SPI
+   help
+ Say yes here to build support for Linear Technology
+ LTC1660 and LTC1665 Digital to Analog Converters.
+
+ To compile this driver as a module, choose M here: the
+ module will be called ltc166x.
+
 config LTC2632
tristate "Linear Technology LTC2632-12/10/8 DAC spi driver"
depends on SPI
diff --git a/drivers/iio/dac/Makefile b/drivers/iio/dac/Makefile
index 81e710ed7491..380749c87c26 100644
--- a/drivers/iio/dac/Makefile
+++ b/drivers/iio/dac/Makefile
@@ -26,6 +26,7 @@ obj-$(CONFIG_CIO_DAC) += cio-dac.o
 obj-$(CONFIG_DPOT_DAC) += dpot-dac.o
 obj-$(CONFIG_DS4424) += ds4424.o
 obj-$(CONFIG_LPC18XX_DAC) += lpc18xx_dac.o
+obj-$(CONFIG_LTC166X) += ltc166x.o
 obj-$(CONFIG_LTC2632) += ltc2632.o
 obj-$(CONFIG_M62332) += m62332.o
 obj-$(CONFIG_MAX517) += max517.o
diff --git a/drivers/iio/dac/ltc166x.c b/drivers/iio/dac/ltc166x.c
new file mode 100644
index ..0031f2b50f14
--- /dev/null
+++ b/drivers/iio/dac/ltc166x.c
@@ -0,0 +1,244 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Driver for Linear Technology LTC1665/LTC1660, 8 channels DAC
+ *
+ * Copyright (C) 2018 Marcus Folkesson 
+ */
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define LTC166X_REG_WAKE   0x0
+#define LTC166X_REG_DAC_A  0x1
+#define LTC166X_REG_DAC_B  0x2
+#define LTC166X_REG_DAC_C  0x3
+#define LTC166X_REG_DAC_D  0x4
+#define LTC166X_REG_DAC_E  0x5
+#define LTC166X_REG_DAC_F  0x6
+#define LTC166X_REG_DAC_G  0x7
+#define LTC166X_REG_DAC_H  0x8
+#define LTC166X_REG_SLEEP  0xe
+
+#define LTC166X_NUM_CHANNELS   8
+
+static const struct regmap_config ltc166x_regmap_config = {
+   .reg_bits = 4,
+   .val_bits = 12,
+};
+
+enum ltc166x_supported_device_ids {
+   ID_LTC1660,
+   ID_LTC1665,
+};
+
+struct ltc166x_priv {
+   struct spi_device *spi;
+   struct regmap *regmap;
+   struct regulator *vref_reg;
+   unsigned int value[LTC166X_NUM_CHANNELS];
+   unsigned int vref_mv;
+};
+
+static int ltc166x_read_raw(struct iio_dev *indio_dev,
+   struct iio_chan_spec const *chan,
+   int *val,
+   int *val2,
+   long mask)
+{
+   struct ltc166x_priv *priv = iio_priv(indio_dev);
+
+   switch (mask) {
+   case IIO_CHAN_INFO_RAW:
+   *val = priv->value[chan->channel];
+   return IIO_VAL_INT;
+   case IIO_CHAN_INFO_SCALE:
+   *val = priv->vref_mv;
+   *val2 = chan->scan_type.realbits;
+   return IIO_VAL_FRACTIONAL_LOG2;
+   default:
+   return -EINVAL;
+   }
+}
+
+static int ltc166x_write_raw(struct iio_dev *indio_dev,
+   struct iio_chan_spec const *chan,
+   int val,
+   int val2,
+   long mask)
+{
+   struct ltc166x_priv *priv = iio_priv(indio_dev);
+
+   switch (mask) {
+   case IIO_CHAN_INFO_RAW:
+   if (val2 != 0)
+   return -EINVAL;
+   if (val > GENMASK(chan->scan_type.realbits-1, 0))
+   return -EINVAL;
+   priv->value[chan->channel] = val;
+   val <<= chan->scan_type.shift;
+   return regmap_write(priv->regmap, chan->channel, val);
+   default:
+   return -EINVAL;
+   }
+}
+
+#define LTC166X_CHAN(chan, bits) { \
+   .type = IIO_VOLTAGE,\
+   .indexed = 1,   \
+   .output = 1,\
+   .channel = chan,\
+   .info_mask_separate = BIT(IIO_CHAN_INFO_RAW),   \
+   .info_mask_shared_by_type = BIT(IIO_CHAN_INFO_SCALE),   \
+   .scan_type = {  \
+   .sign = 'u',\
+   .realbits = (bits), \
+   .storagebits = 16,  \
+   .shift = 12 - (bits),   \
+   },  

[PATCH 2/3] dt-bindings: iio: dac: add bindings for ltc166x

2018-08-11 Thread Marcus Folkesson
LTC1665/LTC1660 is a 8/10-bit Digital-to-Analog Converter (DAC)
with eight individual channels.

Signed-off-by: Marcus Folkesson 
---
 .../devicetree/bindings/iio/dac/ltc166x.txt | 21 +
 1 file changed, 21 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/dac/ltc166x.txt

diff --git a/Documentation/devicetree/bindings/iio/dac/ltc166x.txt 
b/Documentation/devicetree/bindings/iio/dac/ltc166x.txt
new file mode 100644
index ..c5b5f22d6c64
--- /dev/null
+++ b/Documentation/devicetree/bindings/iio/dac/ltc166x.txt
@@ -0,0 +1,21 @@
+* Linear Technology Micropower octal 8-Bit and 10-Bit DACs
+
+Required properties:
+ - compatible: Must be one of the following:
+   "lltc,ltc1660"
+   "lltc,ltc1665"
+ - reg: SPI chip select number for the device
+ - vref-supply: Phandle to the voltage reference supply
+
+Recommended properties:
+ - spi-max-frequency: Definition as per
+Documentation/devicetree/bindings/spi/spi-bus.txt.
+Max frequency for this chip is 5 MHz.
+
+Example:
+dac@0 {
+   compatible = "lltc,ltc1660";
+   reg = <0>;
+   spi-max-frequency = <500>;
+   vref-supply = <_reg>;
+};
-- 
2.11.0.rc2



[PATCH 3/3] MAINTAINERS: add entry for ltc166x DAC driver

2018-08-11 Thread Marcus Folkesson
Add entry for ltc166x DAC driver and add myself as
maintainer of this driver.

Signed-off-by: Marcus Folkesson 
---
 MAINTAINERS | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 9276da915d9d..2dc4c773fb2e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8363,6 +8363,13 @@ L:   linux-s...@vger.kernel.org
 S: Maintained
 F: drivers/scsi/sym53c8xx_2/
 
+LTC166X DAC DRIVER
+M: Marcus Folkesson 
+L: linux-...@vger.kernel.org
+S: Maintained
+F: Documentation/devicetree/bindings/iio/dac/ltc166x.txt
+F: drivers/iio/dac/ltc166x.c
+
 LTC4261 HARDWARE MONITOR DRIVER
 M: Guenter Roeck 
 L: linux-hw...@vger.kernel.org
-- 
2.11.0.rc2



[PATCH 3/3] MAINTAINERS: add entry for ltc166x DAC driver

2018-08-11 Thread Marcus Folkesson
Add entry for ltc166x DAC driver and add myself as
maintainer of this driver.

Signed-off-by: Marcus Folkesson 
---
 MAINTAINERS | 7 +++
 1 file changed, 7 insertions(+)

diff --git a/MAINTAINERS b/MAINTAINERS
index 9276da915d9d..2dc4c773fb2e 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -8363,6 +8363,13 @@ L:   linux-s...@vger.kernel.org
 S: Maintained
 F: drivers/scsi/sym53c8xx_2/
 
+LTC166X DAC DRIVER
+M: Marcus Folkesson 
+L: linux-...@vger.kernel.org
+S: Maintained
+F: Documentation/devicetree/bindings/iio/dac/ltc166x.txt
+F: drivers/iio/dac/ltc166x.c
+
 LTC4261 HARDWARE MONITOR DRIVER
 M: Guenter Roeck 
 L: linux-hw...@vger.kernel.org
-- 
2.11.0.rc2



Re: Fwd: PROBLEM: tpm_cpg can't request region with AMD/Dell fTPM

2018-08-11 Thread Harlan Lieberman-Berg
On Sat, Aug 11, 2018 at 5:42 AM, Tomas Winkler  wrote:
> What platform is this? This is not regular 0xfed4 address space. I
> guess this is BYT or CHT.  It's better to get dmideoce dump as well.

Hello Tomas, Jarkko, all,

I'm not sure what's up with that.  I've updated the firmware to the
latest version (with no fix, sadly), and re-dumped the ACPI tables.
They now process correctly through isl v20180629.  I've also saved the
output of dmidecode for you.

https://gist.github.com/hlieberman-gov/83fa708d41051bafccc553cf0147db4f

Sincerely,
-- 
Harlan Lieberman-Berg
Defense Digital Service


Re: Fwd: PROBLEM: tpm_cpg can't request region with AMD/Dell fTPM

2018-08-11 Thread Harlan Lieberman-Berg
On Sat, Aug 11, 2018 at 5:42 AM, Tomas Winkler  wrote:
> What platform is this? This is not regular 0xfed4 address space. I
> guess this is BYT or CHT.  It's better to get dmideoce dump as well.

Hello Tomas, Jarkko, all,

I'm not sure what's up with that.  I've updated the firmware to the
latest version (with no fix, sadly), and re-dumped the ACPI tables.
They now process correctly through isl v20180629.  I've also saved the
output of dmidecode for you.

https://gist.github.com/hlieberman-gov/83fa708d41051bafccc553cf0147db4f

Sincerely,
-- 
Harlan Lieberman-Berg
Defense Digital Service


Re: [PATCH 28/33] vfs: syscall: Add fsconfig() for configuring and managing a context [ver #11]

2018-08-11 Thread David Howells
Miklos Szeredi  wrote:

> You can determine at fsopen() time whether the filesystem is able to
> support the O_EXCL behavior?  If so, then it's trivial to enable this
> conditionally.  I think that's what Eric is asking for, it's obviously
> not fair to ask for a change in behavior of the legacy interface.

It's not trivial, see btrfs and nfs :-/

David


Re: [PATCH 28/33] vfs: syscall: Add fsconfig() for configuring and managing a context [ver #11]

2018-08-11 Thread David Howells
Miklos Szeredi  wrote:

> You can determine at fsopen() time whether the filesystem is able to
> support the O_EXCL behavior?  If so, then it's trivial to enable this
> conditionally.  I think that's what Eric is asking for, it's obviously
> not fair to ask for a change in behavior of the legacy interface.

It's not trivial, see btrfs and nfs :-/

David


KASAN: use-after-free Write in preempt_notifier_register (2)

2018-08-11 Thread syzbot

Hello,

syzbot found the following crash on:

HEAD commit:2b769bb85b48 Add linux-next specific files for 20180807
git tree:   linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=1356aef040
kernel config:  https://syzkaller.appspot.com/x/.config?x=547d800b8773c2c5
dashboard link: https://syzkaller.appspot.com/bug?extid=d5d3b529a776503b24a2
compiler:   gcc (GCC) 8.0.1 20180413 (experimental)
syzkaller repro:https://syzkaller.appspot.com/x/repro.syz?x=1618c46440
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=122d667240

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+d5d3b529a776503b2...@syzkaller.appspotmail.com

random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
==
BUG: KASAN: use-after-free in hlist_add_head include/linux/list.h:704  
[inline]
BUG: KASAN: use-after-free in preempt_notifier_register+0x1ec/0x200  
kernel/sched/core.c:2460

Write of size 8 at addr 8801ac490050 by task syz-executor201/4333

CPU: 0 PID: 4333 Comm: syz-executor201 Not tainted  
4.18.0-rc8-next-20180807+ #33
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011

Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1c9/0x2b4 lib/dump_stack.c:113
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0x242/0x30d mm/kasan/report.c:412
 __asan_report_store8_noabort+0x17/0x20 mm/kasan/report.c:438
 hlist_add_head include/linux/list.h:704 [inline]
 preempt_notifier_register+0x1ec/0x200 kernel/sched/core.c:2460
 vcpu_load+0x27/0x40 arch/x86/kvm/../../../virt/kvm/kvm_main.c:163
 vmx_free_vcpu_nested arch/x86/kvm/vmx.c:10658 [inline]
 vmx_free_vcpu+0x194/0x300 arch/x86/kvm/vmx.c:10672
 kvm_arch_vcpu_free arch/x86/kvm/x86.c:8387 [inline]
 kvm_free_vcpus arch/x86/kvm/x86.c:8836 [inline]
 kvm_arch_destroy_vm+0x365/0x7c0 arch/x86/kvm/x86.c:8933
 kvm_destroy_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:752 [inline]
 kvm_put_kvm+0x73f/0x1060 arch/x86/kvm/../../../virt/kvm/kvm_main.c:773
 kvm_vm_release+0x42/0x50 arch/x86/kvm/../../../virt/kvm/kvm_main.c:784
 __fput+0x376/0x8a0 fs/file_table.c:279
 fput+0x15/0x20 fs/file_table.c:312
 task_work_run+0x1e8/0x2a0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x1b25/0x2760 kernel/exit.c:869
 do_group_exit+0x177/0x440 kernel/exit.c:972
 __do_sys_exit_group kernel/exit.c:983 [inline]
 __se_sys_exit_group kernel/exit.c:981 [inline]
 __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:981
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x43ece8
Code: Bad RIP value.
RSP: 002b:7ffd3f933c78 EFLAGS: 0246 ORIG_RAX: 00e7
RAX: ffda RBX:  RCX: 0043ece8
RDX:  RSI: 003c RDI: 
RBP: 004be5a8 R08: 00e7 R09: ffd0
R10: 004002c8 R11: 0246 R12: 0001
R13: 006d0180 R14:  R15: 

Allocated by task 4333:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:490
 kmem_cache_alloc+0x12e/0x760 mm/slab.c:3554
 kmem_cache_zalloc include/linux/slab.h:697 [inline]
 vmx_create_vcpu+0xcf/0x28b0 arch/x86/kvm/vmx.c:10682
 kvm_arch_vcpu_create+0xe5/0x220 arch/x86/kvm/x86.c:8401
 kvm_vm_ioctl_create_vcpu arch/x86/kvm/../../../virt/kvm/kvm_main.c:2476  
[inline]

 kvm_vm_ioctl+0x488/0x1d80 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2977
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0x1de/0x1720 fs/ioctl.c:685
 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:702
 __do_sys_ioctl fs/ioctl.c:709 [inline]
 __se_sys_ioctl fs/ioctl.c:707 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:707
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 4333:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kmem_cache_free+0x86/0x2d0 mm/slab.c:3756
 vmx_free_vcpu+0x26b/0x300 arch/x86/kvm/vmx.c:10676
 kvm_arch_vcpu_free arch/x86/kvm/x86.c:8387 [inline]
 kvm_free_vcpus arch/x86/kvm/x86.c:8836 [inline]
 kvm_arch_destroy_vm+0x365/0x7c0 arch/x86/kvm/x86.c:8933
 kvm_destroy_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:752 [inline]
 kvm_put_kvm+0x73f/0x1060 arch/x86/kvm/../../../virt/kvm/kvm_main.c:773
 kvm_vm_release+0x42/0x50 

KASAN: use-after-free Write in preempt_notifier_register (2)

2018-08-11 Thread syzbot

Hello,

syzbot found the following crash on:

HEAD commit:2b769bb85b48 Add linux-next specific files for 20180807
git tree:   linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=1356aef040
kernel config:  https://syzkaller.appspot.com/x/.config?x=547d800b8773c2c5
dashboard link: https://syzkaller.appspot.com/bug?extid=d5d3b529a776503b24a2
compiler:   gcc (GCC) 8.0.1 20180413 (experimental)
syzkaller repro:https://syzkaller.appspot.com/x/repro.syz?x=1618c46440
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=122d667240

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+d5d3b529a776503b2...@syzkaller.appspotmail.com

random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
random: sshd: uninitialized urandom read (32 bytes read)
==
BUG: KASAN: use-after-free in hlist_add_head include/linux/list.h:704  
[inline]
BUG: KASAN: use-after-free in preempt_notifier_register+0x1ec/0x200  
kernel/sched/core.c:2460

Write of size 8 at addr 8801ac490050 by task syz-executor201/4333

CPU: 0 PID: 4333 Comm: syz-executor201 Not tainted  
4.18.0-rc8-next-20180807+ #33
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011

Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1c9/0x2b4 lib/dump_stack.c:113
 print_address_description+0x6c/0x20b mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.7+0x242/0x30d mm/kasan/report.c:412
 __asan_report_store8_noabort+0x17/0x20 mm/kasan/report.c:438
 hlist_add_head include/linux/list.h:704 [inline]
 preempt_notifier_register+0x1ec/0x200 kernel/sched/core.c:2460
 vcpu_load+0x27/0x40 arch/x86/kvm/../../../virt/kvm/kvm_main.c:163
 vmx_free_vcpu_nested arch/x86/kvm/vmx.c:10658 [inline]
 vmx_free_vcpu+0x194/0x300 arch/x86/kvm/vmx.c:10672
 kvm_arch_vcpu_free arch/x86/kvm/x86.c:8387 [inline]
 kvm_free_vcpus arch/x86/kvm/x86.c:8836 [inline]
 kvm_arch_destroy_vm+0x365/0x7c0 arch/x86/kvm/x86.c:8933
 kvm_destroy_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:752 [inline]
 kvm_put_kvm+0x73f/0x1060 arch/x86/kvm/../../../virt/kvm/kvm_main.c:773
 kvm_vm_release+0x42/0x50 arch/x86/kvm/../../../virt/kvm/kvm_main.c:784
 __fput+0x376/0x8a0 fs/file_table.c:279
 fput+0x15/0x20 fs/file_table.c:312
 task_work_run+0x1e8/0x2a0 kernel/task_work.c:113
 exit_task_work include/linux/task_work.h:22 [inline]
 do_exit+0x1b25/0x2760 kernel/exit.c:869
 do_group_exit+0x177/0x440 kernel/exit.c:972
 __do_sys_exit_group kernel/exit.c:983 [inline]
 __se_sys_exit_group kernel/exit.c:981 [inline]
 __x64_sys_exit_group+0x3e/0x50 kernel/exit.c:981
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x43ece8
Code: Bad RIP value.
RSP: 002b:7ffd3f933c78 EFLAGS: 0246 ORIG_RAX: 00e7
RAX: ffda RBX:  RCX: 0043ece8
RDX:  RSI: 003c RDI: 
RBP: 004be5a8 R08: 00e7 R09: ffd0
R10: 004002c8 R11: 0246 R12: 0001
R13: 006d0180 R14:  R15: 

Allocated by task 4333:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc4/0xe0 mm/kasan/kasan.c:553
 kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:490
 kmem_cache_alloc+0x12e/0x760 mm/slab.c:3554
 kmem_cache_zalloc include/linux/slab.h:697 [inline]
 vmx_create_vcpu+0xcf/0x28b0 arch/x86/kvm/vmx.c:10682
 kvm_arch_vcpu_create+0xe5/0x220 arch/x86/kvm/x86.c:8401
 kvm_vm_ioctl_create_vcpu arch/x86/kvm/../../../virt/kvm/kvm_main.c:2476  
[inline]

 kvm_vm_ioctl+0x488/0x1d80 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2977
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0x1de/0x1720 fs/ioctl.c:685
 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:702
 __do_sys_ioctl fs/ioctl.c:709 [inline]
 __se_sys_ioctl fs/ioctl.c:707 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:707
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 4333:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x11a/0x170 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kmem_cache_free+0x86/0x2d0 mm/slab.c:3756
 vmx_free_vcpu+0x26b/0x300 arch/x86/kvm/vmx.c:10676
 kvm_arch_vcpu_free arch/x86/kvm/x86.c:8387 [inline]
 kvm_free_vcpus arch/x86/kvm/x86.c:8836 [inline]
 kvm_arch_destroy_vm+0x365/0x7c0 arch/x86/kvm/x86.c:8933
 kvm_destroy_vm arch/x86/kvm/../../../virt/kvm/kvm_main.c:752 [inline]
 kvm_put_kvm+0x73f/0x1060 arch/x86/kvm/../../../virt/kvm/kvm_main.c:773
 kvm_vm_release+0x42/0x50 

Re: [PATCH v3 16/17] driver/edac: enable Hygon support to AMD64 EDAC driver

2018-08-11 Thread Michael Jin
On Sat, Aug 11, 2018 at 3:56 PM, Michael Jin  wrote:
> On Sat, Aug 11, 2018 at 9:30 AM, Pu Wen  wrote:
>> @@ -1051,6 +1065,16 @@ static void determine_memory_type(struct amd64_pvt 
>> *pvt)
>> else
>> pvt->dram_type = MEM_DDR4;
>> return;
>> +   case 0x18:
>> +   if (pvt->vendor == X86_VENDOR_HYGON) {
>
> This vendor checking is not necessary as there are no other known
> family 18h processors.

Actually, vendor checking works here. Although, AMD has not released a
family 18h yet.


Re: [PATCH v3 16/17] driver/edac: enable Hygon support to AMD64 EDAC driver

2018-08-11 Thread Michael Jin
On Sat, Aug 11, 2018 at 3:56 PM, Michael Jin  wrote:
> On Sat, Aug 11, 2018 at 9:30 AM, Pu Wen  wrote:
>> @@ -1051,6 +1065,16 @@ static void determine_memory_type(struct amd64_pvt 
>> *pvt)
>> else
>> pvt->dram_type = MEM_DDR4;
>> return;
>> +   case 0x18:
>> +   if (pvt->vendor == X86_VENDOR_HYGON) {
>
> This vendor checking is not necessary as there are no other known
> family 18h processors.

Actually, vendor checking works here. Although, AMD has not released a
family 18h yet.


Re: [PATCH] ARM: drop experimental mark for ARM stack unwinding

2018-08-11 Thread Russell King - ARM Linux
On Sat, Aug 11, 2018 at 12:31:27PM +0200, Stefan Agner wrote:
> ARM stack unwinding is upstream since 2009 and has been proven
> working well. At this time it is the preferred stack unwinding
> support since it also supports Thumb 2. Do not scare people
> and drop the EXPERIMENTAL mark.

Actually, there are still cases where we're missing the annotations -
I've seen them in various oops dumps, but I forget where they are.
What I do remember is that they didn't seem trivial to fix at the
time, so it's still recommended that frame pointers are used if you
want to guarantee getting a debuggable oops dump.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 13.8Mbps down 630kbps up
According to speedtest.net: 13Mbps down 490kbps up


Re: [PATCH] ARM: drop experimental mark for ARM stack unwinding

2018-08-11 Thread Russell King - ARM Linux
On Sat, Aug 11, 2018 at 12:31:27PM +0200, Stefan Agner wrote:
> ARM stack unwinding is upstream since 2009 and has been proven
> working well. At this time it is the preferred stack unwinding
> support since it also supports Thumb 2. Do not scare people
> and drop the EXPERIMENTAL mark.

Actually, there are still cases where we're missing the annotations -
I've seen them in various oops dumps, but I forget where they are.
What I do remember is that they didn't seem trivial to fix at the
time, so it's still recommended that frame pointers are used if you
want to guarantee getting a debuggable oops dump.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 13.8Mbps down 630kbps up
According to speedtest.net: 13Mbps down 490kbps up


Re: [PATCH] pinctrl: qcom: Add sdm660 pinctrl driver

2018-08-11 Thread Christian Lamparter
On Saturday, August 11, 2018 6:25:19 PM CEST Craig Tatlor wrote:
> Add initial pinctrl driver to support pin configuration with
> pinctrl framework for sdm660.
> Based off CAF implementation.
> 
> Signed-off-by: Craig Tatlor 
> ---
> 
> diff --git 
> a/Documentation/devicetree/bindings/pinctrl/qcom,sdm660-pinctrl.txt 
> b/Documentation/devicetree/bindings/pinctrl/qcom,sdm660-pinctrl.txt
> new file mode 100644
> index ..85e6c6c17c04
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/pinctrl/qcom,sdm660-pinctrl.txt
> @@ -0,0 +1,195 @@
> +Qualcomm Technologies, Inc. SDM660 TLMM block
> +
> +This binding describes the Top Level Mode Multiplexer block found in the
> +SDM660 platform.
> +
> +- compatible:
> + Usage: required
> + Value type: 
> + Definition: must be "qcom,sdm660-pinctrl"
> +
> +- reg:
> + Usage: required
> + Value type: 
> + Definition: the base address and size of the TLMM register space.
> +
> +- interrupts:
> + Usage: required
> + Value type: 
> + Definition: should specify the TLMM summary IRQ.
> +
> +- interrupt-controller:
> + Usage: required
> + Value type: 
> + Definition: identifies this node as an interrupt controller
> +
> +- #interrupt-cells:
> + Usage: required
> + Value type: 
> + Definition: must be 2. Specifying the pin number and flags, as defined
> + in 
> +
> +- gpio-controller:
> + Usage: required
> + Value type: 
> + Definition: identifies this node as a gpio controller
> +
> +- #gpio-cells:
> + Usage: required
> + Value type: 
> + Definition: must be 2. Specifying the pin number and flags, as defined
> + in 
> +
> +Please refer to ../gpio/gpio.txt and ../interrupt-controller/interrupts.txt 
> for
> +a general description of GPIO and interrupt bindings.
You want to specify gpio-ranges here as well. The property is explained
in Section "2.1) gpio- and pin-controller interaction" in ../gpio/gpio.txt

Without it, the gpio-hogs construct (part of ../gpio/gpio.txt) will cause
the driver to fail during boot. (try it, ;-) )

> +Please refer to pinctrl-bindings.txt in this directory for details of the
> +common pinctrl bindings used by client devices, including the meaning of the
> +phrase "pin configuration node".
> +
> +The pin configuration nodes act as a container for an arbitrary number of
> +subnodes. Each of these subnodes represents some desired configuration for a
> +pin, a group, or a list of pins or groups. This configuration can include the
> +mux function to select on those pin(s)/group(s), and various pin 
> configuration
> +parameters, such as pull-up, drive strength, etc.
> +
> +
> +PIN CONFIGURATION NODES:
> +
> +The name of each subnode is not important; all subnodes should be enumerated
> +and processed purely based on their content.
> +
> +Each subnode only affects those parameters that are explicitly listed. In
> +other words, a subnode that lists a mux function but no pin configuration
> +parameters implies no information about any pin configuration parameters.
> +Similarly, a pin subnode that describes a pullup parameter implies no
> +information about e.g. the mux function.
> +
> +
> +The following generic properties as defined in pinctrl-bindings.txt are valid
> +to specify in a pin configuration subnode:
> +
> +- pins:
> + Usage: required
> + Value type: 
> + Definition: List of gpio pins affected by the properties specified in
> + this subnode.  Valid pins are:
> + gpio0-gpio149,
> + Supports mux, bias and drive-strength
> + sdc1_clk, sdc1_cmd, sdc1_data sdc2_clk, sdc2_cmd, sdc2_data 
> sdc1_rclk,
> + Supports bias and drive-strength
> +
> +- function:
> + Usage: required
> + Value type: 
> + Definition: Specify the alternative function to be configured for the
> + specified pins. Functions are only valid for gpio pins.
> + Valid values are:
> +
> + blsp_uart1, blsp_spi1, blsp_i2c1, blsp_uim1, atest_tsens,
> + bimc_dte1, dac_calib0, blsp_spi8, blsp_uart8, blsp_uim8,
> + qdss_cti_trig_out_b, bimc_dte0, dac_calib1, 
> qdss_cti_trig_in_b,
> + dac_calib2, atest_tsens2, atest_usb1, blsp_spi10, 
> blsp_uart10,
> + blsp_uim10, atest_bbrx1, atest_usb13, atest_bbrx0, 
> atest_usb12,
> + mdp_vsync, edp_lcd, blsp_i2c10, atest_gpsadc1, atest_usb11,
> + atest_gpsadc0, edp_hot, atest_usb10, m_voc, dac_gpio, 
> atest_char,
> + cam_mclk, pll_bypassnl, qdss_stm7, blsp_i2c8, 
> qdss_tracedata_b,
> + pll_reset, qdss_stm6, qdss_stm5, qdss_stm4, atest_usb2, 
> cci_i2c,
> + qdss_stm3, dac_calib3, atest_usb23, atest_char3, dac_calib4,
> + qdss_stm2, atest_usb22, atest_char2, qdss_stm1, dac_calib5,
> + atest_usb21, 

Re: [PATCH] pinctrl: qcom: Add sdm660 pinctrl driver

2018-08-11 Thread Christian Lamparter
On Saturday, August 11, 2018 6:25:19 PM CEST Craig Tatlor wrote:
> Add initial pinctrl driver to support pin configuration with
> pinctrl framework for sdm660.
> Based off CAF implementation.
> 
> Signed-off-by: Craig Tatlor 
> ---
> 
> diff --git 
> a/Documentation/devicetree/bindings/pinctrl/qcom,sdm660-pinctrl.txt 
> b/Documentation/devicetree/bindings/pinctrl/qcom,sdm660-pinctrl.txt
> new file mode 100644
> index ..85e6c6c17c04
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/pinctrl/qcom,sdm660-pinctrl.txt
> @@ -0,0 +1,195 @@
> +Qualcomm Technologies, Inc. SDM660 TLMM block
> +
> +This binding describes the Top Level Mode Multiplexer block found in the
> +SDM660 platform.
> +
> +- compatible:
> + Usage: required
> + Value type: 
> + Definition: must be "qcom,sdm660-pinctrl"
> +
> +- reg:
> + Usage: required
> + Value type: 
> + Definition: the base address and size of the TLMM register space.
> +
> +- interrupts:
> + Usage: required
> + Value type: 
> + Definition: should specify the TLMM summary IRQ.
> +
> +- interrupt-controller:
> + Usage: required
> + Value type: 
> + Definition: identifies this node as an interrupt controller
> +
> +- #interrupt-cells:
> + Usage: required
> + Value type: 
> + Definition: must be 2. Specifying the pin number and flags, as defined
> + in 
> +
> +- gpio-controller:
> + Usage: required
> + Value type: 
> + Definition: identifies this node as a gpio controller
> +
> +- #gpio-cells:
> + Usage: required
> + Value type: 
> + Definition: must be 2. Specifying the pin number and flags, as defined
> + in 
> +
> +Please refer to ../gpio/gpio.txt and ../interrupt-controller/interrupts.txt 
> for
> +a general description of GPIO and interrupt bindings.
You want to specify gpio-ranges here as well. The property is explained
in Section "2.1) gpio- and pin-controller interaction" in ../gpio/gpio.txt

Without it, the gpio-hogs construct (part of ../gpio/gpio.txt) will cause
the driver to fail during boot. (try it, ;-) )

> +Please refer to pinctrl-bindings.txt in this directory for details of the
> +common pinctrl bindings used by client devices, including the meaning of the
> +phrase "pin configuration node".
> +
> +The pin configuration nodes act as a container for an arbitrary number of
> +subnodes. Each of these subnodes represents some desired configuration for a
> +pin, a group, or a list of pins or groups. This configuration can include the
> +mux function to select on those pin(s)/group(s), and various pin 
> configuration
> +parameters, such as pull-up, drive strength, etc.
> +
> +
> +PIN CONFIGURATION NODES:
> +
> +The name of each subnode is not important; all subnodes should be enumerated
> +and processed purely based on their content.
> +
> +Each subnode only affects those parameters that are explicitly listed. In
> +other words, a subnode that lists a mux function but no pin configuration
> +parameters implies no information about any pin configuration parameters.
> +Similarly, a pin subnode that describes a pullup parameter implies no
> +information about e.g. the mux function.
> +
> +
> +The following generic properties as defined in pinctrl-bindings.txt are valid
> +to specify in a pin configuration subnode:
> +
> +- pins:
> + Usage: required
> + Value type: 
> + Definition: List of gpio pins affected by the properties specified in
> + this subnode.  Valid pins are:
> + gpio0-gpio149,
> + Supports mux, bias and drive-strength
> + sdc1_clk, sdc1_cmd, sdc1_data sdc2_clk, sdc2_cmd, sdc2_data 
> sdc1_rclk,
> + Supports bias and drive-strength
> +
> +- function:
> + Usage: required
> + Value type: 
> + Definition: Specify the alternative function to be configured for the
> + specified pins. Functions are only valid for gpio pins.
> + Valid values are:
> +
> + blsp_uart1, blsp_spi1, blsp_i2c1, blsp_uim1, atest_tsens,
> + bimc_dte1, dac_calib0, blsp_spi8, blsp_uart8, blsp_uim8,
> + qdss_cti_trig_out_b, bimc_dte0, dac_calib1, 
> qdss_cti_trig_in_b,
> + dac_calib2, atest_tsens2, atest_usb1, blsp_spi10, 
> blsp_uart10,
> + blsp_uim10, atest_bbrx1, atest_usb13, atest_bbrx0, 
> atest_usb12,
> + mdp_vsync, edp_lcd, blsp_i2c10, atest_gpsadc1, atest_usb11,
> + atest_gpsadc0, edp_hot, atest_usb10, m_voc, dac_gpio, 
> atest_char,
> + cam_mclk, pll_bypassnl, qdss_stm7, blsp_i2c8, 
> qdss_tracedata_b,
> + pll_reset, qdss_stm6, qdss_stm5, qdss_stm4, atest_usb2, 
> cci_i2c,
> + qdss_stm3, dac_calib3, atest_usb23, atest_char3, dac_calib4,
> + qdss_stm2, atest_usb22, atest_char2, qdss_stm1, dac_calib5,
> + atest_usb21, 

Re: [PATCH v3 16/17] driver/edac: enable Hygon support to AMD64 EDAC driver

2018-08-11 Thread Michael Jin
On Sat, Aug 11, 2018 at 9:30 AM, Pu Wen  wrote:
> diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
> index 18aeabb..fb81354 100644
> --- a/drivers/edac/amd64_edac.c
> +++ b/drivers/edac/amd64_edac.c
> @@ -211,7 +211,7 @@ static int __set_scrub_rate(struct amd64_pvt *pvt, u32 
> new_bw, u32 min_rate)
>
> scrubval = scrubrates[i].scrubval;
>
> -   if (pvt->fam == 0x17) {
> +   if (pvt->fam == 0x17 || pvt->vendor == X86_VENDOR_HYGON) {
> __f17h_set_scrubval(pvt, scrubval);

Separating the vendor check as an "else if (pvt->vendor ==
X86_VENDOR_HYGON)" block would make architectural changes (future
hygon models, i.e. 19h, 20h, etc) less confusing.



> +   amd64_read_pci_cfg(pvt->F6,
> +   F17H_SCR_BASE_ADDR, );
> +   if (scrubval & BIT(0)) {
> +   amd64_read_pci_cfg(pvt->F6,

The new lines after "amd64_read_pci_cfg(pvt->F6," can be removed.



> @@ -1051,6 +1065,16 @@ static void determine_memory_type(struct amd64_pvt 
> *pvt)
> else
> pvt->dram_type = MEM_DDR4;
> return;
> +   case 0x18:
> +   if (pvt->vendor == X86_VENDOR_HYGON) {

This vendor checking is not necessary as there are no other known
family 18h processors.


> switch (pvt->fam) {
> @@ -3192,6 +3227,13 @@ static struct amd64_family_type 
> *per_family_init(struct amd64_pvt *pvt)
> pvt->ops= _types[F17_CPUS].ops;
> break;
>
> +   case 0x18:
> +   if (pvt->vendor == X86_VENDOR_HYGON) {
> +   fam_type= _types[HYGON_F18_CPUS];
> +   pvt->ops= _types[HYGON_F18_CPUS].ops;
> +   break;
> +   }

There is a missing second 'break' statement after the "if (pvt->vendor
== X86_VENDOR_HYGON)" block for case 0x18, see case 0x15 and case 0x16
for comparison.



> diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c
> index 2ab4d61..f7adc47 100644
> +   case 0x18:
> +   if (c->x86_vendor == X86_VENDOR_HYGON) {
> +   xec_mask = 0x3f;
> +   if (!boot_cpu_has(X86_FEATURE_SMCA)) {
> +   pr_warn("Decoding supported only on Scalable 
> MCA processors.\n");
> +   goto err_out;
> +   }
> +   break;
> +   }

The 'break' statement could be moved outside of the "if (c->x86_vendor
== X86_VENDOR_HYGON)" block, this is to allow case 0x18 to reach the
'break' statement if the vendor is not X86_VENDOR_HYGON.


Re: [PATCH v3 16/17] driver/edac: enable Hygon support to AMD64 EDAC driver

2018-08-11 Thread Michael Jin
On Sat, Aug 11, 2018 at 9:30 AM, Pu Wen  wrote:
> diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
> index 18aeabb..fb81354 100644
> --- a/drivers/edac/amd64_edac.c
> +++ b/drivers/edac/amd64_edac.c
> @@ -211,7 +211,7 @@ static int __set_scrub_rate(struct amd64_pvt *pvt, u32 
> new_bw, u32 min_rate)
>
> scrubval = scrubrates[i].scrubval;
>
> -   if (pvt->fam == 0x17) {
> +   if (pvt->fam == 0x17 || pvt->vendor == X86_VENDOR_HYGON) {
> __f17h_set_scrubval(pvt, scrubval);

Separating the vendor check as an "else if (pvt->vendor ==
X86_VENDOR_HYGON)" block would make architectural changes (future
hygon models, i.e. 19h, 20h, etc) less confusing.



> +   amd64_read_pci_cfg(pvt->F6,
> +   F17H_SCR_BASE_ADDR, );
> +   if (scrubval & BIT(0)) {
> +   amd64_read_pci_cfg(pvt->F6,

The new lines after "amd64_read_pci_cfg(pvt->F6," can be removed.



> @@ -1051,6 +1065,16 @@ static void determine_memory_type(struct amd64_pvt 
> *pvt)
> else
> pvt->dram_type = MEM_DDR4;
> return;
> +   case 0x18:
> +   if (pvt->vendor == X86_VENDOR_HYGON) {

This vendor checking is not necessary as there are no other known
family 18h processors.


> switch (pvt->fam) {
> @@ -3192,6 +3227,13 @@ static struct amd64_family_type 
> *per_family_init(struct amd64_pvt *pvt)
> pvt->ops= _types[F17_CPUS].ops;
> break;
>
> +   case 0x18:
> +   if (pvt->vendor == X86_VENDOR_HYGON) {
> +   fam_type= _types[HYGON_F18_CPUS];
> +   pvt->ops= _types[HYGON_F18_CPUS].ops;
> +   break;
> +   }

There is a missing second 'break' statement after the "if (pvt->vendor
== X86_VENDOR_HYGON)" block for case 0x18, see case 0x15 and case 0x16
for comparison.



> diff --git a/drivers/edac/mce_amd.c b/drivers/edac/mce_amd.c
> index 2ab4d61..f7adc47 100644
> +   case 0x18:
> +   if (c->x86_vendor == X86_VENDOR_HYGON) {
> +   xec_mask = 0x3f;
> +   if (!boot_cpu_has(X86_FEATURE_SMCA)) {
> +   pr_warn("Decoding supported only on Scalable 
> MCA processors.\n");
> +   goto err_out;
> +   }
> +   break;
> +   }

The 'break' statement could be moved outside of the "if (c->x86_vendor
== X86_VENDOR_HYGON)" block, this is to allow case 0x18 to reach the
'break' statement if the vendor is not X86_VENDOR_HYGON.


Re: i2c:ocores: fixes and polling mechanism

2018-08-11 Thread Federico Vaga
Hello,

sorry to disturb you all but after one month and a half I never received 
any comment about this patch set and I fear it ended up in a forgotten 
corner. I would like to know if someone is considering it or not.

Thanks :)

On Monday, June 25, 2018 6:13:00 PM CEST Federico Vaga wrote:
> The first two patches fix what I believe are bugs.
> 
> The third patch add a polling mechanism for those systems where
> interrupts are not available.
> 
> All these patches have been tested on a system without interrupt, this
> means that I used my third patch to validate also the other two.
> I would be nice if someone can run verify this also on other system,
> perhaps with interrupts. If you consider it a useful information, I'm not
> using devicetree for this installation.


-- 
Federico Vaga
[BE-CO-HT]




Re: i2c:ocores: fixes and polling mechanism

2018-08-11 Thread Federico Vaga
Hello,

sorry to disturb you all but after one month and a half I never received 
any comment about this patch set and I fear it ended up in a forgotten 
corner. I would like to know if someone is considering it or not.

Thanks :)

On Monday, June 25, 2018 6:13:00 PM CEST Federico Vaga wrote:
> The first two patches fix what I believe are bugs.
> 
> The third patch add a polling mechanism for those systems where
> interrupts are not available.
> 
> All these patches have been tested on a system without interrupt, this
> means that I used my third patch to validate also the other two.
> I would be nice if someone can run verify this also on other system,
> perhaps with interrupts. If you consider it a useful information, I'm not
> using devicetree for this installation.


-- 
Federico Vaga
[BE-CO-HT]




WARNING in kvm_set_tsc_khz

2018-08-11 Thread syzbot

Hello,

syzbot found the following crash on:

HEAD commit:2b769bb85b48 Add linux-next specific files for 20180807
git tree:   linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=154d667240
kernel config:  https://syzkaller.appspot.com/x/.config?x=547d800b8773c2c5
dashboard link: https://syzkaller.appspot.com/bug?extid=c03f30b4f4c46bdf8575
compiler:   gcc (GCC) 8.0.1 20180413 (experimental)
syzkaller repro:https://syzkaller.appspot.com/x/repro.syz?x=120b867240
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=13203f7840

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+c03f30b4f4c46bdf8...@syzkaller.appspotmail.com

random: sshd: uninitialized urandom read (32 bytes read)
urandom_read: 1 callbacks suppressed
random: sshd: uninitialized urandom read (32 bytes read)
[ cut here ]
user requested TSC rate below hardware speed
WARNING: CPU: 1 PID: 4340 at arch/x86/kvm/x86.c:1414 set_tsc_khz  
arch/x86/kvm/x86.c:1414 [inline]
WARNING: CPU: 1 PID: 4340 at arch/x86/kvm/x86.c:1414  
kvm_set_tsc_khz+0x4f1/0x540 arch/x86/kvm/x86.c:1463

Kernel panic - not syncing: panic_on_warn set ...

CPU: 1 PID: 4340 Comm: syz-executor003 Not tainted  
4.18.0-rc8-next-20180807+ #33
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011

Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1c9/0x2b4 lib/dump_stack.c:113
 panic+0x238/0x4e7 kernel/panic.c:184
 __warn.cold.8+0x163/0x1ba kernel/panic.c:536
 report_bug+0x252/0x2d0 lib/bug.c:186
 fixup_bug arch/x86/kernel/traps.c:178 [inline]
 do_error_trap+0x1fc/0x4d0 arch/x86/kernel/traps.c:296
 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:316
 invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:996
RIP: 0010:set_tsc_khz arch/x86/kvm/x86.c:1414 [inline]
RIP: 0010:kvm_set_tsc_khz+0x4f1/0x540 arch/x86/kvm/x86.c:1463
Code: c7 c7 40 1a 02 87 c6 05 77 b6 79 07 01 e8 67 6a 3b 00 0f 0b e9 ed fd  
ff ff e8 6b d1 70 00 48 c7 c7 e0 19 02 87 e8 4f 6a 3b 00 <0f> 0b bb ff ff  
ff ff e9 d0 fd ff ff 89 45 d0 e8 4b cf af 00 8b 45

RSP: 0018:8801bf3c7398 EFLAGS: 00010286
RAX:  RBX: 0023185f RCX: 
RDX:  RSI: 8163ec91 RDI: 8801bf3c7088
RBP: 8801bf3c73d8 R08: 8801b0b3e400 R09: fbfff0ff1288
R10: fbfff0ff1288 R11: 87f89443 R12: 8801ae6e8040
R13: 002315b8 R14: 0023185f R15: 
 kvm_arch_vcpu_init+0x269/0x830 arch/x86/kvm/x86.c:8702
 kvm_vcpu_init+0x2fb/0x420 arch/x86/kvm/../../../virt/kvm/kvm_main.c:317
 vmx_create_vcpu+0x14c/0x28b0 arch/x86/kvm/vmx.c:10691
 kvm_arch_vcpu_create+0xe5/0x220 arch/x86/kvm/x86.c:8401
 kvm_vm_ioctl_create_vcpu arch/x86/kvm/../../../virt/kvm/kvm_main.c:2476  
[inline]

 kvm_vm_ioctl+0x488/0x1d80 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2977
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0x1de/0x1720 fs/ioctl.c:685
 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:702
 __do_sys_ioctl fs/ioctl.c:709 [inline]
 __se_sys_ioctl fs/ioctl.c:707 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:707
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x440109
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 89 f8 48 89 f7  
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff  
ff 0f 83 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00

RSP: 002b:7ffda4f501e8 EFLAGS: 0217 ORIG_RAX: 0010
RAX: ffda RBX: 004002c8 RCX: 00440109
RDX:  RSI: ae41 RDI: 0004
RBP: 006ca018 R08: 004002c8 R09: 004002c8
R10:  R11: 0217 R12: 00401990
R13: 00401a20 R14:  R15: 
Dumping ftrace buffer:
   (ftrace buffer empty)
Kernel Offset: disabled
Rebooting in 86400 seconds..


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkal...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with  
syzbot.

syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches


WARNING in kvm_set_tsc_khz

2018-08-11 Thread syzbot

Hello,

syzbot found the following crash on:

HEAD commit:2b769bb85b48 Add linux-next specific files for 20180807
git tree:   linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=154d667240
kernel config:  https://syzkaller.appspot.com/x/.config?x=547d800b8773c2c5
dashboard link: https://syzkaller.appspot.com/bug?extid=c03f30b4f4c46bdf8575
compiler:   gcc (GCC) 8.0.1 20180413 (experimental)
syzkaller repro:https://syzkaller.appspot.com/x/repro.syz?x=120b867240
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=13203f7840

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+c03f30b4f4c46bdf8...@syzkaller.appspotmail.com

random: sshd: uninitialized urandom read (32 bytes read)
urandom_read: 1 callbacks suppressed
random: sshd: uninitialized urandom read (32 bytes read)
[ cut here ]
user requested TSC rate below hardware speed
WARNING: CPU: 1 PID: 4340 at arch/x86/kvm/x86.c:1414 set_tsc_khz  
arch/x86/kvm/x86.c:1414 [inline]
WARNING: CPU: 1 PID: 4340 at arch/x86/kvm/x86.c:1414  
kvm_set_tsc_khz+0x4f1/0x540 arch/x86/kvm/x86.c:1463

Kernel panic - not syncing: panic_on_warn set ...

CPU: 1 PID: 4340 Comm: syz-executor003 Not tainted  
4.18.0-rc8-next-20180807+ #33
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS  
Google 01/01/2011

Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1c9/0x2b4 lib/dump_stack.c:113
 panic+0x238/0x4e7 kernel/panic.c:184
 __warn.cold.8+0x163/0x1ba kernel/panic.c:536
 report_bug+0x252/0x2d0 lib/bug.c:186
 fixup_bug arch/x86/kernel/traps.c:178 [inline]
 do_error_trap+0x1fc/0x4d0 arch/x86/kernel/traps.c:296
 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:316
 invalid_op+0x14/0x20 arch/x86/entry/entry_64.S:996
RIP: 0010:set_tsc_khz arch/x86/kvm/x86.c:1414 [inline]
RIP: 0010:kvm_set_tsc_khz+0x4f1/0x540 arch/x86/kvm/x86.c:1463
Code: c7 c7 40 1a 02 87 c6 05 77 b6 79 07 01 e8 67 6a 3b 00 0f 0b e9 ed fd  
ff ff e8 6b d1 70 00 48 c7 c7 e0 19 02 87 e8 4f 6a 3b 00 <0f> 0b bb ff ff  
ff ff e9 d0 fd ff ff 89 45 d0 e8 4b cf af 00 8b 45

RSP: 0018:8801bf3c7398 EFLAGS: 00010286
RAX:  RBX: 0023185f RCX: 
RDX:  RSI: 8163ec91 RDI: 8801bf3c7088
RBP: 8801bf3c73d8 R08: 8801b0b3e400 R09: fbfff0ff1288
R10: fbfff0ff1288 R11: 87f89443 R12: 8801ae6e8040
R13: 002315b8 R14: 0023185f R15: 
 kvm_arch_vcpu_init+0x269/0x830 arch/x86/kvm/x86.c:8702
 kvm_vcpu_init+0x2fb/0x420 arch/x86/kvm/../../../virt/kvm/kvm_main.c:317
 vmx_create_vcpu+0x14c/0x28b0 arch/x86/kvm/vmx.c:10691
 kvm_arch_vcpu_create+0xe5/0x220 arch/x86/kvm/x86.c:8401
 kvm_vm_ioctl_create_vcpu arch/x86/kvm/../../../virt/kvm/kvm_main.c:2476  
[inline]

 kvm_vm_ioctl+0x488/0x1d80 arch/x86/kvm/../../../virt/kvm/kvm_main.c:2977
 vfs_ioctl fs/ioctl.c:46 [inline]
 file_ioctl fs/ioctl.c:501 [inline]
 do_vfs_ioctl+0x1de/0x1720 fs/ioctl.c:685
 ksys_ioctl+0xa9/0xd0 fs/ioctl.c:702
 __do_sys_ioctl fs/ioctl.c:709 [inline]
 __se_sys_ioctl fs/ioctl.c:707 [inline]
 __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:707
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x440109
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 48 89 f8 48 89 f7  
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff  
ff 0f 83 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00

RSP: 002b:7ffda4f501e8 EFLAGS: 0217 ORIG_RAX: 0010
RAX: ffda RBX: 004002c8 RCX: 00440109
RDX:  RSI: ae41 RDI: 0004
RBP: 006ca018 R08: 004002c8 R09: 004002c8
R10:  R11: 0217 R12: 00401990
R13: 00401a20 R14:  R15: 
Dumping ftrace buffer:
   (ftrace buffer empty)
Kernel Offset: disabled
Rebooting in 86400 seconds..


---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkal...@googlegroups.com.

syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#bug-status-tracking for how to communicate with  
syzbot.

syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches


[PATCH v2] staging: netlogic: Fixed comments to include SPDX-License-Identifier

2018-08-11 Thread Michael Anckaert
This patch fixes some issues with missing SPDX-License-Identifier comments. 

Signed-off-by: Michael Anckaert 
---

Changes in v2:
 - Removed unrelated change to different patch.

 drivers/staging/netlogic/platform_net.c | 1 +
 drivers/staging/netlogic/platform_net.h | 1 +
 drivers/staging/netlogic/xlr_net.c  | 1 +
 drivers/staging/netlogic/xlr_net.h  | 1 +
 4 files changed, 4 insertions(+)

diff --git a/drivers/staging/netlogic/platform_net.c 
b/drivers/staging/netlogic/platform_net.c
index abf4c71ee66b..3886c99c1f68 100644
--- a/drivers/staging/netlogic/platform_net.c
+++ b/drivers/staging/netlogic/platform_net.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2003-2012 Broadcom Corporation
  * All Rights Reserved
diff --git a/drivers/staging/netlogic/platform_net.h 
b/drivers/staging/netlogic/platform_net.h
index e1b27f649590..1d994f0d0995 100644
--- a/drivers/staging/netlogic/platform_net.h
+++ b/drivers/staging/netlogic/platform_net.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Copyright (c) 2003-2012 Broadcom Corporation
  * All Rights Reserved
diff --git a/drivers/staging/netlogic/xlr_net.c 
b/drivers/staging/netlogic/xlr_net.c
index e461168313bf..201db10692de 100644
--- a/drivers/staging/netlogic/xlr_net.c
+++ b/drivers/staging/netlogic/xlr_net.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2003-2012 Broadcom Corporation
  * All Rights Reserved
diff --git a/drivers/staging/netlogic/xlr_net.h 
b/drivers/staging/netlogic/xlr_net.h
index f76e16cfd15d..de51d64c1f23 100644
--- a/drivers/staging/netlogic/xlr_net.h
+++ b/drivers/staging/netlogic/xlr_net.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Copyright (c) 2003-2012 Broadcom Corporation
  * All Rights Reserved
-- 
2.17.1



[PATCH v2] staging: netlogic: Fixed comments to include SPDX-License-Identifier

2018-08-11 Thread Michael Anckaert
This patch fixes some issues with missing SPDX-License-Identifier comments. 

Signed-off-by: Michael Anckaert 
---

Changes in v2:
 - Removed unrelated change to different patch.

 drivers/staging/netlogic/platform_net.c | 1 +
 drivers/staging/netlogic/platform_net.h | 1 +
 drivers/staging/netlogic/xlr_net.c  | 1 +
 drivers/staging/netlogic/xlr_net.h  | 1 +
 4 files changed, 4 insertions(+)

diff --git a/drivers/staging/netlogic/platform_net.c 
b/drivers/staging/netlogic/platform_net.c
index abf4c71ee66b..3886c99c1f68 100644
--- a/drivers/staging/netlogic/platform_net.c
+++ b/drivers/staging/netlogic/platform_net.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2003-2012 Broadcom Corporation
  * All Rights Reserved
diff --git a/drivers/staging/netlogic/platform_net.h 
b/drivers/staging/netlogic/platform_net.h
index e1b27f649590..1d994f0d0995 100644
--- a/drivers/staging/netlogic/platform_net.h
+++ b/drivers/staging/netlogic/platform_net.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Copyright (c) 2003-2012 Broadcom Corporation
  * All Rights Reserved
diff --git a/drivers/staging/netlogic/xlr_net.c 
b/drivers/staging/netlogic/xlr_net.c
index e461168313bf..201db10692de 100644
--- a/drivers/staging/netlogic/xlr_net.c
+++ b/drivers/staging/netlogic/xlr_net.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2003-2012 Broadcom Corporation
  * All Rights Reserved
diff --git a/drivers/staging/netlogic/xlr_net.h 
b/drivers/staging/netlogic/xlr_net.h
index f76e16cfd15d..de51d64c1f23 100644
--- a/drivers/staging/netlogic/xlr_net.h
+++ b/drivers/staging/netlogic/xlr_net.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Copyright (c) 2003-2012 Broadcom Corporation
  * All Rights Reserved
-- 
2.17.1



Re: [PATCH] cpuidle: menu: Handle stopped tick more aggressively

2018-08-11 Thread kbuild test robot
Hi Rafael,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pm/linux-next]
[also build test WARNING on v4.18-rc8 next-20180810]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Rafael-J-Wysocki/cpuidle-menu-Handle-stopped-tick-more-aggressively/20180811-191914
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git 
linux-next
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=mips 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   drivers/cpuidle/governors/menu.c: In function 'menu_select':
>> drivers/cpuidle/governors/menu.c:289:6: warning: 'first_idx' may be used 
>> uninitialized in this function [-Wmaybe-uninitialized]
 int first_idx;
 ^

vim +/first_idx +289 drivers/cpuidle/governors/menu.c

1f85f87d4 Arjan van de Ven  2010-05-24  276  
4f86d3a8e Len Brown 2007-10-03  277  /**
4f86d3a8e Len Brown 2007-10-03  278   * menu_select - 
selects the next idle state to enter
46bcfad7a Deepthi Dharwar   2011-10-28  279   * @drv: cpuidle 
driver containing state data
4f86d3a8e Len Brown 2007-10-03  280   * @dev: the CPU
45f1ff59e Rafael J. Wysocki 2018-03-22  281   * @stop_tick: 
indication on whether or not to stop the tick
4f86d3a8e Len Brown 2007-10-03  282   */
45f1ff59e Rafael J. Wysocki 2018-03-22  283  static int 
menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
45f1ff59e Rafael J. Wysocki 2018-03-22  284
bool *stop_tick)
4f86d3a8e Len Brown 2007-10-03  285  {
229b6863b Christoph Lameter 2014-08-17  286 struct 
menu_device *data = this_cpu_ptr(_devices);
0fc784fb0 Rafael J. Wysocki 2018-05-30  287 int latency_req 
= cpuidle_governor_latency_req(dev->cpu);
4f86d3a8e Len Brown 2007-10-03  288 int i;
3ed09c945 Nicholas Piggin   2017-06-26 @289 int first_idx;
3ed09c945 Nicholas Piggin   2017-06-26  290 int idx;
96e95182e tuukka.tikka...@linaro.org2014-02-24  291 unsigned int 
interactivity_req;
e132b9b3b Rik van Riel  2016-03-16  292 unsigned int 
expected_interval;
372ba8cb4 Mel Gorman2014-08-06  293 unsigned long 
nr_iowaiters, cpu_load;
296bb1e51 Rafael J. Wysocki 2018-04-05  294 ktime_t 
delta_next;
4f86d3a8e Len Brown 2007-10-03  295  
672917dcc Corrado Zoccolo   2009-09-21  296 if 
(data->needs_update) {
46bcfad7a Deepthi Dharwar   2011-10-28  297 
menu_update(drv, dev);
672917dcc Corrado Zoccolo   2009-09-21  298 
data->needs_update = 0;
672917dcc Corrado Zoccolo   2009-09-21  299 }
672917dcc Corrado Zoccolo   2009-09-21  300  
69d25870f Arjan van de Ven  2009-09-21  301 /* Special case 
when user has set very strict latency requirement */
45f1ff59e Rafael J. Wysocki 2018-03-22  302 if 
(unlikely(latency_req == 0)) {
45f1ff59e Rafael J. Wysocki 2018-03-22  303 
*stop_tick = false;
a2bd92023 venkatesh.pallip...@intel.com 2008-07-30  304 return 
0;
45f1ff59e Rafael J. Wysocki 2018-03-22  305 }
a2bd92023 venkatesh.pallip...@intel.com 2008-07-30  306  
69d25870f Arjan van de Ven  2009-09-21  307 /* determine 
the expected residency time, round up */
296bb1e51 Rafael J. Wysocki 2018-04-05  308 
data->next_timer_us = ktime_to_us(tick_nohz_get_sleep_length(_next));
69d25870f Arjan van de Ven  2009-09-21  309  
5f9f09809 Rafael J. Wysocki 2018-08-10  310 /*
5f9f09809 Rafael J. Wysocki 2018-08-10  311  * If the tick 
is already stopped, the cost of possible short idle
5f9f09809 Rafael J. Wysocki 2018-08-10  312  * duration 
misprediction is much higher, because the CPU may be stuck
5f9f09809 Rafael J. Wysocki 2018-08-10  313  * in a shallow 
idle state for a long time as a result of it.  In that
5f9f09809 Rafael J. Wysocki 2018-08-10  314  * case say we 
might mispredict and use the known time till the closest
5f9f09809 Rafa

Re: [PATCH] cpuidle: menu: Handle stopped tick more aggressively

2018-08-11 Thread kbuild test robot
Hi Rafael,

I love your patch! Perhaps something to improve:

[auto build test WARNING on pm/linux-next]
[also build test WARNING on v4.18-rc8 next-20180810]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Rafael-J-Wysocki/cpuidle-menu-Handle-stopped-tick-more-aggressively/20180811-191914
base:   https://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm.git 
linux-next
config: mips-allyesconfig (attached as .config)
compiler: mips-linux-gnu-gcc (Debian 7.2.0-11) 7.2.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=7.2.0 make.cross ARCH=mips 

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

   drivers/cpuidle/governors/menu.c: In function 'menu_select':
>> drivers/cpuidle/governors/menu.c:289:6: warning: 'first_idx' may be used 
>> uninitialized in this function [-Wmaybe-uninitialized]
 int first_idx;
 ^

vim +/first_idx +289 drivers/cpuidle/governors/menu.c

1f85f87d4 Arjan van de Ven  2010-05-24  276  
4f86d3a8e Len Brown 2007-10-03  277  /**
4f86d3a8e Len Brown 2007-10-03  278   * menu_select - 
selects the next idle state to enter
46bcfad7a Deepthi Dharwar   2011-10-28  279   * @drv: cpuidle 
driver containing state data
4f86d3a8e Len Brown 2007-10-03  280   * @dev: the CPU
45f1ff59e Rafael J. Wysocki 2018-03-22  281   * @stop_tick: 
indication on whether or not to stop the tick
4f86d3a8e Len Brown 2007-10-03  282   */
45f1ff59e Rafael J. Wysocki 2018-03-22  283  static int 
menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev,
45f1ff59e Rafael J. Wysocki 2018-03-22  284
bool *stop_tick)
4f86d3a8e Len Brown 2007-10-03  285  {
229b6863b Christoph Lameter 2014-08-17  286 struct 
menu_device *data = this_cpu_ptr(_devices);
0fc784fb0 Rafael J. Wysocki 2018-05-30  287 int latency_req 
= cpuidle_governor_latency_req(dev->cpu);
4f86d3a8e Len Brown 2007-10-03  288 int i;
3ed09c945 Nicholas Piggin   2017-06-26 @289 int first_idx;
3ed09c945 Nicholas Piggin   2017-06-26  290 int idx;
96e95182e tuukka.tikka...@linaro.org2014-02-24  291 unsigned int 
interactivity_req;
e132b9b3b Rik van Riel  2016-03-16  292 unsigned int 
expected_interval;
372ba8cb4 Mel Gorman2014-08-06  293 unsigned long 
nr_iowaiters, cpu_load;
296bb1e51 Rafael J. Wysocki 2018-04-05  294 ktime_t 
delta_next;
4f86d3a8e Len Brown 2007-10-03  295  
672917dcc Corrado Zoccolo   2009-09-21  296 if 
(data->needs_update) {
46bcfad7a Deepthi Dharwar   2011-10-28  297 
menu_update(drv, dev);
672917dcc Corrado Zoccolo   2009-09-21  298 
data->needs_update = 0;
672917dcc Corrado Zoccolo   2009-09-21  299 }
672917dcc Corrado Zoccolo   2009-09-21  300  
69d25870f Arjan van de Ven  2009-09-21  301 /* Special case 
when user has set very strict latency requirement */
45f1ff59e Rafael J. Wysocki 2018-03-22  302 if 
(unlikely(latency_req == 0)) {
45f1ff59e Rafael J. Wysocki 2018-03-22  303 
*stop_tick = false;
a2bd92023 venkatesh.pallip...@intel.com 2008-07-30  304 return 
0;
45f1ff59e Rafael J. Wysocki 2018-03-22  305 }
a2bd92023 venkatesh.pallip...@intel.com 2008-07-30  306  
69d25870f Arjan van de Ven  2009-09-21  307 /* determine 
the expected residency time, round up */
296bb1e51 Rafael J. Wysocki 2018-04-05  308 
data->next_timer_us = ktime_to_us(tick_nohz_get_sleep_length(_next));
69d25870f Arjan van de Ven  2009-09-21  309  
5f9f09809 Rafael J. Wysocki 2018-08-10  310 /*
5f9f09809 Rafael J. Wysocki 2018-08-10  311  * If the tick 
is already stopped, the cost of possible short idle
5f9f09809 Rafael J. Wysocki 2018-08-10  312  * duration 
misprediction is much higher, because the CPU may be stuck
5f9f09809 Rafael J. Wysocki 2018-08-10  313  * in a shallow 
idle state for a long time as a result of it.  In that
5f9f09809 Rafael J. Wysocki 2018-08-10  314  * case say we 
might mispredict and use the known time till the closest
5f9f09809 Rafa

Re: [PATCH] staging: netlogic: Fixed comments to include SPDX-License-Identifier

2018-08-11 Thread Greg KH
On Sat, Aug 11, 2018 at 06:15:05PM +0200, Michael Anckaert wrote:
> This patch fixes some issues with missing SPDX-License-Identifier
> comments. 
> 
> Disclaimer: this is my first patch and instructions were taken from the
> KernelNewbies project. 

This does not belong in a changelog comment.  If you want to put info
like this, put it below the --- line.

> 
> Signed-off-by: Michael Anckaert 
> ---
>  drivers/staging/netlogic/Kconfig| 6 +++---
>  drivers/staging/netlogic/platform_net.c | 1 +
>  drivers/staging/netlogic/platform_net.h | 1 +
>  drivers/staging/netlogic/xlr_net.c  | 1 +
>  drivers/staging/netlogic/xlr_net.h  | 1 +
>  5 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/netlogic/Kconfig 
> b/drivers/staging/netlogic/Kconfig
> index d660de51b541..ab0b756bc08b 100644
> --- a/drivers/staging/netlogic/Kconfig
> +++ b/drivers/staging/netlogic/Kconfig
> @@ -2,6 +2,6 @@ config NETLOGIC_XLR_NET
>   tristate "Netlogic XLR/XLS network device"
>   depends on CPU_XLR
>   select PHYLIB
> - ---help---
> - This driver support Netlogic XLR/XLS on chip gigabit
> - Ethernet.
> + help
> + This driver support Netlogic XLR/XLS on chip gigabit
> + Ethernet.

This change has nothing to do with spdx identifiers :(

Please fix up and resend as 2 different patches.

thanks,

greg k-h


Re: [PATCH] staging: netlogic: Fixed comments to include SPDX-License-Identifier

2018-08-11 Thread Greg KH
On Sat, Aug 11, 2018 at 06:15:05PM +0200, Michael Anckaert wrote:
> This patch fixes some issues with missing SPDX-License-Identifier
> comments. 
> 
> Disclaimer: this is my first patch and instructions were taken from the
> KernelNewbies project. 

This does not belong in a changelog comment.  If you want to put info
like this, put it below the --- line.

> 
> Signed-off-by: Michael Anckaert 
> ---
>  drivers/staging/netlogic/Kconfig| 6 +++---
>  drivers/staging/netlogic/platform_net.c | 1 +
>  drivers/staging/netlogic/platform_net.h | 1 +
>  drivers/staging/netlogic/xlr_net.c  | 1 +
>  drivers/staging/netlogic/xlr_net.h  | 1 +
>  5 files changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/netlogic/Kconfig 
> b/drivers/staging/netlogic/Kconfig
> index d660de51b541..ab0b756bc08b 100644
> --- a/drivers/staging/netlogic/Kconfig
> +++ b/drivers/staging/netlogic/Kconfig
> @@ -2,6 +2,6 @@ config NETLOGIC_XLR_NET
>   tristate "Netlogic XLR/XLS network device"
>   depends on CPU_XLR
>   select PHYLIB
> - ---help---
> - This driver support Netlogic XLR/XLS on chip gigabit
> - Ethernet.
> + help
> + This driver support Netlogic XLR/XLS on chip gigabit
> + Ethernet.

This change has nothing to do with spdx identifiers :(

Please fix up and resend as 2 different patches.

thanks,

greg k-h


[PATCH] arm64: dts: sdm630 SoC and Sony Pioneer (Xperia XA2) support

2018-08-11 Thread Craig Tatlor
Initial device tree support for Qualcomm SDM630 SoC and
Sony Pioneer (Xperia XA2).

SDM630 is based off of the SDM660 soc and all SDM660 specific drivers are
compatible with it. SDM660 is also based off of MSM8998 so it uses some
of its drivers aswell.

The device tree is based on the CAF 4.4 kernel tree.

The device can be booted into the initrd with a shell over UART.

Signed-off-by: Craig Tatlor 
---
 arch/arm64/boot/dts/qcom/Makefile|   1 +
 arch/arm64/boot/dts/qcom/sdm630-pins.dtsi|  17 +
 arch/arm64/boot/dts/qcom/sdm630-pioneer.dts  |  16 +
 arch/arm64/boot/dts/qcom/sdm630-pioneer.dtsi |  22 ++
 arch/arm64/boot/dts/qcom/sdm630.dtsi | 383 +++
 5 files changed, 439 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/sdm630-pins.dtsi
 create mode 100644 arch/arm64/boot/dts/qcom/sdm630-pioneer.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sdm630-pioneer.dtsi
 create mode 100644 arch/arm64/boot/dts/qcom/sdm630.dtsi

diff --git a/arch/arm64/boot/dts/qcom/Makefile 
b/arch/arm64/boot/dts/qcom/Makefile
index 9319e74b8906..80f98bb19998 100644
--- a/arch/arm64/boot/dts/qcom/Makefile
+++ b/arch/arm64/boot/dts/qcom/Makefile
@@ -6,4 +6,5 @@ dtb-$(CONFIG_ARCH_QCOM) += msm8916-mtp.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= msm8992-bullhead-rev-101.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= msm8994-angler-rev-101.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= msm8996-mtp.dtb
+dtb-$(CONFIG_ARCH_QCOM)+= sdm630-pioneer.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sdm845-mtp.dtb
diff --git a/arch/arm64/boot/dts/qcom/sdm630-pins.dtsi 
b/arch/arm64/boot/dts/qcom/sdm630-pins.dtsi
new file mode 100644
index ..78b79c1076f1
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/sdm630-pins.dtsi
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2018, Craig Tatlor. */
+
+ {
+   blsp1_uart1_default: blsp1_uart1_default {
+   pinmux {
+   pins = "gpio0", "gpio1", "gpio2", "gpio3";
+   function = "gpio";
+   };
+
+   pinconf {
+   pins = "gpio0", "gpio1", "gpio2", "gpio3";
+   drive-strength = <2>;
+   bias-disable;
+   };
+   };
+};
diff --git a/arch/arm64/boot/dts/qcom/sdm630-pioneer.dts 
b/arch/arm64/boot/dts/qcom/sdm630-pioneer.dts
new file mode 100644
index ..67c7e3b57739
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/sdm630-pioneer.dts
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2018, Craig Tatlor. */
+
+/dts-v1/;
+
+#include "sdm630-pioneer.dtsi"
+
+/ {
+   model = "Sony Xperia XA2";
+   compatible = "sony,pioneer", "qcom,sdm630";
+
+   /* required for bootloader to select correct board */
+   qcom,board-id = <8 0>;
+   qcom,pmic-id = <0x0001001b 0x0101011a 0x0 0x0>,
+   <0x0001001b 0x0201011a 0x0 0x0>;
+};
diff --git a/arch/arm64/boot/dts/qcom/sdm630-pioneer.dtsi 
b/arch/arm64/boot/dts/qcom/sdm630-pioneer.dtsi
new file mode 100644
index ..512792c23369
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/sdm630-pioneer.dtsi
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2018, Craig Tatlor. */
+
+#include "sdm630.dtsi"
+
+/ {
+   aliases {
+   serial0 = _uart1;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+};
+
+ {
+   serial@c17 {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_uart1_default>;
+   };
+};
diff --git a/arch/arm64/boot/dts/qcom/sdm630.dtsi 
b/arch/arm64/boot/dts/qcom/sdm630.dtsi
new file mode 100644
index ..8a544979b7c0
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/sdm630.dtsi
@@ -0,0 +1,383 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2018, Craig Tatlor. */
+
+#include 
+#include 
+
+/ {
+   model = "Qualcomm Technologies, Inc. SDM630";
+
+   interrupt-parent = <>;
+
+   qcom,msm-id = <318 0x0>;
+
+   #address-cells = <2>;
+   #size-cells = <2>;
+
+   chosen { };
+
+   memory {
+   device_type = "memory";
+   /* We expect the bootloader to fill in the reg */
+   reg = <0 0 0 0>;
+   };
+
+
+   cpus {
+   #address-cells = <2>;
+   #size-cells = <0>;
+
+   CPU0: cpu@100 {
+   device_type = "cpu";
+   compatible = "arm,armv8";
+   reg = <0x0 0x100>;
+   enable-method = "psci";
+   efficiency = <1126>;
+   next-level-cache = <_1>;
+   L2_1: l2-cache {
+   compatible = "arm,arch-cache";
+   cache-level = <2>;
+   };
+   L1_I_100: l1-icache {
+   compatible = "arm,arch-cache";
+   

[PATCH] arm64: dts: sdm630 SoC and Sony Pioneer (Xperia XA2) support

2018-08-11 Thread Craig Tatlor
Initial device tree support for Qualcomm SDM630 SoC and
Sony Pioneer (Xperia XA2).

SDM630 is based off of the SDM660 soc and all SDM660 specific drivers are
compatible with it. SDM660 is also based off of MSM8998 so it uses some
of its drivers aswell.

The device tree is based on the CAF 4.4 kernel tree.

The device can be booted into the initrd with a shell over UART.

Signed-off-by: Craig Tatlor 
---
 arch/arm64/boot/dts/qcom/Makefile|   1 +
 arch/arm64/boot/dts/qcom/sdm630-pins.dtsi|  17 +
 arch/arm64/boot/dts/qcom/sdm630-pioneer.dts  |  16 +
 arch/arm64/boot/dts/qcom/sdm630-pioneer.dtsi |  22 ++
 arch/arm64/boot/dts/qcom/sdm630.dtsi | 383 +++
 5 files changed, 439 insertions(+)
 create mode 100644 arch/arm64/boot/dts/qcom/sdm630-pins.dtsi
 create mode 100644 arch/arm64/boot/dts/qcom/sdm630-pioneer.dts
 create mode 100644 arch/arm64/boot/dts/qcom/sdm630-pioneer.dtsi
 create mode 100644 arch/arm64/boot/dts/qcom/sdm630.dtsi

diff --git a/arch/arm64/boot/dts/qcom/Makefile 
b/arch/arm64/boot/dts/qcom/Makefile
index 9319e74b8906..80f98bb19998 100644
--- a/arch/arm64/boot/dts/qcom/Makefile
+++ b/arch/arm64/boot/dts/qcom/Makefile
@@ -6,4 +6,5 @@ dtb-$(CONFIG_ARCH_QCOM) += msm8916-mtp.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= msm8992-bullhead-rev-101.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= msm8994-angler-rev-101.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= msm8996-mtp.dtb
+dtb-$(CONFIG_ARCH_QCOM)+= sdm630-pioneer.dtb
 dtb-$(CONFIG_ARCH_QCOM)+= sdm845-mtp.dtb
diff --git a/arch/arm64/boot/dts/qcom/sdm630-pins.dtsi 
b/arch/arm64/boot/dts/qcom/sdm630-pins.dtsi
new file mode 100644
index ..78b79c1076f1
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/sdm630-pins.dtsi
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2018, Craig Tatlor. */
+
+ {
+   blsp1_uart1_default: blsp1_uart1_default {
+   pinmux {
+   pins = "gpio0", "gpio1", "gpio2", "gpio3";
+   function = "gpio";
+   };
+
+   pinconf {
+   pins = "gpio0", "gpio1", "gpio2", "gpio3";
+   drive-strength = <2>;
+   bias-disable;
+   };
+   };
+};
diff --git a/arch/arm64/boot/dts/qcom/sdm630-pioneer.dts 
b/arch/arm64/boot/dts/qcom/sdm630-pioneer.dts
new file mode 100644
index ..67c7e3b57739
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/sdm630-pioneer.dts
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2018, Craig Tatlor. */
+
+/dts-v1/;
+
+#include "sdm630-pioneer.dtsi"
+
+/ {
+   model = "Sony Xperia XA2";
+   compatible = "sony,pioneer", "qcom,sdm630";
+
+   /* required for bootloader to select correct board */
+   qcom,board-id = <8 0>;
+   qcom,pmic-id = <0x0001001b 0x0101011a 0x0 0x0>,
+   <0x0001001b 0x0201011a 0x0 0x0>;
+};
diff --git a/arch/arm64/boot/dts/qcom/sdm630-pioneer.dtsi 
b/arch/arm64/boot/dts/qcom/sdm630-pioneer.dtsi
new file mode 100644
index ..512792c23369
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/sdm630-pioneer.dtsi
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2018, Craig Tatlor. */
+
+#include "sdm630.dtsi"
+
+/ {
+   aliases {
+   serial0 = _uart1;
+   };
+
+   chosen {
+   stdout-path = "serial0:115200n8";
+   };
+};
+
+ {
+   serial@c17 {
+   status = "okay";
+   pinctrl-names = "default";
+   pinctrl-0 = <_uart1_default>;
+   };
+};
diff --git a/arch/arm64/boot/dts/qcom/sdm630.dtsi 
b/arch/arm64/boot/dts/qcom/sdm630.dtsi
new file mode 100644
index ..8a544979b7c0
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/sdm630.dtsi
@@ -0,0 +1,383 @@
+// SPDX-License-Identifier: GPL-2.0
+/* Copyright (c) 2018, Craig Tatlor. */
+
+#include 
+#include 
+
+/ {
+   model = "Qualcomm Technologies, Inc. SDM630";
+
+   interrupt-parent = <>;
+
+   qcom,msm-id = <318 0x0>;
+
+   #address-cells = <2>;
+   #size-cells = <2>;
+
+   chosen { };
+
+   memory {
+   device_type = "memory";
+   /* We expect the bootloader to fill in the reg */
+   reg = <0 0 0 0>;
+   };
+
+
+   cpus {
+   #address-cells = <2>;
+   #size-cells = <0>;
+
+   CPU0: cpu@100 {
+   device_type = "cpu";
+   compatible = "arm,armv8";
+   reg = <0x0 0x100>;
+   enable-method = "psci";
+   efficiency = <1126>;
+   next-level-cache = <_1>;
+   L2_1: l2-cache {
+   compatible = "arm,arch-cache";
+   cache-level = <2>;
+   };
+   L1_I_100: l1-icache {
+   compatible = "arm,arch-cache";
+   

[PATCH] pinctrl: qcom: Add sdm660 pinctrl driver

2018-08-11 Thread Craig Tatlor
Add initial pinctrl driver to support pin configuration with
pinctrl framework for sdm660.
Based off CAF implementation.

Signed-off-by: Craig Tatlor 
---
 .../bindings/pinctrl/qcom,sdm660-pinctrl.txt  |  195 +++
 drivers/pinctrl/qcom/Kconfig  |   10 +
 drivers/pinctrl/qcom/Makefile |1 +
 drivers/pinctrl/qcom/pinctrl-sdm660.c | 1451 +
 4 files changed, 1657 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/pinctrl/qcom,sdm660-pinctrl.txt
 create mode 100644 drivers/pinctrl/qcom/pinctrl-sdm660.c

diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,sdm660-pinctrl.txt 
b/Documentation/devicetree/bindings/pinctrl/qcom,sdm660-pinctrl.txt
new file mode 100644
index ..85e6c6c17c04
--- /dev/null
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,sdm660-pinctrl.txt
@@ -0,0 +1,195 @@
+Qualcomm Technologies, Inc. SDM660 TLMM block
+
+This binding describes the Top Level Mode Multiplexer block found in the
+SDM660 platform.
+
+- compatible:
+   Usage: required
+   Value type: 
+   Definition: must be "qcom,sdm660-pinctrl"
+
+- reg:
+   Usage: required
+   Value type: 
+   Definition: the base address and size of the TLMM register space.
+
+- interrupts:
+   Usage: required
+   Value type: 
+   Definition: should specify the TLMM summary IRQ.
+
+- interrupt-controller:
+   Usage: required
+   Value type: 
+   Definition: identifies this node as an interrupt controller
+
+- #interrupt-cells:
+   Usage: required
+   Value type: 
+   Definition: must be 2. Specifying the pin number and flags, as defined
+   in 
+
+- gpio-controller:
+   Usage: required
+   Value type: 
+   Definition: identifies this node as a gpio controller
+
+- #gpio-cells:
+   Usage: required
+   Value type: 
+   Definition: must be 2. Specifying the pin number and flags, as defined
+   in 
+
+Please refer to ../gpio/gpio.txt and ../interrupt-controller/interrupts.txt for
+a general description of GPIO and interrupt bindings.
+
+Please refer to pinctrl-bindings.txt in this directory for details of the
+common pinctrl bindings used by client devices, including the meaning of the
+phrase "pin configuration node".
+
+The pin configuration nodes act as a container for an arbitrary number of
+subnodes. Each of these subnodes represents some desired configuration for a
+pin, a group, or a list of pins or groups. This configuration can include the
+mux function to select on those pin(s)/group(s), and various pin configuration
+parameters, such as pull-up, drive strength, etc.
+
+
+PIN CONFIGURATION NODES:
+
+The name of each subnode is not important; all subnodes should be enumerated
+and processed purely based on their content.
+
+Each subnode only affects those parameters that are explicitly listed. In
+other words, a subnode that lists a mux function but no pin configuration
+parameters implies no information about any pin configuration parameters.
+Similarly, a pin subnode that describes a pullup parameter implies no
+information about e.g. the mux function.
+
+
+The following generic properties as defined in pinctrl-bindings.txt are valid
+to specify in a pin configuration subnode:
+
+- pins:
+   Usage: required
+   Value type: 
+   Definition: List of gpio pins affected by the properties specified in
+   this subnode.  Valid pins are:
+   gpio0-gpio149,
+   Supports mux, bias and drive-strength
+   sdc1_clk, sdc1_cmd, sdc1_data sdc2_clk, sdc2_cmd, sdc2_data 
sdc1_rclk,
+   Supports bias and drive-strength
+
+- function:
+   Usage: required
+   Value type: 
+   Definition: Specify the alternative function to be configured for the
+   specified pins. Functions are only valid for gpio pins.
+   Valid values are:
+
+   blsp_uart1, blsp_spi1, blsp_i2c1, blsp_uim1, atest_tsens,
+   bimc_dte1, dac_calib0, blsp_spi8, blsp_uart8, blsp_uim8,
+   qdss_cti_trig_out_b, bimc_dte0, dac_calib1, 
qdss_cti_trig_in_b,
+   dac_calib2, atest_tsens2, atest_usb1, blsp_spi10, 
blsp_uart10,
+   blsp_uim10, atest_bbrx1, atest_usb13, atest_bbrx0, 
atest_usb12,
+   mdp_vsync, edp_lcd, blsp_i2c10, atest_gpsadc1, atest_usb11,
+   atest_gpsadc0, edp_hot, atest_usb10, m_voc, dac_gpio, 
atest_char,
+   cam_mclk, pll_bypassnl, qdss_stm7, blsp_i2c8, 
qdss_tracedata_b,
+   pll_reset, qdss_stm6, qdss_stm5, qdss_stm4, atest_usb2, 
cci_i2c,
+   qdss_stm3, dac_calib3, atest_usb23, atest_char3, dac_calib4,
+   qdss_stm2, atest_usb22, atest_char2, qdss_stm1, dac_calib5,
+   atest_usb21, atest_char1, dbg_out, qdss_stm0, dac_calib6,
+   

[PATCH] pinctrl: qcom: Add sdm660 pinctrl driver

2018-08-11 Thread Craig Tatlor
Add initial pinctrl driver to support pin configuration with
pinctrl framework for sdm660.
Based off CAF implementation.

Signed-off-by: Craig Tatlor 
---
 .../bindings/pinctrl/qcom,sdm660-pinctrl.txt  |  195 +++
 drivers/pinctrl/qcom/Kconfig  |   10 +
 drivers/pinctrl/qcom/Makefile |1 +
 drivers/pinctrl/qcom/pinctrl-sdm660.c | 1451 +
 4 files changed, 1657 insertions(+)
 create mode 100644 
Documentation/devicetree/bindings/pinctrl/qcom,sdm660-pinctrl.txt
 create mode 100644 drivers/pinctrl/qcom/pinctrl-sdm660.c

diff --git a/Documentation/devicetree/bindings/pinctrl/qcom,sdm660-pinctrl.txt 
b/Documentation/devicetree/bindings/pinctrl/qcom,sdm660-pinctrl.txt
new file mode 100644
index ..85e6c6c17c04
--- /dev/null
+++ b/Documentation/devicetree/bindings/pinctrl/qcom,sdm660-pinctrl.txt
@@ -0,0 +1,195 @@
+Qualcomm Technologies, Inc. SDM660 TLMM block
+
+This binding describes the Top Level Mode Multiplexer block found in the
+SDM660 platform.
+
+- compatible:
+   Usage: required
+   Value type: 
+   Definition: must be "qcom,sdm660-pinctrl"
+
+- reg:
+   Usage: required
+   Value type: 
+   Definition: the base address and size of the TLMM register space.
+
+- interrupts:
+   Usage: required
+   Value type: 
+   Definition: should specify the TLMM summary IRQ.
+
+- interrupt-controller:
+   Usage: required
+   Value type: 
+   Definition: identifies this node as an interrupt controller
+
+- #interrupt-cells:
+   Usage: required
+   Value type: 
+   Definition: must be 2. Specifying the pin number and flags, as defined
+   in 
+
+- gpio-controller:
+   Usage: required
+   Value type: 
+   Definition: identifies this node as a gpio controller
+
+- #gpio-cells:
+   Usage: required
+   Value type: 
+   Definition: must be 2. Specifying the pin number and flags, as defined
+   in 
+
+Please refer to ../gpio/gpio.txt and ../interrupt-controller/interrupts.txt for
+a general description of GPIO and interrupt bindings.
+
+Please refer to pinctrl-bindings.txt in this directory for details of the
+common pinctrl bindings used by client devices, including the meaning of the
+phrase "pin configuration node".
+
+The pin configuration nodes act as a container for an arbitrary number of
+subnodes. Each of these subnodes represents some desired configuration for a
+pin, a group, or a list of pins or groups. This configuration can include the
+mux function to select on those pin(s)/group(s), and various pin configuration
+parameters, such as pull-up, drive strength, etc.
+
+
+PIN CONFIGURATION NODES:
+
+The name of each subnode is not important; all subnodes should be enumerated
+and processed purely based on their content.
+
+Each subnode only affects those parameters that are explicitly listed. In
+other words, a subnode that lists a mux function but no pin configuration
+parameters implies no information about any pin configuration parameters.
+Similarly, a pin subnode that describes a pullup parameter implies no
+information about e.g. the mux function.
+
+
+The following generic properties as defined in pinctrl-bindings.txt are valid
+to specify in a pin configuration subnode:
+
+- pins:
+   Usage: required
+   Value type: 
+   Definition: List of gpio pins affected by the properties specified in
+   this subnode.  Valid pins are:
+   gpio0-gpio149,
+   Supports mux, bias and drive-strength
+   sdc1_clk, sdc1_cmd, sdc1_data sdc2_clk, sdc2_cmd, sdc2_data 
sdc1_rclk,
+   Supports bias and drive-strength
+
+- function:
+   Usage: required
+   Value type: 
+   Definition: Specify the alternative function to be configured for the
+   specified pins. Functions are only valid for gpio pins.
+   Valid values are:
+
+   blsp_uart1, blsp_spi1, blsp_i2c1, blsp_uim1, atest_tsens,
+   bimc_dte1, dac_calib0, blsp_spi8, blsp_uart8, blsp_uim8,
+   qdss_cti_trig_out_b, bimc_dte0, dac_calib1, 
qdss_cti_trig_in_b,
+   dac_calib2, atest_tsens2, atest_usb1, blsp_spi10, 
blsp_uart10,
+   blsp_uim10, atest_bbrx1, atest_usb13, atest_bbrx0, 
atest_usb12,
+   mdp_vsync, edp_lcd, blsp_i2c10, atest_gpsadc1, atest_usb11,
+   atest_gpsadc0, edp_hot, atest_usb10, m_voc, dac_gpio, 
atest_char,
+   cam_mclk, pll_bypassnl, qdss_stm7, blsp_i2c8, 
qdss_tracedata_b,
+   pll_reset, qdss_stm6, qdss_stm5, qdss_stm4, atest_usb2, 
cci_i2c,
+   qdss_stm3, dac_calib3, atest_usb23, atest_char3, dac_calib4,
+   qdss_stm2, atest_usb22, atest_char2, qdss_stm1, dac_calib5,
+   atest_usb21, atest_char1, dbg_out, qdss_stm0, dac_calib6,
+   

[PATCH] firmware: qcom: scm: Add sdm660 soc compatible

2018-08-11 Thread Craig Tatlor
Add the compatible for SDM660.
This does not need clocks to do scm calls

Signed-off-by: Craig Tatlor 
---
 Documentation/devicetree/bindings/firmware/qcom,scm.txt | 1 +
 drivers/firmware/qcom_scm.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/firmware/qcom,scm.txt 
b/Documentation/devicetree/bindings/firmware/qcom,scm.txt
index fcf6979c0b6d..499608fcc864 100644
--- a/Documentation/devicetree/bindings/firmware/qcom,scm.txt
+++ b/Documentation/devicetree/bindings/firmware/qcom,scm.txt
@@ -11,6 +11,7 @@ Required properties:
  * "qcom,scm-msm8660" for MSM8660 platforms
  * "qcom,scm-msm8690" for MSM8690 platforms
  * "qcom,scm-msm8996" for MSM8996 platforms
+ * "qcom,scm-sdm660" for SDM660 platforms
  * "qcom,scm-ipq4019" for IPQ4019 platforms
  * "qcom,scm" for later processors (MSM8916, APQ8084, MSM8974, etc)
 - clocks: One to three clocks may be required based on compatible.
diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c
index e778af766fae..ee113ceb5d41 100644
--- a/drivers/firmware/qcom_scm.c
+++ b/drivers/firmware/qcom_scm.c
@@ -603,6 +603,9 @@ static const struct of_device_id qcom_scm_dt_match[] = {
{ .compatible = "qcom,scm-msm8996",
  .data = NULL, /* no clocks */
},
+   { .compatible = "qcom,scm-sdm660",
+ .data = NULL, /* no clocks */
+   },
{ .compatible = "qcom,scm-ipq4019",
  .data = NULL, /* no clocks */
},
-- 
2.18.0



[PATCH] firmware: qcom: scm: Add sdm660 soc compatible

2018-08-11 Thread Craig Tatlor
Add the compatible for SDM660.
This does not need clocks to do scm calls

Signed-off-by: Craig Tatlor 
---
 Documentation/devicetree/bindings/firmware/qcom,scm.txt | 1 +
 drivers/firmware/qcom_scm.c | 3 +++
 2 files changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/firmware/qcom,scm.txt 
b/Documentation/devicetree/bindings/firmware/qcom,scm.txt
index fcf6979c0b6d..499608fcc864 100644
--- a/Documentation/devicetree/bindings/firmware/qcom,scm.txt
+++ b/Documentation/devicetree/bindings/firmware/qcom,scm.txt
@@ -11,6 +11,7 @@ Required properties:
  * "qcom,scm-msm8660" for MSM8660 platforms
  * "qcom,scm-msm8690" for MSM8690 platforms
  * "qcom,scm-msm8996" for MSM8996 platforms
+ * "qcom,scm-sdm660" for SDM660 platforms
  * "qcom,scm-ipq4019" for IPQ4019 platforms
  * "qcom,scm" for later processors (MSM8916, APQ8084, MSM8974, etc)
 - clocks: One to three clocks may be required based on compatible.
diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c
index e778af766fae..ee113ceb5d41 100644
--- a/drivers/firmware/qcom_scm.c
+++ b/drivers/firmware/qcom_scm.c
@@ -603,6 +603,9 @@ static const struct of_device_id qcom_scm_dt_match[] = {
{ .compatible = "qcom,scm-msm8996",
  .data = NULL, /* no clocks */
},
+   { .compatible = "qcom,scm-sdm660",
+ .data = NULL, /* no clocks */
+   },
{ .compatible = "qcom,scm-ipq4019",
  .data = NULL, /* no clocks */
},
-- 
2.18.0



[PATCH] soc: qcom: smd-rpm: Add sdm660 compatible

2018-08-11 Thread Craig Tatlor
Add the compatible for the RPM in SDM660, so that rpm resources can be
made available.

Signed-off-by: Craig Tatlor 
---
 Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt | 1 +
 drivers/soc/qcom/smd-rpm.c  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt 
b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt
index 89e1cb9212f6..c38d2b91aadb 100644
--- a/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt
@@ -23,6 +23,7 @@ resources.
"qcom,rpm-msm8916"
"qcom,rpm-msm8974"
"qcom,rpm-msm8998"
+   "qcom,rpm-sdm660"
 
 - qcom,smd-channels:
Usage: required
diff --git a/drivers/soc/qcom/smd-rpm.c b/drivers/soc/qcom/smd-rpm.c
index 93517ed83355..05d4dec15572 100644
--- a/drivers/soc/qcom/smd-rpm.c
+++ b/drivers/soc/qcom/smd-rpm.c
@@ -227,6 +227,7 @@ static const struct of_device_id qcom_smd_rpm_of_match[] = {
{ .compatible = "qcom,rpm-msm8974" },
{ .compatible = "qcom,rpm-msm8996" },
{ .compatible = "qcom,rpm-msm8998" },
+   { .compatible = "qcom,rpm-sdm660" },
{}
 };
 MODULE_DEVICE_TABLE(of, qcom_smd_rpm_of_match);
-- 
2.18.0



[PATCH] soc: qcom: smd-rpm: Add sdm660 compatible

2018-08-11 Thread Craig Tatlor
Add the compatible for the RPM in SDM660, so that rpm resources can be
made available.

Signed-off-by: Craig Tatlor 
---
 Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt | 1 +
 drivers/soc/qcom/smd-rpm.c  | 1 +
 2 files changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt 
b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt
index 89e1cb9212f6..c38d2b91aadb 100644
--- a/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt
+++ b/Documentation/devicetree/bindings/soc/qcom/qcom,smd-rpm.txt
@@ -23,6 +23,7 @@ resources.
"qcom,rpm-msm8916"
"qcom,rpm-msm8974"
"qcom,rpm-msm8998"
+   "qcom,rpm-sdm660"
 
 - qcom,smd-channels:
Usage: required
diff --git a/drivers/soc/qcom/smd-rpm.c b/drivers/soc/qcom/smd-rpm.c
index 93517ed83355..05d4dec15572 100644
--- a/drivers/soc/qcom/smd-rpm.c
+++ b/drivers/soc/qcom/smd-rpm.c
@@ -227,6 +227,7 @@ static const struct of_device_id qcom_smd_rpm_of_match[] = {
{ .compatible = "qcom,rpm-msm8974" },
{ .compatible = "qcom,rpm-msm8996" },
{ .compatible = "qcom,rpm-msm8998" },
+   { .compatible = "qcom,rpm-sdm660" },
{}
 };
 MODULE_DEVICE_TABLE(of, qcom_smd_rpm_of_match);
-- 
2.18.0



[PATCH] staging: netlogic: Fixed comments to include SPDX-License-Identifier

2018-08-11 Thread Michael Anckaert
This patch fixes some issues with missing SPDX-License-Identifier
comments. 

Disclaimer: this is my first patch and instructions were taken from the
KernelNewbies project. 

Signed-off-by: Michael Anckaert 
---
 drivers/staging/netlogic/Kconfig| 6 +++---
 drivers/staging/netlogic/platform_net.c | 1 +
 drivers/staging/netlogic/platform_net.h | 1 +
 drivers/staging/netlogic/xlr_net.c  | 1 +
 drivers/staging/netlogic/xlr_net.h  | 1 +
 5 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/netlogic/Kconfig b/drivers/staging/netlogic/Kconfig
index d660de51b541..ab0b756bc08b 100644
--- a/drivers/staging/netlogic/Kconfig
+++ b/drivers/staging/netlogic/Kconfig
@@ -2,6 +2,6 @@ config NETLOGIC_XLR_NET
tristate "Netlogic XLR/XLS network device"
depends on CPU_XLR
select PHYLIB
-   ---help---
-   This driver support Netlogic XLR/XLS on chip gigabit
-   Ethernet.
+   help
+   This driver support Netlogic XLR/XLS on chip gigabit
+   Ethernet.
diff --git a/drivers/staging/netlogic/platform_net.c 
b/drivers/staging/netlogic/platform_net.c
index abf4c71ee66b..3886c99c1f68 100644
--- a/drivers/staging/netlogic/platform_net.c
+++ b/drivers/staging/netlogic/platform_net.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2003-2012 Broadcom Corporation
  * All Rights Reserved
diff --git a/drivers/staging/netlogic/platform_net.h 
b/drivers/staging/netlogic/platform_net.h
index e1b27f649590..1d994f0d0995 100644
--- a/drivers/staging/netlogic/platform_net.h
+++ b/drivers/staging/netlogic/platform_net.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Copyright (c) 2003-2012 Broadcom Corporation
  * All Rights Reserved
diff --git a/drivers/staging/netlogic/xlr_net.c 
b/drivers/staging/netlogic/xlr_net.c
index e461168313bf..201db10692de 100644
--- a/drivers/staging/netlogic/xlr_net.c
+++ b/drivers/staging/netlogic/xlr_net.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2003-2012 Broadcom Corporation
  * All Rights Reserved
diff --git a/drivers/staging/netlogic/xlr_net.h 
b/drivers/staging/netlogic/xlr_net.h
index f76e16cfd15d..de51d64c1f23 100644
--- a/drivers/staging/netlogic/xlr_net.h
+++ b/drivers/staging/netlogic/xlr_net.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Copyright (c) 2003-2012 Broadcom Corporation
  * All Rights Reserved
-- 
2.17.1



[PATCH] staging: netlogic: Fixed comments to include SPDX-License-Identifier

2018-08-11 Thread Michael Anckaert
This patch fixes some issues with missing SPDX-License-Identifier
comments. 

Disclaimer: this is my first patch and instructions were taken from the
KernelNewbies project. 

Signed-off-by: Michael Anckaert 
---
 drivers/staging/netlogic/Kconfig| 6 +++---
 drivers/staging/netlogic/platform_net.c | 1 +
 drivers/staging/netlogic/platform_net.h | 1 +
 drivers/staging/netlogic/xlr_net.c  | 1 +
 drivers/staging/netlogic/xlr_net.h  | 1 +
 5 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/netlogic/Kconfig b/drivers/staging/netlogic/Kconfig
index d660de51b541..ab0b756bc08b 100644
--- a/drivers/staging/netlogic/Kconfig
+++ b/drivers/staging/netlogic/Kconfig
@@ -2,6 +2,6 @@ config NETLOGIC_XLR_NET
tristate "Netlogic XLR/XLS network device"
depends on CPU_XLR
select PHYLIB
-   ---help---
-   This driver support Netlogic XLR/XLS on chip gigabit
-   Ethernet.
+   help
+   This driver support Netlogic XLR/XLS on chip gigabit
+   Ethernet.
diff --git a/drivers/staging/netlogic/platform_net.c 
b/drivers/staging/netlogic/platform_net.c
index abf4c71ee66b..3886c99c1f68 100644
--- a/drivers/staging/netlogic/platform_net.c
+++ b/drivers/staging/netlogic/platform_net.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2003-2012 Broadcom Corporation
  * All Rights Reserved
diff --git a/drivers/staging/netlogic/platform_net.h 
b/drivers/staging/netlogic/platform_net.h
index e1b27f649590..1d994f0d0995 100644
--- a/drivers/staging/netlogic/platform_net.h
+++ b/drivers/staging/netlogic/platform_net.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Copyright (c) 2003-2012 Broadcom Corporation
  * All Rights Reserved
diff --git a/drivers/staging/netlogic/xlr_net.c 
b/drivers/staging/netlogic/xlr_net.c
index e461168313bf..201db10692de 100644
--- a/drivers/staging/netlogic/xlr_net.c
+++ b/drivers/staging/netlogic/xlr_net.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2003-2012 Broadcom Corporation
  * All Rights Reserved
diff --git a/drivers/staging/netlogic/xlr_net.h 
b/drivers/staging/netlogic/xlr_net.h
index f76e16cfd15d..de51d64c1f23 100644
--- a/drivers/staging/netlogic/xlr_net.h
+++ b/drivers/staging/netlogic/xlr_net.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: GPL-2.0 */
 /*
  * Copyright (c) 2003-2012 Broadcom Corporation
  * All Rights Reserved
-- 
2.17.1



Re: [PATCH v8 3/6] Uprobes: Support SDT markers having reference count (semaphore)

2018-08-11 Thread Steven Rostedt
On Sat, 11 Aug 2018 00:57:12 -0700
Song Liu  wrote:

> > +
> > +static void delayed_uprobe_delete(struct delayed_uprobe *du)
> > +{
> > +   if (!du)
> > +   return;  
> Do we really need this check?

I'd suggest we keep it. It's not a fast path, and operations like this
should really check for NULL.


> 
> > +   list_del(>list);
> > +   kfree(du);
> > +}
> > +
> > +static void delayed_uprobe_remove(struct uprobe *uprobe, struct mm_struct 
> > *mm)
> > +{
> > +   struct list_head *pos, *q;
> > +   struct delayed_uprobe *du;
> > +
> > +   if (!uprobe && !mm)
> > +   return;  
> And do we really need this check?

Same here, as it's not a fast path, and it prevents kernel oops if a
NULL is passed in.

> 
> > +
> > +   list_for_each_safe(pos, q, _uprobe_list) {
> > +   du = list_entry(pos, struct delayed_uprobe, list);
> > +
> > +   if (uprobe && mm && du->uprobe == uprobe && du->mm == mm)
> > +   delayed_uprobe_delete(du);
> > +   else if (!uprobe && du->mm == mm)
> > +   delayed_uprobe_delete(du);
> > +   else if (!mm && du->uprobe == uprobe)
> > +   delayed_uprobe_delete(du);
> > +   }
> > +}
> > +
> > +static bool valid_ref_ctr_vma(struct uprobe *uprobe,
> > + struct vm_area_struct *vma)
> > +{
> > +   unsigned long vaddr = offset_to_vaddr(vma, uprobe->ref_ctr_offset);
> > +
> > +   return uprobe->ref_ctr_offset &&
> > +   vma->vm_file &&
> > +   file_inode(vma->vm_file) == uprobe->inode &&
> > +   (vma->vm_flags & (VM_WRITE|VM_SHARED)) == VM_WRITE &&
> > +   vma->vm_start <= vaddr &&
> > +   vma->vm_end > vaddr;
> > +}
> > +
> > +static struct vm_area_struct *
> > +find_ref_ctr_vma(struct uprobe *uprobe, struct mm_struct *mm)
> > +{
> > +   struct vm_area_struct *tmp;
> > +
> > +   for (tmp = mm->mmap; tmp; tmp = tmp->vm_next)
> > +   if (valid_ref_ctr_vma(uprobe, tmp))
> > +   return tmp;
> > +
> > +   return NULL;
> > +}
> > +
> > +static int
> > +__update_ref_ctr(struct mm_struct *mm, unsigned long vaddr, short d)
> > +{
> > +   void *kaddr;
> > +   struct page *page;
> > +   struct vm_area_struct *vma;
> > +   int ret = 0;  
> It is not necessary to initialize ret here.

Agreed.

> 
> > +   short *ptr;
> > +
> > +   if (vaddr == 0 || d == 0)
> > +   return -EINVAL;
> > +
> > +   ret = get_user_pages_remote(NULL, mm, vaddr, 1,
> > +   FOLL_WRITE, , , NULL);
> > +   if (unlikely(ret <= 0)) {
> > +   /*
> > +* We are asking for 1 page. If get_user_pages_remote() 
> > fails,
> > +* it may return 0, in that case we have to return error.
> > +*/
> > +   ret = (ret == 0) ? -EBUSY : ret;
> > +   pr_warn("Failed to %s ref_ctr. (%d)\n",
> > +   d > 0 ? "increment" : "decrement", ret);  
> This warning is not really useful. Seems this function has little information
> about which uprobe is failing here. Maybe we only need warning in the caller
> (or caller of caller).

I'm fine with or without this.

> 
> > +   return ret;
> > +   }
> > +
> > +   kaddr = kmap_atomic(page);
> > +   ptr = kaddr + (vaddr & ~PAGE_MASK);
> > +
> > +   if (unlikely(*ptr + d < 0)) {
> > +   pr_warn("ref_ctr going negative. vaddr: 0x%lx, "
> > +   "curr val: %d, delta: %d\n", vaddr, *ptr, d);
> > +   ret = -EINVAL;
> > +   goto out;
> > +   }
> > +
> > +   *ptr += d;
> > +   ret = 0;
> > +out:
> > +   kunmap_atomic(kaddr);
> > +   put_page(page);
> > +   return ret;
> > +}
> > +
> > +static int update_ref_ctr(struct uprobe *uprobe, struct mm_struct *mm,
> > + bool is_register)  
> What's the reason of bool is_register here vs. short d in __update_ref_ctr()?
> Can we use short for both?

bool has more control, but I agree that this function is a bit
confusing.

-- Steve

> 
> > +{
> > +   struct vm_area_struct *rc_vma;
> > +   unsigned long rc_vaddr;
> > +   int ret = 0;
> > +
> > +   rc_vma = find_ref_ctr_vma(uprobe, mm);
> > +
> > +   if (rc_vma) {
> > +   rc_vaddr = offset_to_vaddr(rc_vma, uprobe->ref_ctr_offset);
> > +   ret = __update_ref_ctr(mm, rc_vaddr, is_register ? 1 : -1);
> > +
> > +   if (is_register)
> > +   return ret;
> > +   }  
> Mixing __update_ref_ctr() here and delayed_uprobe_add() in the same
> function is a little confusing (at least for me). How about we always use
> delayed uprobe for uprobe_mmap() and use non-delayed in other case(s)?
> 
> > +
> > +   mutex_lock(_uprobe_lock);
> > +   if (is_register)
> > +   ret = 

Re: [PATCH v8 3/6] Uprobes: Support SDT markers having reference count (semaphore)

2018-08-11 Thread Steven Rostedt
On Sat, 11 Aug 2018 00:57:12 -0700
Song Liu  wrote:

> > +
> > +static void delayed_uprobe_delete(struct delayed_uprobe *du)
> > +{
> > +   if (!du)
> > +   return;  
> Do we really need this check?

I'd suggest we keep it. It's not a fast path, and operations like this
should really check for NULL.


> 
> > +   list_del(>list);
> > +   kfree(du);
> > +}
> > +
> > +static void delayed_uprobe_remove(struct uprobe *uprobe, struct mm_struct 
> > *mm)
> > +{
> > +   struct list_head *pos, *q;
> > +   struct delayed_uprobe *du;
> > +
> > +   if (!uprobe && !mm)
> > +   return;  
> And do we really need this check?

Same here, as it's not a fast path, and it prevents kernel oops if a
NULL is passed in.

> 
> > +
> > +   list_for_each_safe(pos, q, _uprobe_list) {
> > +   du = list_entry(pos, struct delayed_uprobe, list);
> > +
> > +   if (uprobe && mm && du->uprobe == uprobe && du->mm == mm)
> > +   delayed_uprobe_delete(du);
> > +   else if (!uprobe && du->mm == mm)
> > +   delayed_uprobe_delete(du);
> > +   else if (!mm && du->uprobe == uprobe)
> > +   delayed_uprobe_delete(du);
> > +   }
> > +}
> > +
> > +static bool valid_ref_ctr_vma(struct uprobe *uprobe,
> > + struct vm_area_struct *vma)
> > +{
> > +   unsigned long vaddr = offset_to_vaddr(vma, uprobe->ref_ctr_offset);
> > +
> > +   return uprobe->ref_ctr_offset &&
> > +   vma->vm_file &&
> > +   file_inode(vma->vm_file) == uprobe->inode &&
> > +   (vma->vm_flags & (VM_WRITE|VM_SHARED)) == VM_WRITE &&
> > +   vma->vm_start <= vaddr &&
> > +   vma->vm_end > vaddr;
> > +}
> > +
> > +static struct vm_area_struct *
> > +find_ref_ctr_vma(struct uprobe *uprobe, struct mm_struct *mm)
> > +{
> > +   struct vm_area_struct *tmp;
> > +
> > +   for (tmp = mm->mmap; tmp; tmp = tmp->vm_next)
> > +   if (valid_ref_ctr_vma(uprobe, tmp))
> > +   return tmp;
> > +
> > +   return NULL;
> > +}
> > +
> > +static int
> > +__update_ref_ctr(struct mm_struct *mm, unsigned long vaddr, short d)
> > +{
> > +   void *kaddr;
> > +   struct page *page;
> > +   struct vm_area_struct *vma;
> > +   int ret = 0;  
> It is not necessary to initialize ret here.

Agreed.

> 
> > +   short *ptr;
> > +
> > +   if (vaddr == 0 || d == 0)
> > +   return -EINVAL;
> > +
> > +   ret = get_user_pages_remote(NULL, mm, vaddr, 1,
> > +   FOLL_WRITE, , , NULL);
> > +   if (unlikely(ret <= 0)) {
> > +   /*
> > +* We are asking for 1 page. If get_user_pages_remote() 
> > fails,
> > +* it may return 0, in that case we have to return error.
> > +*/
> > +   ret = (ret == 0) ? -EBUSY : ret;
> > +   pr_warn("Failed to %s ref_ctr. (%d)\n",
> > +   d > 0 ? "increment" : "decrement", ret);  
> This warning is not really useful. Seems this function has little information
> about which uprobe is failing here. Maybe we only need warning in the caller
> (or caller of caller).

I'm fine with or without this.

> 
> > +   return ret;
> > +   }
> > +
> > +   kaddr = kmap_atomic(page);
> > +   ptr = kaddr + (vaddr & ~PAGE_MASK);
> > +
> > +   if (unlikely(*ptr + d < 0)) {
> > +   pr_warn("ref_ctr going negative. vaddr: 0x%lx, "
> > +   "curr val: %d, delta: %d\n", vaddr, *ptr, d);
> > +   ret = -EINVAL;
> > +   goto out;
> > +   }
> > +
> > +   *ptr += d;
> > +   ret = 0;
> > +out:
> > +   kunmap_atomic(kaddr);
> > +   put_page(page);
> > +   return ret;
> > +}
> > +
> > +static int update_ref_ctr(struct uprobe *uprobe, struct mm_struct *mm,
> > + bool is_register)  
> What's the reason of bool is_register here vs. short d in __update_ref_ctr()?
> Can we use short for both?

bool has more control, but I agree that this function is a bit
confusing.

-- Steve

> 
> > +{
> > +   struct vm_area_struct *rc_vma;
> > +   unsigned long rc_vaddr;
> > +   int ret = 0;
> > +
> > +   rc_vma = find_ref_ctr_vma(uprobe, mm);
> > +
> > +   if (rc_vma) {
> > +   rc_vaddr = offset_to_vaddr(rc_vma, uprobe->ref_ctr_offset);
> > +   ret = __update_ref_ctr(mm, rc_vaddr, is_register ? 1 : -1);
> > +
> > +   if (is_register)
> > +   return ret;
> > +   }  
> Mixing __update_ref_ctr() here and delayed_uprobe_add() in the same
> function is a little confusing (at least for me). How about we always use
> delayed uprobe for uprobe_mmap() and use non-delayed in other case(s)?
> 
> > +
> > +   mutex_lock(_uprobe_lock);
> > +   if (is_register)
> > +   ret = 

Re: [PATCH v6 1/2] iio: light: Add support for vishay vcnl4035

2018-08-11 Thread kbuild test robot
Hi Parthiban,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on iio/togreg]
[also build test ERROR on v4.18-rc8 next-20180810]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Parthiban-Nallathambi/iio-light-Add-support-for-vishay-vcnl4035/20180810-012903
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 8.1.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=8.1.0 make.cross ARCH=ia64 

All errors (new ones prefixed by >>):

   ERROR: "ia64_delay_loop" [drivers/spi/spi-thunderx.ko] undefined!
   ERROR: "__sw_hweight8" [drivers/net/wireless/mediatek/mt76/mt76.ko] 
undefined!
   ERROR: "ia64_delay_loop" [drivers/net/phy/mdio-cavium.ko] undefined!
>> ERROR: "__sw_hweight8" [drivers/iio/light/vcnl4035.ko] undefined!

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH v6 1/2] iio: light: Add support for vishay vcnl4035

2018-08-11 Thread kbuild test robot
Hi Parthiban,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on iio/togreg]
[also build test ERROR on v4.18-rc8 next-20180810]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Parthiban-Nallathambi/iio-light-Add-support-for-vishay-vcnl4035/20180810-012903
base:   https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg
config: ia64-allmodconfig (attached as .config)
compiler: ia64-linux-gcc (GCC) 8.1.0
reproduce:
wget 
https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O 
~/bin/make.cross
chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
GCC_VERSION=8.1.0 make.cross ARCH=ia64 

All errors (new ones prefixed by >>):

   ERROR: "ia64_delay_loop" [drivers/spi/spi-thunderx.ko] undefined!
   ERROR: "__sw_hweight8" [drivers/net/wireless/mediatek/mt76/mt76.ko] 
undefined!
   ERROR: "ia64_delay_loop" [drivers/net/phy/mdio-cavium.ko] undefined!
>> ERROR: "__sw_hweight8" [drivers/iio/light/vcnl4035.ko] undefined!

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: application/gzip


Re: [PATCH] ARM: spectre-v2: Try to set IBE bit for Cortex-A15 and Brahma-B15

2018-08-11 Thread Marek Vasut
On 06/08/2018 12:58 AM, Florian Fainelli wrote:
> Per the ARM reference manual for the Cortex-A15, The ACTLR:
> 
>  Is a read/write register.
> 
>  Common to the Secure and Non-secure states.
> 
>  Is only accessible from PL1 or higher, with access rights that depend
>  on the mode:
> 
> * Read/write in Secure PL1 modes.
> 
> * Read-only and write-ignored in Non-secure PL1 and PL2 modes
>   if NSACR.NS_SMP is 0.
> 
> * Read/write in Non-secure PL1 and PL2 modes if NSACR.NS_SMP
>   is 1. In this case, all bits are write-ignored except for the SMP bit.
> 
> We can attempt to set this bit from within the kernel, which helps
> avoiding firmware side modifications to set the IBE bit when that is
> impractical. We do this within __v7_ca15mp_setup and __v7_b15mp_setup
> because by then we already took those labels because the processors we
> run on do match.
> 
> Signed-off-by: Florian Fainelli 

I believe this would help on selected R-Car Gen2 SoCs which have CA15
cores. Those cores are released from reset by Linux directly and jump to
the reset vector set up by Linux in Secure mode.

I was looking for a generic solution after discussing how to mitigate
the spectrev2 on such SoCs with Catalin on IRC and this seems to be one
option. There was also a suggestion that Russell is working on some sort
of generic solution too. Can you comment on that please ?

> ---
>  arch/arm/mm/proc-v7.S | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
> index 6fe52819e014..a21cf3729efa 100644
> --- a/arch/arm/mm/proc-v7.S
> +++ b/arch/arm/mm/proc-v7.S
> @@ -284,10 +284,16 @@ __v7_cr8mp_setup:
>   b   1f
>  __v7_ca7mp_setup:
>  __v7_ca12mp_setup:
> + b   2f
>  __v7_ca15mp_setup:
>  __v7_b15mp_setup:
> +#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR
> + mrc p15, 0, r0, c1, c0, 1
> + orr r0, r0, #1  @ Enable IBE bit
> + mcr p15, 0, r0, c1, c0, 1
> +#endif
>  __v7_ca17mp_setup:
> - mov r10, #0
> +2:   mov r10, #0
>  1:   adr r0, __v7_setup_stack_ptr
>   ldr r12, [r0]
>   add r12, r12, r0@ the local stack
> 


-- 
Best regards,
Marek Vasut


Re: [PATCH] ARM: spectre-v2: Try to set IBE bit for Cortex-A15 and Brahma-B15

2018-08-11 Thread Marek Vasut
On 06/08/2018 12:58 AM, Florian Fainelli wrote:
> Per the ARM reference manual for the Cortex-A15, The ACTLR:
> 
>  Is a read/write register.
> 
>  Common to the Secure and Non-secure states.
> 
>  Is only accessible from PL1 or higher, with access rights that depend
>  on the mode:
> 
> * Read/write in Secure PL1 modes.
> 
> * Read-only and write-ignored in Non-secure PL1 and PL2 modes
>   if NSACR.NS_SMP is 0.
> 
> * Read/write in Non-secure PL1 and PL2 modes if NSACR.NS_SMP
>   is 1. In this case, all bits are write-ignored except for the SMP bit.
> 
> We can attempt to set this bit from within the kernel, which helps
> avoiding firmware side modifications to set the IBE bit when that is
> impractical. We do this within __v7_ca15mp_setup and __v7_b15mp_setup
> because by then we already took those labels because the processors we
> run on do match.
> 
> Signed-off-by: Florian Fainelli 

I believe this would help on selected R-Car Gen2 SoCs which have CA15
cores. Those cores are released from reset by Linux directly and jump to
the reset vector set up by Linux in Secure mode.

I was looking for a generic solution after discussing how to mitigate
the spectrev2 on such SoCs with Catalin on IRC and this seems to be one
option. There was also a suggestion that Russell is working on some sort
of generic solution too. Can you comment on that please ?

> ---
>  arch/arm/mm/proc-v7.S | 8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
> index 6fe52819e014..a21cf3729efa 100644
> --- a/arch/arm/mm/proc-v7.S
> +++ b/arch/arm/mm/proc-v7.S
> @@ -284,10 +284,16 @@ __v7_cr8mp_setup:
>   b   1f
>  __v7_ca7mp_setup:
>  __v7_ca12mp_setup:
> + b   2f
>  __v7_ca15mp_setup:
>  __v7_b15mp_setup:
> +#ifdef CONFIG_HARDEN_BRANCH_PREDICTOR
> + mrc p15, 0, r0, c1, c0, 1
> + orr r0, r0, #1  @ Enable IBE bit
> + mcr p15, 0, r0, c1, c0, 1
> +#endif
>  __v7_ca17mp_setup:
> - mov r10, #0
> +2:   mov r10, #0
>  1:   adr r0, __v7_setup_stack_ptr
>   ldr r12, [r0]
>   add r12, r12, r0@ the local stack
> 


-- 
Best regards,
Marek Vasut


[for-next][PATCH 00/34] tracing: My official queue finally passed testing and ready for linux-next

2018-08-11 Thread Steven Rostedt
  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
for-next

Head SHA1: f8a79d5c7ef47c62d97a30e16064caf2ef91f648


Colin Ian King (1):
  ftrace: Remove unused pointer ftrace_swapper_pid

Erica Bugden (1):
  ftrace: Add missing check for existing hwlat thread

Francis Deslauriers (1):
  selftest/ftrace: Move kprobe selftest function to separate compile unit

Gustavo A. R. Silva (1):
  ftrace: Use true and false for boolean values in ops_references_rec()

Joel Fernandes (Google) (9):
  srcu: Add notrace variant of srcu_dereference
  tracing/irqsoff: Split reset into separate functions
  lib: Add module for testing preemptoff/irqsoff latency tracers
  kselftests: Add tests for the preemptoff and irqsoff tracers
  lockdep: Use this_cpu_ptr instead of get_cpu_var stats
  tracepoint: Make rcuidle tracepoint callers use SRCU
  tracing: Centralize preemptirq tracepoints and unify their usage
  trace: Use rcu_dereference_raw for hooks from trace-event subsystem
  tracing: irqsoff: Account for additional preempt_disable

Masami Hiramatsu (5):
  tracing: Remove orphaned function using_ftrace_ops_list_func().
  tracing: Remove orphaned function ftrace_nr_registered_ops()
  tracing: kprobes: Prohibit probing on notrace function
  selftests/ftrace: Fix kprobe string testcase to not probe notrace function
  tracing/kprobes: Fix within_notrace_func() to check only notrace functions

Paul McKenney (1):
  srcu: Add notrace variants of srcu_read_{lock,unlock}

Steven Rostedt (VMware) (13):
  tracing: Make unregister_trigger() static
  tracing/kprobes: Simplify the logic of enable_trace_kprobe()
  tracing: Do not call start/stop() functions when tracing_on does not 
change
  tracing: Do a WARN_ON() if start_thread() in hwlat is called when thread 
exists
  tracing: Make tracer_tracing_is_on() return bool
  ring-buffer: Make ring_buffer_record_is_on() return bool
  ring-buffer: Make ring_buffer_record_is_set_on() return bool
  tracing: Partial revert of "tracing: Centralize preemptirq tracepoints 
and unify their usage"
  tracing/irqsoff: Handle preempt_count for different configs
  tracing: More reverting of "tracing: Centralize preemptirq tracepoints 
and unify their usage"
  tracing: Fix synchronizing to event changes with 
tracepoint_synchronize_unregister()
  uprobes: Use synchronize_rcu() not synchronize_sched()
  tracepoints: Free early tracepoints after RCU is initialized

Zubin Mithra (1):
  tracefs: Annotate tracefs_ops with __ro_after_init

kbuild test robot (1):
  tracing: preemptirq_delay_run() can be static


 fs/tracefs/inode.c |   5 +-
 include/linux/ftrace.h |  17 +-
 include/linux/irqflags.h   |  15 +-
 include/linux/lockdep.h|   6 +-
 include/linux/preempt.h|   2 +-
 include/linux/ring_buffer.h|   4 +-
 include/linux/srcu.h   |  22 ++
 include/linux/tracepoint.h |  40 ++-
 include/trace/events/preemptirq.h  |  23 +-
 init/main.c|   3 +-
 kernel/locking/lockdep.c   |  35 +--
 kernel/sched/core.c|   2 +-
 kernel/trace/Kconfig   |  57 -
 kernel/trace/Makefile  |   8 +-
 kernel/trace/ftrace.c  |  41 +---
 kernel/trace/preemptirq_delay_test.c   |  72 ++
 kernel/trace/ring_buffer.c |   4 +-
 kernel/trace/trace.c   |   6 +-
 kernel/trace/trace.h   |  21 +-
 kernel/trace/trace_events.c|  12 +-
 kernel/trace/trace_events_filter.c |  15 +-
 kernel/trace/trace_events_hist.c   |   2 +-
 kernel/trace/trace_events_trigger.c|  12 +-
 kernel/trace/trace_hwlat.c |   3 +
 kernel/trace/trace_irqsoff.c   | 269 +++--
 kernel/trace/trace_kprobe.c| 103 +---
 kernel/trace/trace_kprobe_selftest.c   |  10 +
 kernel/trace/trace_kprobe_selftest.h   |   7 +
 kernel/trace/trace_preemptirq.c|  89 +++
 kernel/trace/trace_uprobe.c|   2 +-
 kernel/tracepoint.c|  48 +++-
 tools/testing/selftests/ftrace/config  |   3 +
 .../ftrace/test.d/kprobe/kprobe_args_string.tc |  30 +--
 .../selftests/ftrace/test.d/kprobe/probepoint.tc   |   2 +-
 .../ftrace/test.d/preemptirq/irqsoff_tracer.tc |  73 ++
 35 files changed, 670 insertions(+), 393 deletions(-)
 create mode 100644 

[for-next][PATCH 02/34] srcu: Add notrace variant of srcu_dereference

2018-08-11 Thread Steven Rostedt
From: "Joel Fernandes (Google)" 

In the last patch in this series, we are making lockdep register hooks
onto the irq_{disable,enable} tracepoints. These tracepoints use the
_rcuidle tracepoint variant. In this series we switch the _rcuidle
tracepoint callers to use SRCU instead of sched-RCU. Inorder to
dereference the pointer to the probe functions, we could call
srcu_dereference, however this API will call back into lockdep to check
if the lock is held *before* the lockdep probe hooks have a chance to
run and annotate the IRQ enabled/disabled state.

For this reason we need a notrace variant of srcu_dereference since
otherwise we get lockdep splats. This patch adds the needed
srcu_dereference_notrace variant.

Link: http://lkml.kernel.org/r/20180628182149.226164-3-j...@joelfernandes.org

Reviewed-by: Paul E. McKenney 
Signed-off-by: Joel Fernandes (Google) 
Signed-off-by: Steven Rostedt (VMware) 
---
 include/linux/srcu.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 3e72a291c401..67135d4a8a30 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -169,6 +169,11 @@ static inline int srcu_read_lock_held(const struct 
srcu_struct *sp)
  */
 #define srcu_dereference(p, sp) srcu_dereference_check((p), (sp), 0)
 
+/**
+ * srcu_dereference_notrace - no tracing and no lockdep calls from here
+ */
+#define srcu_dereference_notrace(p, sp) srcu_dereference_check((p), (sp), 1)
+
 /**
  * srcu_read_lock - register a new reader for an SRCU-protected structure.
  * @sp: srcu_struct in which to register the new reader.
-- 
2.18.0




[for-next][PATCH 01/34] srcu: Add notrace variants of srcu_read_{lock,unlock}

2018-08-11 Thread Steven Rostedt
From: Paul McKenney 

This is needed for a future tracepoint patch that uses srcu, and to make
sure it doesn't call into lockdep.

tracepoint code already calls notrace variants for rcu_read_lock_sched
so this patch does the same for srcu which will be used in a later
patch. Keeps it consistent with rcu-sched.

[Joel: Added commit message]
Link: http://lkml.kernel.org/r/20180628182149.226164-2-j...@joelfernandes.org

Reviewed-by: Steven Rostedt (VMware) 
Signed-off-by: Paul McKenney 
Signed-off-by: Joel Fernandes (Google) 
Signed-off-by: Steven Rostedt (VMware) 
---
 include/linux/srcu.h | 17 +
 1 file changed, 17 insertions(+)

diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 91494d7e8e41..3e72a291c401 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -195,6 +195,16 @@ static inline int srcu_read_lock(struct srcu_struct *sp) 
__acquires(sp)
return retval;
 }
 
+/* Used by tracing, cannot be traced and cannot invoke lockdep. */
+static inline notrace int
+srcu_read_lock_notrace(struct srcu_struct *sp) __acquires(sp)
+{
+   int retval;
+
+   retval = __srcu_read_lock(sp);
+   return retval;
+}
+
 /**
  * srcu_read_unlock - unregister a old reader from an SRCU-protected structure.
  * @sp: srcu_struct in which to unregister the old reader.
@@ -209,6 +219,13 @@ static inline void srcu_read_unlock(struct srcu_struct 
*sp, int idx)
__srcu_read_unlock(sp, idx);
 }
 
+/* Used by tracing, cannot be traced and cannot call lockdep. */
+static inline notrace void
+srcu_read_unlock_notrace(struct srcu_struct *sp, int idx) __releases(sp)
+{
+   __srcu_read_unlock(sp, idx);
+}
+
 /**
  * smp_mb__after_srcu_read_unlock - ensure full ordering after srcu_read_unlock
  *
-- 
2.18.0




[for-next][PATCH 00/34] tracing: My official queue finally passed testing and ready for linux-next

2018-08-11 Thread Steven Rostedt
  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
for-next

Head SHA1: f8a79d5c7ef47c62d97a30e16064caf2ef91f648


Colin Ian King (1):
  ftrace: Remove unused pointer ftrace_swapper_pid

Erica Bugden (1):
  ftrace: Add missing check for existing hwlat thread

Francis Deslauriers (1):
  selftest/ftrace: Move kprobe selftest function to separate compile unit

Gustavo A. R. Silva (1):
  ftrace: Use true and false for boolean values in ops_references_rec()

Joel Fernandes (Google) (9):
  srcu: Add notrace variant of srcu_dereference
  tracing/irqsoff: Split reset into separate functions
  lib: Add module for testing preemptoff/irqsoff latency tracers
  kselftests: Add tests for the preemptoff and irqsoff tracers
  lockdep: Use this_cpu_ptr instead of get_cpu_var stats
  tracepoint: Make rcuidle tracepoint callers use SRCU
  tracing: Centralize preemptirq tracepoints and unify their usage
  trace: Use rcu_dereference_raw for hooks from trace-event subsystem
  tracing: irqsoff: Account for additional preempt_disable

Masami Hiramatsu (5):
  tracing: Remove orphaned function using_ftrace_ops_list_func().
  tracing: Remove orphaned function ftrace_nr_registered_ops()
  tracing: kprobes: Prohibit probing on notrace function
  selftests/ftrace: Fix kprobe string testcase to not probe notrace function
  tracing/kprobes: Fix within_notrace_func() to check only notrace functions

Paul McKenney (1):
  srcu: Add notrace variants of srcu_read_{lock,unlock}

Steven Rostedt (VMware) (13):
  tracing: Make unregister_trigger() static
  tracing/kprobes: Simplify the logic of enable_trace_kprobe()
  tracing: Do not call start/stop() functions when tracing_on does not 
change
  tracing: Do a WARN_ON() if start_thread() in hwlat is called when thread 
exists
  tracing: Make tracer_tracing_is_on() return bool
  ring-buffer: Make ring_buffer_record_is_on() return bool
  ring-buffer: Make ring_buffer_record_is_set_on() return bool
  tracing: Partial revert of "tracing: Centralize preemptirq tracepoints 
and unify their usage"
  tracing/irqsoff: Handle preempt_count for different configs
  tracing: More reverting of "tracing: Centralize preemptirq tracepoints 
and unify their usage"
  tracing: Fix synchronizing to event changes with 
tracepoint_synchronize_unregister()
  uprobes: Use synchronize_rcu() not synchronize_sched()
  tracepoints: Free early tracepoints after RCU is initialized

Zubin Mithra (1):
  tracefs: Annotate tracefs_ops with __ro_after_init

kbuild test robot (1):
  tracing: preemptirq_delay_run() can be static


 fs/tracefs/inode.c |   5 +-
 include/linux/ftrace.h |  17 +-
 include/linux/irqflags.h   |  15 +-
 include/linux/lockdep.h|   6 +-
 include/linux/preempt.h|   2 +-
 include/linux/ring_buffer.h|   4 +-
 include/linux/srcu.h   |  22 ++
 include/linux/tracepoint.h |  40 ++-
 include/trace/events/preemptirq.h  |  23 +-
 init/main.c|   3 +-
 kernel/locking/lockdep.c   |  35 +--
 kernel/sched/core.c|   2 +-
 kernel/trace/Kconfig   |  57 -
 kernel/trace/Makefile  |   8 +-
 kernel/trace/ftrace.c  |  41 +---
 kernel/trace/preemptirq_delay_test.c   |  72 ++
 kernel/trace/ring_buffer.c |   4 +-
 kernel/trace/trace.c   |   6 +-
 kernel/trace/trace.h   |  21 +-
 kernel/trace/trace_events.c|  12 +-
 kernel/trace/trace_events_filter.c |  15 +-
 kernel/trace/trace_events_hist.c   |   2 +-
 kernel/trace/trace_events_trigger.c|  12 +-
 kernel/trace/trace_hwlat.c |   3 +
 kernel/trace/trace_irqsoff.c   | 269 +++--
 kernel/trace/trace_kprobe.c| 103 +---
 kernel/trace/trace_kprobe_selftest.c   |  10 +
 kernel/trace/trace_kprobe_selftest.h   |   7 +
 kernel/trace/trace_preemptirq.c|  89 +++
 kernel/trace/trace_uprobe.c|   2 +-
 kernel/tracepoint.c|  48 +++-
 tools/testing/selftests/ftrace/config  |   3 +
 .../ftrace/test.d/kprobe/kprobe_args_string.tc |  30 +--
 .../selftests/ftrace/test.d/kprobe/probepoint.tc   |   2 +-
 .../ftrace/test.d/preemptirq/irqsoff_tracer.tc |  73 ++
 35 files changed, 670 insertions(+), 393 deletions(-)
 create mode 100644 

[for-next][PATCH 02/34] srcu: Add notrace variant of srcu_dereference

2018-08-11 Thread Steven Rostedt
From: "Joel Fernandes (Google)" 

In the last patch in this series, we are making lockdep register hooks
onto the irq_{disable,enable} tracepoints. These tracepoints use the
_rcuidle tracepoint variant. In this series we switch the _rcuidle
tracepoint callers to use SRCU instead of sched-RCU. Inorder to
dereference the pointer to the probe functions, we could call
srcu_dereference, however this API will call back into lockdep to check
if the lock is held *before* the lockdep probe hooks have a chance to
run and annotate the IRQ enabled/disabled state.

For this reason we need a notrace variant of srcu_dereference since
otherwise we get lockdep splats. This patch adds the needed
srcu_dereference_notrace variant.

Link: http://lkml.kernel.org/r/20180628182149.226164-3-j...@joelfernandes.org

Reviewed-by: Paul E. McKenney 
Signed-off-by: Joel Fernandes (Google) 
Signed-off-by: Steven Rostedt (VMware) 
---
 include/linux/srcu.h | 5 +
 1 file changed, 5 insertions(+)

diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 3e72a291c401..67135d4a8a30 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -169,6 +169,11 @@ static inline int srcu_read_lock_held(const struct 
srcu_struct *sp)
  */
 #define srcu_dereference(p, sp) srcu_dereference_check((p), (sp), 0)
 
+/**
+ * srcu_dereference_notrace - no tracing and no lockdep calls from here
+ */
+#define srcu_dereference_notrace(p, sp) srcu_dereference_check((p), (sp), 1)
+
 /**
  * srcu_read_lock - register a new reader for an SRCU-protected structure.
  * @sp: srcu_struct in which to register the new reader.
-- 
2.18.0




[for-next][PATCH 01/34] srcu: Add notrace variants of srcu_read_{lock,unlock}

2018-08-11 Thread Steven Rostedt
From: Paul McKenney 

This is needed for a future tracepoint patch that uses srcu, and to make
sure it doesn't call into lockdep.

tracepoint code already calls notrace variants for rcu_read_lock_sched
so this patch does the same for srcu which will be used in a later
patch. Keeps it consistent with rcu-sched.

[Joel: Added commit message]
Link: http://lkml.kernel.org/r/20180628182149.226164-2-j...@joelfernandes.org

Reviewed-by: Steven Rostedt (VMware) 
Signed-off-by: Paul McKenney 
Signed-off-by: Joel Fernandes (Google) 
Signed-off-by: Steven Rostedt (VMware) 
---
 include/linux/srcu.h | 17 +
 1 file changed, 17 insertions(+)

diff --git a/include/linux/srcu.h b/include/linux/srcu.h
index 91494d7e8e41..3e72a291c401 100644
--- a/include/linux/srcu.h
+++ b/include/linux/srcu.h
@@ -195,6 +195,16 @@ static inline int srcu_read_lock(struct srcu_struct *sp) 
__acquires(sp)
return retval;
 }
 
+/* Used by tracing, cannot be traced and cannot invoke lockdep. */
+static inline notrace int
+srcu_read_lock_notrace(struct srcu_struct *sp) __acquires(sp)
+{
+   int retval;
+
+   retval = __srcu_read_lock(sp);
+   return retval;
+}
+
 /**
  * srcu_read_unlock - unregister a old reader from an SRCU-protected structure.
  * @sp: srcu_struct in which to unregister the old reader.
@@ -209,6 +219,13 @@ static inline void srcu_read_unlock(struct srcu_struct 
*sp, int idx)
__srcu_read_unlock(sp, idx);
 }
 
+/* Used by tracing, cannot be traced and cannot call lockdep. */
+static inline notrace void
+srcu_read_unlock_notrace(struct srcu_struct *sp, int idx) __releases(sp)
+{
+   __srcu_read_unlock(sp, idx);
+}
+
 /**
  * smp_mb__after_srcu_read_unlock - ensure full ordering after srcu_read_unlock
  *
-- 
2.18.0




[for-next][PATCH 03/34] tracing/irqsoff: Split reset into separate functions

2018-08-11 Thread Steven Rostedt
From: "Joel Fernandes (Google)" 

Split reset functions into seperate functions in preparation
of future patches that need to do tracer specific reset.

Link: http://lkml.kernel.org/r/20180628182149.226164-4-j...@joelfernandes.org

Reviewed-by: Namhyung Kim 
Signed-off-by: Joel Fernandes (Google) 
Signed-off-by: Steven Rostedt (VMware) 
---
 kernel/trace/trace_irqsoff.c | 22 +++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
index 03ecb4465ee4..f8daa754cce2 100644
--- a/kernel/trace/trace_irqsoff.c
+++ b/kernel/trace/trace_irqsoff.c
@@ -634,7 +634,7 @@ static int __irqsoff_tracer_init(struct trace_array *tr)
return 0;
 }
 
-static void irqsoff_tracer_reset(struct trace_array *tr)
+static void __irqsoff_tracer_reset(struct trace_array *tr)
 {
int lat_flag = save_flags & TRACE_ITER_LATENCY_FMT;
int overwrite_flag = save_flags & TRACE_ITER_OVERWRITE;
@@ -665,6 +665,12 @@ static int irqsoff_tracer_init(struct trace_array *tr)
 
return __irqsoff_tracer_init(tr);
 }
+
+static void irqsoff_tracer_reset(struct trace_array *tr)
+{
+   __irqsoff_tracer_reset(tr);
+}
+
 static struct tracer irqsoff_tracer __read_mostly =
 {
.name   = "irqsoff",
@@ -697,11 +703,16 @@ static int preemptoff_tracer_init(struct trace_array *tr)
return __irqsoff_tracer_init(tr);
 }
 
+static void preemptoff_tracer_reset(struct trace_array *tr)
+{
+   __irqsoff_tracer_reset(tr);
+}
+
 static struct tracer preemptoff_tracer __read_mostly =
 {
.name   = "preemptoff",
.init   = preemptoff_tracer_init,
-   .reset  = irqsoff_tracer_reset,
+   .reset  = preemptoff_tracer_reset,
.start  = irqsoff_tracer_start,
.stop   = irqsoff_tracer_stop,
.print_max  = true,
@@ -731,11 +742,16 @@ static int preemptirqsoff_tracer_init(struct trace_array 
*tr)
return __irqsoff_tracer_init(tr);
 }
 
+static void preemptirqsoff_tracer_reset(struct trace_array *tr)
+{
+   __irqsoff_tracer_reset(tr);
+}
+
 static struct tracer preemptirqsoff_tracer __read_mostly =
 {
.name   = "preemptirqsoff",
.init   = preemptirqsoff_tracer_init,
-   .reset  = irqsoff_tracer_reset,
+   .reset  = preemptirqsoff_tracer_reset,
.start  = irqsoff_tracer_start,
.stop   = irqsoff_tracer_stop,
.print_max  = true,
-- 
2.18.0




[for-next][PATCH 03/34] tracing/irqsoff: Split reset into separate functions

2018-08-11 Thread Steven Rostedt
From: "Joel Fernandes (Google)" 

Split reset functions into seperate functions in preparation
of future patches that need to do tracer specific reset.

Link: http://lkml.kernel.org/r/20180628182149.226164-4-j...@joelfernandes.org

Reviewed-by: Namhyung Kim 
Signed-off-by: Joel Fernandes (Google) 
Signed-off-by: Steven Rostedt (VMware) 
---
 kernel/trace/trace_irqsoff.c | 22 +++---
 1 file changed, 19 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace_irqsoff.c b/kernel/trace/trace_irqsoff.c
index 03ecb4465ee4..f8daa754cce2 100644
--- a/kernel/trace/trace_irqsoff.c
+++ b/kernel/trace/trace_irqsoff.c
@@ -634,7 +634,7 @@ static int __irqsoff_tracer_init(struct trace_array *tr)
return 0;
 }
 
-static void irqsoff_tracer_reset(struct trace_array *tr)
+static void __irqsoff_tracer_reset(struct trace_array *tr)
 {
int lat_flag = save_flags & TRACE_ITER_LATENCY_FMT;
int overwrite_flag = save_flags & TRACE_ITER_OVERWRITE;
@@ -665,6 +665,12 @@ static int irqsoff_tracer_init(struct trace_array *tr)
 
return __irqsoff_tracer_init(tr);
 }
+
+static void irqsoff_tracer_reset(struct trace_array *tr)
+{
+   __irqsoff_tracer_reset(tr);
+}
+
 static struct tracer irqsoff_tracer __read_mostly =
 {
.name   = "irqsoff",
@@ -697,11 +703,16 @@ static int preemptoff_tracer_init(struct trace_array *tr)
return __irqsoff_tracer_init(tr);
 }
 
+static void preemptoff_tracer_reset(struct trace_array *tr)
+{
+   __irqsoff_tracer_reset(tr);
+}
+
 static struct tracer preemptoff_tracer __read_mostly =
 {
.name   = "preemptoff",
.init   = preemptoff_tracer_init,
-   .reset  = irqsoff_tracer_reset,
+   .reset  = preemptoff_tracer_reset,
.start  = irqsoff_tracer_start,
.stop   = irqsoff_tracer_stop,
.print_max  = true,
@@ -731,11 +742,16 @@ static int preemptirqsoff_tracer_init(struct trace_array 
*tr)
return __irqsoff_tracer_init(tr);
 }
 
+static void preemptirqsoff_tracer_reset(struct trace_array *tr)
+{
+   __irqsoff_tracer_reset(tr);
+}
+
 static struct tracer preemptirqsoff_tracer __read_mostly =
 {
.name   = "preemptirqsoff",
.init   = preemptirqsoff_tracer_init,
-   .reset  = irqsoff_tracer_reset,
+   .reset  = preemptirqsoff_tracer_reset,
.start  = irqsoff_tracer_start,
.stop   = irqsoff_tracer_stop,
.print_max  = true,
-- 
2.18.0




[for-next][PATCH 07/34] tracing: Remove orphaned function using_ftrace_ops_list_func().

2018-08-11 Thread Steven Rostedt
From: Masami Hiramatsu 

Remove using_ftrace_ops_list_func() since it is no longer used.

Using ftrace_ops_list_func() has been introduced by commit 7eea4fce0246
("tracing/stack_trace: Skip 4 instead of 3 when using ftrace_ops_list_func")
as a helper function, but its caller has been removed by commit 72ac426a5bb0
("tracing: Clean up stack tracing and fix fentry updates").  So it is not
called anymore.

Link: 
http://lkml.kernel.org/r/153260904427.12474.9952096317439329851.stgit@devbox

Signed-off-by: Masami Hiramatsu 
Signed-off-by: Steven Rostedt (VMware) 
---
 kernel/trace/ftrace.c | 5 -
 kernel/trace/trace.h  | 1 -
 2 files changed, 6 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index caf9cbf35816..b8b3324ca1c8 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -313,11 +313,6 @@ static void update_ftrace_function(void)
ftrace_trace_function = func;
 }
 
-int using_ftrace_ops_list_func(void)
-{
-   return ftrace_trace_function == ftrace_ops_list_func;
-}
-
 static void add_ftrace_ops(struct ftrace_ops __rcu **list,
   struct ftrace_ops *ops)
 {
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 3f9d9acc69e6..e1c8a1d6f240 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -937,7 +937,6 @@ void ftrace_destroy_function_files(struct trace_array *tr);
 void ftrace_init_global_array_ops(struct trace_array *tr);
 void ftrace_init_array_ops(struct trace_array *tr, ftrace_func_t func);
 void ftrace_reset_array_ops(struct trace_array *tr);
-int using_ftrace_ops_list_func(void);
 void ftrace_init_tracefs(struct trace_array *tr, struct dentry *d_tracer);
 void ftrace_init_tracefs_toplevel(struct trace_array *tr,
  struct dentry *d_tracer);
-- 
2.18.0




[for-next][PATCH 04/34] lib: Add module for testing preemptoff/irqsoff latency tracers

2018-08-11 Thread Steven Rostedt
From: "Joel Fernandes (Google)" 

Here we introduce a test module for introducing a long preempt or irq
disable delay in the kernel which the preemptoff or irqsoff tracers can
detect. This module is to be used only for test purposes and is default
disabled.

Following is the expected output (only briefly shown) that can be parsed
to verify that the tracers are working correctly. We will use this from
the kselftests in future patches.

For the preemptoff tracer:

echo preemptoff > /d/tracing/current_tracer
sleep 1
insmod ./preemptirq_delay_test.ko test_mode=preempt delay=50
sleep 1
bash-4.3# cat /d/tracing/trace
preempt -10662...20us@: preemptirq_delay_run <-preemptirq_delay_run
preempt -10662...2 52us : preemptirq_delay_run <-preemptirq_delay_run
preempt -10662...2 54us : tracer_preempt_on <-preemptirq_delay_run
preempt -10662...2 500012us : 
 => kthread
 => ret_from_fork

For the irqsoff tracer:

echo irqsoff > /d/tracing/current_tracer
sleep 1
insmod ./preemptirq_delay_test.ko test_mode=irq delay=50
sleep 1
bash-4.3# cat /d/tracing/trace
irq dis -10691d..10us@: preemptirq_delay_run
irq dis -10691d..1 51us : preemptirq_delay_run
irq dis -10691d..1 52us : tracer_hardirqs_on <-preemptirq_delay_run
irq dis -10691d..1 55us : 
 => ret_from_fork

Link: http://lkml.kernel.org/r/20180712213611.ga8...@joelaf.mtv.corp.google.com

Cc: Boqun Feng 
Cc: Byungchul Park 
Cc: Ingo Molnar 
Cc: Julia Cartwright 
Cc: Masami Hiramatsu 
Cc: Mathieu Desnoyers 
Cc: Namhyung Kim 
Cc: Paul McKenney 
Cc: Peter Zijlstra 
Cc: Shuah Khan 
Cc: Thomas Glexiner 
Cc: Todd Kjos 
Cc: Tom Zanussi 
Cc: Andy Shevchenko 
Reviewed-by: Andy Shevchenko 
[ Erick is a co-developer of this commit ]
Signed-off-by: Erick Reyes 
Signed-off-by: Joel Fernandes (Google) 
Signed-off-by: Steven Rostedt (VMware) 
---
 kernel/trace/Kconfig | 15 ++
 kernel/trace/Makefile|  1 +
 kernel/trace/preemptirq_delay_test.c | 72 
 3 files changed, 88 insertions(+)
 create mode 100644 kernel/trace/preemptirq_delay_test.c

diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index dcc0166d1997..e15fadbe5dfb 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -687,6 +687,21 @@ config RING_BUFFER_STARTUP_TEST
 
 If unsure, say N
 
+config PREEMPTIRQ_DELAY_TEST
+   tristate "Preempt / IRQ disable delay thread to test latency tracers"
+   depends on m
+   help
+ Select this option to build a test module that can help test latency
+ tracers by executing a preempt or irq disable section with a user
+ configurable delay. The module busy waits for the duration of the
+ critical section.
+
+ For example, the following invocation forces a one-time irq-disabled
+ critical section for 500us:
+ modprobe preemptirq_delay_test test_mode=irq delay=50
+
+ If unsure, say N
+
 config TRACE_EVAL_MAP_FILE
bool "Show eval mappings for trace events"
depends on TRACING
diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile
index e2538c7638d4..31c6b524c260 100644
--- a/kernel/trace/Makefile
+++ b/kernel/trace/Makefile
@@ -33,6 +33,7 @@ obj-$(CONFIG_TRACING) += trace_seq.o
 obj-$(CONFIG_TRACING) += trace_stat.o
 obj-$(CONFIG_TRACING) += trace_printk.o
 obj-$(CONFIG_TRACING_MAP) += tracing_map.o
+obj-$(CONFIG_PREEMPTIRQ_DELAY_TEST) += preemptirq_delay_test.o
 obj-$(CONFIG_CONTEXT_SWITCH_TRACER) += trace_sched_switch.o
 obj-$(CONFIG_FUNCTION_TRACER) += trace_functions.o
 obj-$(CONFIG_PREEMPTIRQ_EVENTS) += trace_irqsoff.o
diff --git a/kernel/trace/preemptirq_delay_test.c 
b/kernel/trace/preemptirq_delay_test.c
new file mode 100644
index ..c97a026c0720
--- /dev/null
+++ b/kernel/trace/preemptirq_delay_test.c
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Preempt / IRQ disable delay thread to test latency tracers
+ *
+ * Copyright (C) 2018 Joel Fernandes (Google) 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static ulong delay = 100;
+static char test_mode[10] = "irq";
+
+module_param_named(delay, delay, ulong, S_IRUGO);
+module_param_string(test_mode, test_mode, 10, S_IRUGO);
+MODULE_PARM_DESC(delay, "Period in microseconds (100 uS default)");
+MODULE_PARM_DESC(test_mode, "Mode of the test such as preempt or irq (default 
irq)");
+
+static void busy_wait(ulong time)
+{
+   ktime_t start, end;
+   start = ktime_get();
+   do {
+   end = ktime_get();
+   if (kthread_should_stop())
+   break;
+   } while (ktime_to_ns(ktime_sub(end, start)) < (time * 1000));
+}
+
+int preemptirq_delay_run(void *data)
+{
+   unsigned long flags;
+
+   if (!strcmp(test_mode, "irq")) {
+   local_irq_save(flags);
+   busy_wait(delay);
+   local_irq_restore(flags);
+   } else if 

[for-next][PATCH 06/34] tracing: Make unregister_trigger() static

2018-08-11 Thread Steven Rostedt
From: "Steven Rostedt (VMware)" 

Nothing uses unregister_trigger() outside of trace_events_trigger.c file,
thus it should be static. Not sure why this was ever converted, because
its counter part, register_trigger(), was always static.

Signed-off-by: Steven Rostedt (VMware) 
---
 kernel/trace/trace.h| 3 ---
 kernel/trace/trace_events_trigger.c | 6 +++---
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index f8f86231ad90..3f9d9acc69e6 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -1533,9 +1533,6 @@ extern int event_trigger_init(struct event_trigger_ops 
*ops,
 extern int trace_event_trigger_enable_disable(struct trace_event_file *file,
  int trigger_enable);
 extern void update_cond_flag(struct trace_event_file *file);
-extern void unregister_trigger(char *glob, struct event_trigger_ops *ops,
-  struct event_trigger_data *test,
-  struct trace_event_file *file);
 extern int set_trigger_filter(char *filter_str,
  struct event_trigger_data *trigger_data,
  struct trace_event_file *file);
diff --git a/kernel/trace/trace_events_trigger.c 
b/kernel/trace/trace_events_trigger.c
index 5dea177cef53..58d21fd52932 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -579,9 +579,9 @@ static int register_trigger(char *glob, struct 
event_trigger_ops *ops,
  * Usually used directly as the @unreg method in event command
  * implementations.
  */
-void unregister_trigger(char *glob, struct event_trigger_ops *ops,
-   struct event_trigger_data *test,
-   struct trace_event_file *file)
+static void unregister_trigger(char *glob, struct event_trigger_ops *ops,
+  struct event_trigger_data *test,
+  struct trace_event_file *file)
 {
struct event_trigger_data *data;
bool unregistered = false;
-- 
2.18.0




[for-next][PATCH 07/34] tracing: Remove orphaned function using_ftrace_ops_list_func().

2018-08-11 Thread Steven Rostedt
From: Masami Hiramatsu 

Remove using_ftrace_ops_list_func() since it is no longer used.

Using ftrace_ops_list_func() has been introduced by commit 7eea4fce0246
("tracing/stack_trace: Skip 4 instead of 3 when using ftrace_ops_list_func")
as a helper function, but its caller has been removed by commit 72ac426a5bb0
("tracing: Clean up stack tracing and fix fentry updates").  So it is not
called anymore.

Link: 
http://lkml.kernel.org/r/153260904427.12474.9952096317439329851.stgit@devbox

Signed-off-by: Masami Hiramatsu 
Signed-off-by: Steven Rostedt (VMware) 
---
 kernel/trace/ftrace.c | 5 -
 kernel/trace/trace.h  | 1 -
 2 files changed, 6 deletions(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index caf9cbf35816..b8b3324ca1c8 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -313,11 +313,6 @@ static void update_ftrace_function(void)
ftrace_trace_function = func;
 }
 
-int using_ftrace_ops_list_func(void)
-{
-   return ftrace_trace_function == ftrace_ops_list_func;
-}
-
 static void add_ftrace_ops(struct ftrace_ops __rcu **list,
   struct ftrace_ops *ops)
 {
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 3f9d9acc69e6..e1c8a1d6f240 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -937,7 +937,6 @@ void ftrace_destroy_function_files(struct trace_array *tr);
 void ftrace_init_global_array_ops(struct trace_array *tr);
 void ftrace_init_array_ops(struct trace_array *tr, ftrace_func_t func);
 void ftrace_reset_array_ops(struct trace_array *tr);
-int using_ftrace_ops_list_func(void);
 void ftrace_init_tracefs(struct trace_array *tr, struct dentry *d_tracer);
 void ftrace_init_tracefs_toplevel(struct trace_array *tr,
  struct dentry *d_tracer);
-- 
2.18.0




[for-next][PATCH 04/34] lib: Add module for testing preemptoff/irqsoff latency tracers

2018-08-11 Thread Steven Rostedt
From: "Joel Fernandes (Google)" 

Here we introduce a test module for introducing a long preempt or irq
disable delay in the kernel which the preemptoff or irqsoff tracers can
detect. This module is to be used only for test purposes and is default
disabled.

Following is the expected output (only briefly shown) that can be parsed
to verify that the tracers are working correctly. We will use this from
the kselftests in future patches.

For the preemptoff tracer:

echo preemptoff > /d/tracing/current_tracer
sleep 1
insmod ./preemptirq_delay_test.ko test_mode=preempt delay=50
sleep 1
bash-4.3# cat /d/tracing/trace
preempt -10662...20us@: preemptirq_delay_run <-preemptirq_delay_run
preempt -10662...2 52us : preemptirq_delay_run <-preemptirq_delay_run
preempt -10662...2 54us : tracer_preempt_on <-preemptirq_delay_run
preempt -10662...2 500012us : 
 => kthread
 => ret_from_fork

For the irqsoff tracer:

echo irqsoff > /d/tracing/current_tracer
sleep 1
insmod ./preemptirq_delay_test.ko test_mode=irq delay=50
sleep 1
bash-4.3# cat /d/tracing/trace
irq dis -10691d..10us@: preemptirq_delay_run
irq dis -10691d..1 51us : preemptirq_delay_run
irq dis -10691d..1 52us : tracer_hardirqs_on <-preemptirq_delay_run
irq dis -10691d..1 55us : 
 => ret_from_fork

Link: http://lkml.kernel.org/r/20180712213611.ga8...@joelaf.mtv.corp.google.com

Cc: Boqun Feng 
Cc: Byungchul Park 
Cc: Ingo Molnar 
Cc: Julia Cartwright 
Cc: Masami Hiramatsu 
Cc: Mathieu Desnoyers 
Cc: Namhyung Kim 
Cc: Paul McKenney 
Cc: Peter Zijlstra 
Cc: Shuah Khan 
Cc: Thomas Glexiner 
Cc: Todd Kjos 
Cc: Tom Zanussi 
Cc: Andy Shevchenko 
Reviewed-by: Andy Shevchenko 
[ Erick is a co-developer of this commit ]
Signed-off-by: Erick Reyes 
Signed-off-by: Joel Fernandes (Google) 
Signed-off-by: Steven Rostedt (VMware) 
---
 kernel/trace/Kconfig | 15 ++
 kernel/trace/Makefile|  1 +
 kernel/trace/preemptirq_delay_test.c | 72 
 3 files changed, 88 insertions(+)
 create mode 100644 kernel/trace/preemptirq_delay_test.c

diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index dcc0166d1997..e15fadbe5dfb 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -687,6 +687,21 @@ config RING_BUFFER_STARTUP_TEST
 
 If unsure, say N
 
+config PREEMPTIRQ_DELAY_TEST
+   tristate "Preempt / IRQ disable delay thread to test latency tracers"
+   depends on m
+   help
+ Select this option to build a test module that can help test latency
+ tracers by executing a preempt or irq disable section with a user
+ configurable delay. The module busy waits for the duration of the
+ critical section.
+
+ For example, the following invocation forces a one-time irq-disabled
+ critical section for 500us:
+ modprobe preemptirq_delay_test test_mode=irq delay=50
+
+ If unsure, say N
+
 config TRACE_EVAL_MAP_FILE
bool "Show eval mappings for trace events"
depends on TRACING
diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile
index e2538c7638d4..31c6b524c260 100644
--- a/kernel/trace/Makefile
+++ b/kernel/trace/Makefile
@@ -33,6 +33,7 @@ obj-$(CONFIG_TRACING) += trace_seq.o
 obj-$(CONFIG_TRACING) += trace_stat.o
 obj-$(CONFIG_TRACING) += trace_printk.o
 obj-$(CONFIG_TRACING_MAP) += tracing_map.o
+obj-$(CONFIG_PREEMPTIRQ_DELAY_TEST) += preemptirq_delay_test.o
 obj-$(CONFIG_CONTEXT_SWITCH_TRACER) += trace_sched_switch.o
 obj-$(CONFIG_FUNCTION_TRACER) += trace_functions.o
 obj-$(CONFIG_PREEMPTIRQ_EVENTS) += trace_irqsoff.o
diff --git a/kernel/trace/preemptirq_delay_test.c 
b/kernel/trace/preemptirq_delay_test.c
new file mode 100644
index ..c97a026c0720
--- /dev/null
+++ b/kernel/trace/preemptirq_delay_test.c
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Preempt / IRQ disable delay thread to test latency tracers
+ *
+ * Copyright (C) 2018 Joel Fernandes (Google) 
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+static ulong delay = 100;
+static char test_mode[10] = "irq";
+
+module_param_named(delay, delay, ulong, S_IRUGO);
+module_param_string(test_mode, test_mode, 10, S_IRUGO);
+MODULE_PARM_DESC(delay, "Period in microseconds (100 uS default)");
+MODULE_PARM_DESC(test_mode, "Mode of the test such as preempt or irq (default 
irq)");
+
+static void busy_wait(ulong time)
+{
+   ktime_t start, end;
+   start = ktime_get();
+   do {
+   end = ktime_get();
+   if (kthread_should_stop())
+   break;
+   } while (ktime_to_ns(ktime_sub(end, start)) < (time * 1000));
+}
+
+int preemptirq_delay_run(void *data)
+{
+   unsigned long flags;
+
+   if (!strcmp(test_mode, "irq")) {
+   local_irq_save(flags);
+   busy_wait(delay);
+   local_irq_restore(flags);
+   } else if 

[for-next][PATCH 06/34] tracing: Make unregister_trigger() static

2018-08-11 Thread Steven Rostedt
From: "Steven Rostedt (VMware)" 

Nothing uses unregister_trigger() outside of trace_events_trigger.c file,
thus it should be static. Not sure why this was ever converted, because
its counter part, register_trigger(), was always static.

Signed-off-by: Steven Rostedt (VMware) 
---
 kernel/trace/trace.h| 3 ---
 kernel/trace/trace_events_trigger.c | 6 +++---
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index f8f86231ad90..3f9d9acc69e6 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -1533,9 +1533,6 @@ extern int event_trigger_init(struct event_trigger_ops 
*ops,
 extern int trace_event_trigger_enable_disable(struct trace_event_file *file,
  int trigger_enable);
 extern void update_cond_flag(struct trace_event_file *file);
-extern void unregister_trigger(char *glob, struct event_trigger_ops *ops,
-  struct event_trigger_data *test,
-  struct trace_event_file *file);
 extern int set_trigger_filter(char *filter_str,
  struct event_trigger_data *trigger_data,
  struct trace_event_file *file);
diff --git a/kernel/trace/trace_events_trigger.c 
b/kernel/trace/trace_events_trigger.c
index 5dea177cef53..58d21fd52932 100644
--- a/kernel/trace/trace_events_trigger.c
+++ b/kernel/trace/trace_events_trigger.c
@@ -579,9 +579,9 @@ static int register_trigger(char *glob, struct 
event_trigger_ops *ops,
  * Usually used directly as the @unreg method in event command
  * implementations.
  */
-void unregister_trigger(char *glob, struct event_trigger_ops *ops,
-   struct event_trigger_data *test,
-   struct trace_event_file *file)
+static void unregister_trigger(char *glob, struct event_trigger_ops *ops,
+  struct event_trigger_data *test,
+  struct trace_event_file *file)
 {
struct event_trigger_data *data;
bool unregistered = false;
-- 
2.18.0




[for-next][PATCH 08/34] tracing: Remove orphaned function ftrace_nr_registered_ops()

2018-08-11 Thread Steven Rostedt
From: Masami Hiramatsu 

Remove ftrace_nr_registered_ops() because it is no longer used.

ftrace_nr_registered_ops() has been introduced by commit ea701f11da44
("ftrace: Add selftest to test function trace recursion protection"), but
its caller has been removed by commit 05cbbf643b8e ("tracing: Fix selftest
function recursion accounting"). So it is not called anymore.

Link: 
http://lkml.kernel.org/r/153260907227.12474.5234899025934963683.stgit@devbox

Signed-off-by: Masami Hiramatsu 
Signed-off-by: Steven Rostedt (VMware) 
---
 include/linux/ftrace.h |  6 --
 kernel/trace/ftrace.c  | 24 
 2 files changed, 30 deletions(-)

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index ebb77674be90..63af5eb0ff46 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -234,10 +234,6 @@ extern void ftrace_stub(unsigned long a0, unsigned long a1,
  */
 #define register_ftrace_function(ops) ({ 0; })
 #define unregister_ftrace_function(ops) ({ 0; })
-static inline int ftrace_nr_registered_ops(void)
-{
-   return 0;
-}
 static inline void ftrace_kill(void) { }
 static inline void ftrace_free_init_mem(void) { }
 static inline void ftrace_free_mem(struct module *mod, void *start, void *end) 
{ }
@@ -328,8 +324,6 @@ struct seq_file;
 
 extern int ftrace_text_reserved(const void *start, const void *end);
 
-extern int ftrace_nr_registered_ops(void);
-
 struct ftrace_ops *ftrace_ops_trampoline(unsigned long addr);
 
 bool is_ftrace_trampoline(unsigned long addr);
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index b8b3324ca1c8..0d380a98a880 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -157,30 +157,6 @@ static inline void ftrace_ops_init(struct ftrace_ops *ops)
 #endif
 }
 
-/**
- * ftrace_nr_registered_ops - return number of ops registered
- *
- * Returns the number of ftrace_ops registered and tracing functions
- */
-int ftrace_nr_registered_ops(void)
-{
-   struct ftrace_ops *ops;
-   int cnt = 0;
-
-   mutex_lock(_lock);
-
-   for (ops = rcu_dereference_protected(ftrace_ops_list,
-lockdep_is_held(_lock));
-ops != _list_end;
-ops = rcu_dereference_protected(ops->next,
-lockdep_is_held(_lock)))
-   cnt++;
-
-   mutex_unlock(_lock);
-
-   return cnt;
-}
-
 static void ftrace_pid_func(unsigned long ip, unsigned long parent_ip,
struct ftrace_ops *op, struct pt_regs *regs)
 {
-- 
2.18.0




[for-next][PATCH 09/34] tracing/kprobes: Simplify the logic of enable_trace_kprobe()

2018-08-11 Thread Steven Rostedt
From: "Steven Rostedt (VMware)" 

The function enable_trace_kprobe() performs slightly differently if the file
parameter is passed in as NULL on non-NULL. Instead of checking file twice,
move the code between the two tests into a static inline helper function to
make the code easier to follow.

Link: http://lkml.kernel.org/r/20180725224728.7b1d5...@vmware.local.home
Link: http://lkml.kernel.org/r/20180726121152.4dd54...@gandalf.local.home

Reviewed-by: Josh Poimboeuf 
Acked-by: Masami Hiramatsu 
Signed-off-by: Steven Rostedt (VMware) 
---
 kernel/trace/trace_kprobe.c | 42 +
 1 file changed, 24 insertions(+), 18 deletions(-)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 6b71860f3998..0534eb8b7640 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -393,6 +393,20 @@ static struct trace_kprobe *find_trace_kprobe(const char 
*event,
return NULL;
 }
 
+static inline int __enable_trace_kprobe(struct trace_kprobe *tk)
+{
+   int ret = 0;
+
+   if (trace_probe_is_registered(>tp) && !trace_kprobe_has_gone(tk)) {
+   if (trace_kprobe_is_return(tk))
+   ret = enable_kretprobe(>rp);
+   else
+   ret = enable_kprobe(>rp.kp);
+   }
+
+   return ret;
+}
+
 /*
  * Enable trace_probe
  * if the file is NULL, enable "perf" handler, or enable "trace" handler.
@@ -400,7 +414,7 @@ static struct trace_kprobe *find_trace_kprobe(const char 
*event,
 static int
 enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file)
 {
-   struct event_file_link *link = NULL;
+   struct event_file_link *link;
int ret = 0;
 
if (file) {
@@ -414,26 +428,18 @@ enable_trace_kprobe(struct trace_kprobe *tk, struct 
trace_event_file *file)
list_add_tail_rcu(>list, >tp.files);
 
tk->tp.flags |= TP_FLAG_TRACE;
-   } else
-   tk->tp.flags |= TP_FLAG_PROFILE;
-
-   if (trace_probe_is_registered(>tp) && !trace_kprobe_has_gone(tk)) {
-   if (trace_kprobe_is_return(tk))
-   ret = enable_kretprobe(>rp);
-   else
-   ret = enable_kprobe(>rp.kp);
-   }
-
-   if (ret) {
-   if (file) {
-   /* Notice the if is true on not WARN() */
-   if (!WARN_ON_ONCE(!link))
-   list_del_rcu(>list);
+   ret = __enable_trace_kprobe(tk);
+   if (ret) {
+   list_del_rcu(>list);
kfree(link);
tk->tp.flags &= ~TP_FLAG_TRACE;
-   } else {
-   tk->tp.flags &= ~TP_FLAG_PROFILE;
}
+
+   } else {
+   tk->tp.flags |= TP_FLAG_PROFILE;
+   ret = __enable_trace_kprobe(tk);
+   if (ret)
+   tk->tp.flags &= ~TP_FLAG_PROFILE;
}
  out:
return ret;
-- 
2.18.0




[for-next][PATCH 08/34] tracing: Remove orphaned function ftrace_nr_registered_ops()

2018-08-11 Thread Steven Rostedt
From: Masami Hiramatsu 

Remove ftrace_nr_registered_ops() because it is no longer used.

ftrace_nr_registered_ops() has been introduced by commit ea701f11da44
("ftrace: Add selftest to test function trace recursion protection"), but
its caller has been removed by commit 05cbbf643b8e ("tracing: Fix selftest
function recursion accounting"). So it is not called anymore.

Link: 
http://lkml.kernel.org/r/153260907227.12474.5234899025934963683.stgit@devbox

Signed-off-by: Masami Hiramatsu 
Signed-off-by: Steven Rostedt (VMware) 
---
 include/linux/ftrace.h |  6 --
 kernel/trace/ftrace.c  | 24 
 2 files changed, 30 deletions(-)

diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h
index ebb77674be90..63af5eb0ff46 100644
--- a/include/linux/ftrace.h
+++ b/include/linux/ftrace.h
@@ -234,10 +234,6 @@ extern void ftrace_stub(unsigned long a0, unsigned long a1,
  */
 #define register_ftrace_function(ops) ({ 0; })
 #define unregister_ftrace_function(ops) ({ 0; })
-static inline int ftrace_nr_registered_ops(void)
-{
-   return 0;
-}
 static inline void ftrace_kill(void) { }
 static inline void ftrace_free_init_mem(void) { }
 static inline void ftrace_free_mem(struct module *mod, void *start, void *end) 
{ }
@@ -328,8 +324,6 @@ struct seq_file;
 
 extern int ftrace_text_reserved(const void *start, const void *end);
 
-extern int ftrace_nr_registered_ops(void);
-
 struct ftrace_ops *ftrace_ops_trampoline(unsigned long addr);
 
 bool is_ftrace_trampoline(unsigned long addr);
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index b8b3324ca1c8..0d380a98a880 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -157,30 +157,6 @@ static inline void ftrace_ops_init(struct ftrace_ops *ops)
 #endif
 }
 
-/**
- * ftrace_nr_registered_ops - return number of ops registered
- *
- * Returns the number of ftrace_ops registered and tracing functions
- */
-int ftrace_nr_registered_ops(void)
-{
-   struct ftrace_ops *ops;
-   int cnt = 0;
-
-   mutex_lock(_lock);
-
-   for (ops = rcu_dereference_protected(ftrace_ops_list,
-lockdep_is_held(_lock));
-ops != _list_end;
-ops = rcu_dereference_protected(ops->next,
-lockdep_is_held(_lock)))
-   cnt++;
-
-   mutex_unlock(_lock);
-
-   return cnt;
-}
-
 static void ftrace_pid_func(unsigned long ip, unsigned long parent_ip,
struct ftrace_ops *op, struct pt_regs *regs)
 {
-- 
2.18.0




[for-next][PATCH 09/34] tracing/kprobes: Simplify the logic of enable_trace_kprobe()

2018-08-11 Thread Steven Rostedt
From: "Steven Rostedt (VMware)" 

The function enable_trace_kprobe() performs slightly differently if the file
parameter is passed in as NULL on non-NULL. Instead of checking file twice,
move the code between the two tests into a static inline helper function to
make the code easier to follow.

Link: http://lkml.kernel.org/r/20180725224728.7b1d5...@vmware.local.home
Link: http://lkml.kernel.org/r/20180726121152.4dd54...@gandalf.local.home

Reviewed-by: Josh Poimboeuf 
Acked-by: Masami Hiramatsu 
Signed-off-by: Steven Rostedt (VMware) 
---
 kernel/trace/trace_kprobe.c | 42 +
 1 file changed, 24 insertions(+), 18 deletions(-)

diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 6b71860f3998..0534eb8b7640 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -393,6 +393,20 @@ static struct trace_kprobe *find_trace_kprobe(const char 
*event,
return NULL;
 }
 
+static inline int __enable_trace_kprobe(struct trace_kprobe *tk)
+{
+   int ret = 0;
+
+   if (trace_probe_is_registered(>tp) && !trace_kprobe_has_gone(tk)) {
+   if (trace_kprobe_is_return(tk))
+   ret = enable_kretprobe(>rp);
+   else
+   ret = enable_kprobe(>rp.kp);
+   }
+
+   return ret;
+}
+
 /*
  * Enable trace_probe
  * if the file is NULL, enable "perf" handler, or enable "trace" handler.
@@ -400,7 +414,7 @@ static struct trace_kprobe *find_trace_kprobe(const char 
*event,
 static int
 enable_trace_kprobe(struct trace_kprobe *tk, struct trace_event_file *file)
 {
-   struct event_file_link *link = NULL;
+   struct event_file_link *link;
int ret = 0;
 
if (file) {
@@ -414,26 +428,18 @@ enable_trace_kprobe(struct trace_kprobe *tk, struct 
trace_event_file *file)
list_add_tail_rcu(>list, >tp.files);
 
tk->tp.flags |= TP_FLAG_TRACE;
-   } else
-   tk->tp.flags |= TP_FLAG_PROFILE;
-
-   if (trace_probe_is_registered(>tp) && !trace_kprobe_has_gone(tk)) {
-   if (trace_kprobe_is_return(tk))
-   ret = enable_kretprobe(>rp);
-   else
-   ret = enable_kprobe(>rp.kp);
-   }
-
-   if (ret) {
-   if (file) {
-   /* Notice the if is true on not WARN() */
-   if (!WARN_ON_ONCE(!link))
-   list_del_rcu(>list);
+   ret = __enable_trace_kprobe(tk);
+   if (ret) {
+   list_del_rcu(>list);
kfree(link);
tk->tp.flags &= ~TP_FLAG_TRACE;
-   } else {
-   tk->tp.flags &= ~TP_FLAG_PROFILE;
}
+
+   } else {
+   tk->tp.flags |= TP_FLAG_PROFILE;
+   ret = __enable_trace_kprobe(tk);
+   if (ret)
+   tk->tp.flags &= ~TP_FLAG_PROFILE;
}
  out:
return ret;
-- 
2.18.0




[for-next][PATCH 10/34] tracing: preemptirq_delay_run() can be static

2018-08-11 Thread Steven Rostedt
From: kbuild test robot 

Automatically found by kbuild test robot.

Fixes: ffdc73a3b2ad ("lib: Add module for testing preemptoff/irqsoff latency 
tracers")
Signed-off-by: kbuild test robot 
Signed-off-by: Steven Rostedt (VMware) 
---
 kernel/trace/preemptirq_delay_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/preemptirq_delay_test.c 
b/kernel/trace/preemptirq_delay_test.c
index c97a026c0720..f704390db9fc 100644
--- a/kernel/trace/preemptirq_delay_test.c
+++ b/kernel/trace/preemptirq_delay_test.c
@@ -34,7 +34,7 @@ static void busy_wait(ulong time)
} while (ktime_to_ns(ktime_sub(end, start)) < (time * 1000));
 }
 
-int preemptirq_delay_run(void *data)
+static int preemptirq_delay_run(void *data)
 {
unsigned long flags;
 
-- 
2.18.0




[for-next][PATCH 10/34] tracing: preemptirq_delay_run() can be static

2018-08-11 Thread Steven Rostedt
From: kbuild test robot 

Automatically found by kbuild test robot.

Fixes: ffdc73a3b2ad ("lib: Add module for testing preemptoff/irqsoff latency 
tracers")
Signed-off-by: kbuild test robot 
Signed-off-by: Steven Rostedt (VMware) 
---
 kernel/trace/preemptirq_delay_test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/preemptirq_delay_test.c 
b/kernel/trace/preemptirq_delay_test.c
index c97a026c0720..f704390db9fc 100644
--- a/kernel/trace/preemptirq_delay_test.c
+++ b/kernel/trace/preemptirq_delay_test.c
@@ -34,7 +34,7 @@ static void busy_wait(ulong time)
} while (ktime_to_ns(ktime_sub(end, start)) < (time * 1000));
 }
 
-int preemptirq_delay_run(void *data)
+static int preemptirq_delay_run(void *data)
 {
unsigned long flags;
 
-- 
2.18.0




[for-next][PATCH 22/34] ring-buffer: Make ring_buffer_record_is_on() return bool

2018-08-11 Thread Steven Rostedt
From: "Steven Rostedt (VMware)" 

The value of ring_buffer_record_is_on() is either true or false, so have its
return value be bool.

Signed-off-by: Steven Rostedt (VMware) 
---
 include/linux/ring_buffer.h | 2 +-
 kernel/trace/ring_buffer.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 003d09ab308d..5176124fc4ba 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -164,7 +164,7 @@ void ring_buffer_record_disable(struct ring_buffer *buffer);
 void ring_buffer_record_enable(struct ring_buffer *buffer);
 void ring_buffer_record_off(struct ring_buffer *buffer);
 void ring_buffer_record_on(struct ring_buffer *buffer);
-int ring_buffer_record_is_on(struct ring_buffer *buffer);
+bool ring_buffer_record_is_on(struct ring_buffer *buffer);
 int ring_buffer_record_is_set_on(struct ring_buffer *buffer);
 void ring_buffer_record_disable_cpu(struct ring_buffer *buffer, int cpu);
 void ring_buffer_record_enable_cpu(struct ring_buffer *buffer, int cpu);
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 0b0b688ea166..ffb43cbc5c13 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -3221,7 +3221,7 @@ EXPORT_SYMBOL_GPL(ring_buffer_record_on);
  *
  * Returns true if the ring buffer is in a state that it accepts writes.
  */
-int ring_buffer_record_is_on(struct ring_buffer *buffer)
+bool ring_buffer_record_is_on(struct ring_buffer *buffer)
 {
return !atomic_read(>record_disabled);
 }
-- 
2.18.0




[for-next][PATCH 12/34] selftest/ftrace: Move kprobe selftest function to separate compile unit

2018-08-11 Thread Steven Rostedt
From: Francis Deslauriers 

Move selftest function to its own compile unit so it can be compiled
with the ftrace cflags (CC_FLAGS_FTRACE) allowing it to be probed
during the ftrace startup tests.

Link: 
http://lkml.kernel.org/r/153294604271.32740.16490677128630177030.stgit@devbox

Signed-off-by: Francis Deslauriers 
Signed-off-by: Masami Hiramatsu 
Signed-off-by: Steven Rostedt (VMware) 
---
 kernel/trace/Makefile|  5 +
 kernel/trace/trace_kprobe.c  | 12 +---
 kernel/trace/trace_kprobe_selftest.c | 10 ++
 kernel/trace/trace_kprobe_selftest.h |  7 +++
 4 files changed, 23 insertions(+), 11 deletions(-)
 create mode 100644 kernel/trace/trace_kprobe_selftest.c
 create mode 100644 kernel/trace/trace_kprobe_selftest.h

diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile
index 31c6b524c260..81902a79e049 100644
--- a/kernel/trace/Makefile
+++ b/kernel/trace/Makefile
@@ -13,6 +13,11 @@ obj-y += trace_selftest_dynamic.o
 endif
 endif
 
+ifdef CONFIG_FTRACE_STARTUP_TEST
+CFLAGS_trace_kprobe_selftest.o = $(CC_FLAGS_FTRACE)
+obj-$(CONFIG_KPROBE_EVENTS) += trace_kprobe_selftest.o
+endif
+
 # If unlikely tracing is enabled, do not trace these files
 ifdef CONFIG_TRACING_BRANCHES
 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 25662a780fdf..deeb03ae21e1 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 
+#include "trace_kprobe_selftest.h"
 #include "trace_probe.h"
 
 #define KPROBE_EVENT_SYSTEM "kprobes"
@@ -1587,17 +1588,6 @@ fs_initcall(init_kprobe_trace);
 
 
 #ifdef CONFIG_FTRACE_STARTUP_TEST
-/*
- * The "__used" keeps gcc from removing the function symbol
- * from the kallsyms table. 'noinline' makes sure that there
- * isn't an inlined version used by the test method below
- */
-static __used __init noinline int
-kprobe_trace_selftest_target(int a1, int a2, int a3, int a4, int a5, int a6)
-{
-   return a1 + a2 + a3 + a4 + a5 + a6;
-}
-
 static __init struct trace_event_file *
 find_trace_probe_file(struct trace_kprobe *tk, struct trace_array *tr)
 {
diff --git a/kernel/trace/trace_kprobe_selftest.c 
b/kernel/trace/trace_kprobe_selftest.c
new file mode 100644
index ..16548ee4c8c6
--- /dev/null
+++ b/kernel/trace/trace_kprobe_selftest.c
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Function used during the kprobe self test. This function is in a separate
+ * compile unit so it can be compile with CC_FLAGS_FTRACE to ensure that it
+ * can be probed by the selftests.
+ */
+int kprobe_trace_selftest_target(int a1, int a2, int a3, int a4, int a5, int 
a6)
+{
+   return a1 + a2 + a3 + a4 + a5 + a6;
+}
diff --git a/kernel/trace/trace_kprobe_selftest.h 
b/kernel/trace/trace_kprobe_selftest.h
new file mode 100644
index ..4e10ec41c013
--- /dev/null
+++ b/kernel/trace/trace_kprobe_selftest.h
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Function used during the kprobe self test. This function is in a separate
+ * compile unit so it can be compile with CC_FLAGS_FTRACE to ensure that it
+ * can be probed by the selftests.
+ */
+int kprobe_trace_selftest_target(int a1, int a2, int a3, int a4, int a5, int 
a6);
-- 
2.18.0




[for-next][PATCH 11/34] tracing: kprobes: Prohibit probing on notrace function

2018-08-11 Thread Steven Rostedt
From: Masami Hiramatsu 

Prohibit kprobe-events probing on notrace functions.  Since probing on a
notrace function can cause a recursive event call. In most cases those are just
skipped, but in some cases it falls into an infinite recursive call.

This protection can be disabled by the kconfig
CONFIG_KPROBE_EVENTS_ON_NOTRACE=y, but it is highly recommended to keep it
"n" for normal kernel builds.  Note that this is only available if "kprobes on
ftrace" has been implemented on the target arch and CONFIG_KPROBES_ON_FTRACE=y.

Link: 
http://lkml.kernel.org/r/153294601436.32740.10557881188933661239.stgit@devbox

Signed-off-by: Masami Hiramatsu 
Tested-by: Francis Deslauriers 
[ Slight grammar and spelling fixes ]
Signed-off-by: Steven Rostedt (VMware) 
---
 kernel/trace/Kconfig| 20 
 kernel/trace/trace_kprobe.c | 47 ++---
 2 files changed, 58 insertions(+), 9 deletions(-)

diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index e15fadbe5dfb..4d4eb15cc7fd 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -456,6 +456,26 @@ config KPROBE_EVENTS
  This option is also required by perf-probe subcommand of perf tools.
  If you want to use perf tools, this option is strongly recommended.
 
+config KPROBE_EVENTS_ON_NOTRACE
+   bool "Do NOT protect notrace function from kprobe events"
+   depends on KPROBE_EVENTS
+   depends on KPROBES_ON_FTRACE
+   default n
+   help
+ This is only for the developers who want to debug ftrace itself
+ using kprobe events.
+
+ If kprobes can use ftrace instead of breakpoint, ftrace related
+ functions are protected from kprobe-events to prevent an infinit
+ recursion or any unexpected execution path which leads to a kernel
+ crash.
+
+ This option disables such protection and allows you to put kprobe
+ events on ftrace functions for debugging ftrace by itself.
+ Note that this might let you shoot yourself in the foot.
+
+ If unsure, say N.
+
 config UPROBE_EVENTS
bool "Enable uprobes-based dynamic events"
depends on ARCH_SUPPORTS_UPROBES
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 0534eb8b7640..25662a780fdf 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -87,6 +87,21 @@ static nokprobe_inline unsigned long 
trace_kprobe_nhit(struct trace_kprobe *tk)
return nhit;
 }
 
+static nokprobe_inline
+unsigned long trace_kprobe_address(struct trace_kprobe *tk)
+{
+   unsigned long addr;
+
+   if (tk->symbol) {
+   addr = (unsigned long)
+   kallsyms_lookup_name(trace_kprobe_symbol(tk));
+   addr += tk->rp.kp.offset;
+   } else {
+   addr = (unsigned long)tk->rp.kp.addr;
+   }
+   return addr;
+}
+
 bool trace_kprobe_on_func_entry(struct trace_event_call *call)
 {
struct trace_kprobe *tk = (struct trace_kprobe *)call->data;
@@ -99,16 +114,8 @@ bool trace_kprobe_on_func_entry(struct trace_event_call 
*call)
 bool trace_kprobe_error_injectable(struct trace_event_call *call)
 {
struct trace_kprobe *tk = (struct trace_kprobe *)call->data;
-   unsigned long addr;
 
-   if (tk->symbol) {
-   addr = (unsigned long)
-   kallsyms_lookup_name(trace_kprobe_symbol(tk));
-   addr += tk->rp.kp.offset;
-   } else {
-   addr = (unsigned long)tk->rp.kp.addr;
-   }
-   return within_error_injection_list(addr);
+   return within_error_injection_list(trace_kprobe_address(tk));
 }
 
 static int register_kprobe_event(struct trace_kprobe *tk);
@@ -504,6 +511,22 @@ disable_trace_kprobe(struct trace_kprobe *tk, struct 
trace_event_file *file)
return ret;
 }
 
+#if defined(CONFIG_KPROBES_ON_FTRACE) && \
+   !defined(CONFIG_KPROBE_EVENTS_ON_NOTRACE)
+static bool within_notrace_func(struct trace_kprobe *tk)
+{
+   unsigned long offset, size, addr;
+
+   addr = trace_kprobe_address(tk);
+   if (!kallsyms_lookup_size_offset(addr, , ))
+   return true;/* Out of range. */
+
+   return !ftrace_location_range(addr - offset, addr - offset + size);
+}
+#else
+#define within_notrace_func(tk)(false)
+#endif
+
 /* Internal register function - just handle k*probes and flags */
 static int __register_trace_kprobe(struct trace_kprobe *tk)
 {
@@ -512,6 +535,12 @@ static int __register_trace_kprobe(struct trace_kprobe *tk)
if (trace_probe_is_registered(>tp))
return -EINVAL;
 
+   if (within_notrace_func(tk)) {
+   pr_warn("Could not probe notrace function %s\n",
+   trace_kprobe_symbol(tk));
+   return -EINVAL;
+   }
+
for (i = 0; i < tk->tp.nr_args; i++)
traceprobe_update_arg(>tp.args[i]);
 
-- 
2.18.0




[for-next][PATCH 14/34] lockdep: Use this_cpu_ptr instead of get_cpu_var stats

2018-08-11 Thread Steven Rostedt
From: "Joel Fernandes (Google)" 

get_cpu_var disables preemption which has the potential to call into the
preemption disable trace points causing some complications. There's also
no need to disable preemption in uses of get_lock_stats anyway since
preempt is already disabled. So lets simplify the code.

Link: http://lkml.kernel.org/r/20180730222423.196630-2-j...@joelfernandes.org

Suggested-by: Peter Zijlstra 
Acked-by: Peter Zijlstra 
Signed-off-by: Joel Fernandes (Google) 
Signed-off-by: Steven Rostedt (VMware) 
---
 kernel/locking/lockdep.c | 10 +-
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 5fa4d3138bf1..fbbb79d5cfa0 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -248,12 +248,7 @@ void clear_lock_stats(struct lock_class *class)
 
 static struct lock_class_stats *get_lock_stats(struct lock_class *class)
 {
-   return _cpu_var(cpu_lock_stats)[class - lock_classes];
-}
-
-static void put_lock_stats(struct lock_class_stats *stats)
-{
-   put_cpu_var(cpu_lock_stats);
+   return _cpu_ptr(cpu_lock_stats)[class - lock_classes];
 }
 
 static void lock_release_holdtime(struct held_lock *hlock)
@@ -271,7 +266,6 @@ static void lock_release_holdtime(struct held_lock *hlock)
lock_time_inc(>read_holdtime, holdtime);
else
lock_time_inc(>write_holdtime, holdtime);
-   put_lock_stats(stats);
 }
 #else
 static inline void lock_release_holdtime(struct held_lock *hlock)
@@ -4090,7 +4084,6 @@ __lock_contended(struct lockdep_map *lock, unsigned long 
ip)
stats->contending_point[contending_point]++;
if (lock->cpu != smp_processor_id())
stats->bounces[bounce_contended + !!hlock->read]++;
-   put_lock_stats(stats);
 }
 
 static void
@@ -4138,7 +4131,6 @@ __lock_acquired(struct lockdep_map *lock, unsigned long 
ip)
}
if (lock->cpu != cpu)
stats->bounces[bounce_acquired + !!hlock->read]++;
-   put_lock_stats(stats);
 
lock->cpu = cpu;
lock->ip = ip;
-- 
2.18.0




[for-next][PATCH 18/34] tracing: Do not call start/stop() functions when tracing_on does not change

2018-08-11 Thread Steven Rostedt
From: "Steven Rostedt (VMware)" 

Currently, when one echo's in 1 into tracing_on, the current tracer's
"start()" function is executed, even if tracing_on was already one. This can
lead to strange side effects. One being that if the hwlat tracer is enabled,
and someone does "echo 1 > tracing_on" into tracing_on, the hwlat tracer's
start() function is called again which will recreate another kernel thread,
and make it unable to remove the old one.

Link: 
http://lkml.kernel.org/r/1533120354-22923-1-git-send-email-erica.bug...@linutronix.de

Cc: sta...@vger.kernel.org
Fixes: 2df8f8a6a897e ("tracing: Fix regression with irqsoff tracer and 
tracing_on file")
Reported-by: Erica Bugden 
Signed-off-by: Steven Rostedt (VMware) 
---
 kernel/trace/trace.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 823687997b01..2378bb4f1442 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -7628,7 +7628,9 @@ rb_simple_write(struct file *filp, const char __user 
*ubuf,
 
if (buffer) {
mutex_lock(_types_lock);
-   if (val) {
+   if (!!val == tracer_tracing_is_on(tr)) {
+   val = 0; /* do nothing */
+   } else if (val) {
tracer_tracing_on(tr);
if (tr->current_trace->start)
tr->current_trace->start(tr);
-- 
2.18.0




[for-next][PATCH 22/34] ring-buffer: Make ring_buffer_record_is_on() return bool

2018-08-11 Thread Steven Rostedt
From: "Steven Rostedt (VMware)" 

The value of ring_buffer_record_is_on() is either true or false, so have its
return value be bool.

Signed-off-by: Steven Rostedt (VMware) 
---
 include/linux/ring_buffer.h | 2 +-
 kernel/trace/ring_buffer.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/ring_buffer.h b/include/linux/ring_buffer.h
index 003d09ab308d..5176124fc4ba 100644
--- a/include/linux/ring_buffer.h
+++ b/include/linux/ring_buffer.h
@@ -164,7 +164,7 @@ void ring_buffer_record_disable(struct ring_buffer *buffer);
 void ring_buffer_record_enable(struct ring_buffer *buffer);
 void ring_buffer_record_off(struct ring_buffer *buffer);
 void ring_buffer_record_on(struct ring_buffer *buffer);
-int ring_buffer_record_is_on(struct ring_buffer *buffer);
+bool ring_buffer_record_is_on(struct ring_buffer *buffer);
 int ring_buffer_record_is_set_on(struct ring_buffer *buffer);
 void ring_buffer_record_disable_cpu(struct ring_buffer *buffer, int cpu);
 void ring_buffer_record_enable_cpu(struct ring_buffer *buffer, int cpu);
diff --git a/kernel/trace/ring_buffer.c b/kernel/trace/ring_buffer.c
index 0b0b688ea166..ffb43cbc5c13 100644
--- a/kernel/trace/ring_buffer.c
+++ b/kernel/trace/ring_buffer.c
@@ -3221,7 +3221,7 @@ EXPORT_SYMBOL_GPL(ring_buffer_record_on);
  *
  * Returns true if the ring buffer is in a state that it accepts writes.
  */
-int ring_buffer_record_is_on(struct ring_buffer *buffer)
+bool ring_buffer_record_is_on(struct ring_buffer *buffer)
 {
return !atomic_read(>record_disabled);
 }
-- 
2.18.0




[for-next][PATCH 12/34] selftest/ftrace: Move kprobe selftest function to separate compile unit

2018-08-11 Thread Steven Rostedt
From: Francis Deslauriers 

Move selftest function to its own compile unit so it can be compiled
with the ftrace cflags (CC_FLAGS_FTRACE) allowing it to be probed
during the ftrace startup tests.

Link: 
http://lkml.kernel.org/r/153294604271.32740.16490677128630177030.stgit@devbox

Signed-off-by: Francis Deslauriers 
Signed-off-by: Masami Hiramatsu 
Signed-off-by: Steven Rostedt (VMware) 
---
 kernel/trace/Makefile|  5 +
 kernel/trace/trace_kprobe.c  | 12 +---
 kernel/trace/trace_kprobe_selftest.c | 10 ++
 kernel/trace/trace_kprobe_selftest.h |  7 +++
 4 files changed, 23 insertions(+), 11 deletions(-)
 create mode 100644 kernel/trace/trace_kprobe_selftest.c
 create mode 100644 kernel/trace/trace_kprobe_selftest.h

diff --git a/kernel/trace/Makefile b/kernel/trace/Makefile
index 31c6b524c260..81902a79e049 100644
--- a/kernel/trace/Makefile
+++ b/kernel/trace/Makefile
@@ -13,6 +13,11 @@ obj-y += trace_selftest_dynamic.o
 endif
 endif
 
+ifdef CONFIG_FTRACE_STARTUP_TEST
+CFLAGS_trace_kprobe_selftest.o = $(CC_FLAGS_FTRACE)
+obj-$(CONFIG_KPROBE_EVENTS) += trace_kprobe_selftest.o
+endif
+
 # If unlikely tracing is enabled, do not trace these files
 ifdef CONFIG_TRACING_BRANCHES
 KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFILING
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 25662a780fdf..deeb03ae21e1 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -23,6 +23,7 @@
 #include 
 #include 
 
+#include "trace_kprobe_selftest.h"
 #include "trace_probe.h"
 
 #define KPROBE_EVENT_SYSTEM "kprobes"
@@ -1587,17 +1588,6 @@ fs_initcall(init_kprobe_trace);
 
 
 #ifdef CONFIG_FTRACE_STARTUP_TEST
-/*
- * The "__used" keeps gcc from removing the function symbol
- * from the kallsyms table. 'noinline' makes sure that there
- * isn't an inlined version used by the test method below
- */
-static __used __init noinline int
-kprobe_trace_selftest_target(int a1, int a2, int a3, int a4, int a5, int a6)
-{
-   return a1 + a2 + a3 + a4 + a5 + a6;
-}
-
 static __init struct trace_event_file *
 find_trace_probe_file(struct trace_kprobe *tk, struct trace_array *tr)
 {
diff --git a/kernel/trace/trace_kprobe_selftest.c 
b/kernel/trace/trace_kprobe_selftest.c
new file mode 100644
index ..16548ee4c8c6
--- /dev/null
+++ b/kernel/trace/trace_kprobe_selftest.c
@@ -0,0 +1,10 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Function used during the kprobe self test. This function is in a separate
+ * compile unit so it can be compile with CC_FLAGS_FTRACE to ensure that it
+ * can be probed by the selftests.
+ */
+int kprobe_trace_selftest_target(int a1, int a2, int a3, int a4, int a5, int 
a6)
+{
+   return a1 + a2 + a3 + a4 + a5 + a6;
+}
diff --git a/kernel/trace/trace_kprobe_selftest.h 
b/kernel/trace/trace_kprobe_selftest.h
new file mode 100644
index ..4e10ec41c013
--- /dev/null
+++ b/kernel/trace/trace_kprobe_selftest.h
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Function used during the kprobe self test. This function is in a separate
+ * compile unit so it can be compile with CC_FLAGS_FTRACE to ensure that it
+ * can be probed by the selftests.
+ */
+int kprobe_trace_selftest_target(int a1, int a2, int a3, int a4, int a5, int 
a6);
-- 
2.18.0




[for-next][PATCH 11/34] tracing: kprobes: Prohibit probing on notrace function

2018-08-11 Thread Steven Rostedt
From: Masami Hiramatsu 

Prohibit kprobe-events probing on notrace functions.  Since probing on a
notrace function can cause a recursive event call. In most cases those are just
skipped, but in some cases it falls into an infinite recursive call.

This protection can be disabled by the kconfig
CONFIG_KPROBE_EVENTS_ON_NOTRACE=y, but it is highly recommended to keep it
"n" for normal kernel builds.  Note that this is only available if "kprobes on
ftrace" has been implemented on the target arch and CONFIG_KPROBES_ON_FTRACE=y.

Link: 
http://lkml.kernel.org/r/153294601436.32740.10557881188933661239.stgit@devbox

Signed-off-by: Masami Hiramatsu 
Tested-by: Francis Deslauriers 
[ Slight grammar and spelling fixes ]
Signed-off-by: Steven Rostedt (VMware) 
---
 kernel/trace/Kconfig| 20 
 kernel/trace/trace_kprobe.c | 47 ++---
 2 files changed, 58 insertions(+), 9 deletions(-)

diff --git a/kernel/trace/Kconfig b/kernel/trace/Kconfig
index e15fadbe5dfb..4d4eb15cc7fd 100644
--- a/kernel/trace/Kconfig
+++ b/kernel/trace/Kconfig
@@ -456,6 +456,26 @@ config KPROBE_EVENTS
  This option is also required by perf-probe subcommand of perf tools.
  If you want to use perf tools, this option is strongly recommended.
 
+config KPROBE_EVENTS_ON_NOTRACE
+   bool "Do NOT protect notrace function from kprobe events"
+   depends on KPROBE_EVENTS
+   depends on KPROBES_ON_FTRACE
+   default n
+   help
+ This is only for the developers who want to debug ftrace itself
+ using kprobe events.
+
+ If kprobes can use ftrace instead of breakpoint, ftrace related
+ functions are protected from kprobe-events to prevent an infinit
+ recursion or any unexpected execution path which leads to a kernel
+ crash.
+
+ This option disables such protection and allows you to put kprobe
+ events on ftrace functions for debugging ftrace by itself.
+ Note that this might let you shoot yourself in the foot.
+
+ If unsure, say N.
+
 config UPROBE_EVENTS
bool "Enable uprobes-based dynamic events"
depends on ARCH_SUPPORTS_UPROBES
diff --git a/kernel/trace/trace_kprobe.c b/kernel/trace/trace_kprobe.c
index 0534eb8b7640..25662a780fdf 100644
--- a/kernel/trace/trace_kprobe.c
+++ b/kernel/trace/trace_kprobe.c
@@ -87,6 +87,21 @@ static nokprobe_inline unsigned long 
trace_kprobe_nhit(struct trace_kprobe *tk)
return nhit;
 }
 
+static nokprobe_inline
+unsigned long trace_kprobe_address(struct trace_kprobe *tk)
+{
+   unsigned long addr;
+
+   if (tk->symbol) {
+   addr = (unsigned long)
+   kallsyms_lookup_name(trace_kprobe_symbol(tk));
+   addr += tk->rp.kp.offset;
+   } else {
+   addr = (unsigned long)tk->rp.kp.addr;
+   }
+   return addr;
+}
+
 bool trace_kprobe_on_func_entry(struct trace_event_call *call)
 {
struct trace_kprobe *tk = (struct trace_kprobe *)call->data;
@@ -99,16 +114,8 @@ bool trace_kprobe_on_func_entry(struct trace_event_call 
*call)
 bool trace_kprobe_error_injectable(struct trace_event_call *call)
 {
struct trace_kprobe *tk = (struct trace_kprobe *)call->data;
-   unsigned long addr;
 
-   if (tk->symbol) {
-   addr = (unsigned long)
-   kallsyms_lookup_name(trace_kprobe_symbol(tk));
-   addr += tk->rp.kp.offset;
-   } else {
-   addr = (unsigned long)tk->rp.kp.addr;
-   }
-   return within_error_injection_list(addr);
+   return within_error_injection_list(trace_kprobe_address(tk));
 }
 
 static int register_kprobe_event(struct trace_kprobe *tk);
@@ -504,6 +511,22 @@ disable_trace_kprobe(struct trace_kprobe *tk, struct 
trace_event_file *file)
return ret;
 }
 
+#if defined(CONFIG_KPROBES_ON_FTRACE) && \
+   !defined(CONFIG_KPROBE_EVENTS_ON_NOTRACE)
+static bool within_notrace_func(struct trace_kprobe *tk)
+{
+   unsigned long offset, size, addr;
+
+   addr = trace_kprobe_address(tk);
+   if (!kallsyms_lookup_size_offset(addr, , ))
+   return true;/* Out of range. */
+
+   return !ftrace_location_range(addr - offset, addr - offset + size);
+}
+#else
+#define within_notrace_func(tk)(false)
+#endif
+
 /* Internal register function - just handle k*probes and flags */
 static int __register_trace_kprobe(struct trace_kprobe *tk)
 {
@@ -512,6 +535,12 @@ static int __register_trace_kprobe(struct trace_kprobe *tk)
if (trace_probe_is_registered(>tp))
return -EINVAL;
 
+   if (within_notrace_func(tk)) {
+   pr_warn("Could not probe notrace function %s\n",
+   trace_kprobe_symbol(tk));
+   return -EINVAL;
+   }
+
for (i = 0; i < tk->tp.nr_args; i++)
traceprobe_update_arg(>tp.args[i]);
 
-- 
2.18.0




  1   2   3   >