Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add time.h in uapi/sound to prevent build error #9

Open
wants to merge 1 commit into
base: lineage-15.1
Choose a base branch
from
Open

Add time.h in uapi/sound to prevent build error #9

wants to merge 1 commit into from

Conversation

amitwh
Copy link

@amitwh amitwh commented Feb 25, 2019

Lineage 15.1 throws error during building sound libraries.

Inserting
#include <linux/time.h>
in

include/uapi/sound/asound.h

resolves the issue

@DD3Boh
Copy link
Owner

DD3Boh commented Feb 25, 2019

Can't merge this right now. It is apparently needed on 8.1 ROMs but anyway if I add this I'll pick it from here: ArrowOS-Devices@2179161

Thanks for the pull request anyway

DD3Boh pushed a commit that referenced this pull request Mar 19, 2019
As Jiqun Li reported in bugzilla:

https://bugzilla.kernel.org/show_bug.cgi?id=202883

sometimes, dead lock when make system call SYS_getdents64 with fsync() is
called by another process.

monkey running on android9.0

1.  task 9785 held sbi->cp_rwsem and waiting lock_page()
2.  task 10349 held mm_sem and waiting sbi->cp_rwsem
3. task 9709 held lock_page() and waiting mm_sem

so this is a dead lock scenario.

task stack is show by crash tools as following

crash_arm64> bt ffffffc03c354080
PID: 9785   TASK: ffffffc03c354080  CPU: 1   COMMAND: "RxIoScheduler-3"
>> #7 [ffffffc01b50fac0] __lock_page at ffffff80081b11e8

crash-arm64> bt 10349
PID: 10349  TASK: ffffffc018b83080  CPU: 1   COMMAND: "BUGLY_ASYNC_UPL"
>> #3 [ffffffc01f8cfa40] rwsem_down_read_failed at ffffff8008a93afc
     PC: 00000033  LR: 00000000  SP: 00000000  PSTATE: ffffffffffffffff

crash-arm64> bt 9709
PID: 9709   TASK: ffffffc03e7f3080  CPU: 1   COMMAND: "IntentService[A"
>> #3 [ffffffc001e67850] rwsem_down_read_failed at ffffff8008a93afc
>> #8 [ffffffc001e67b80] el1_ia at ffffff8008084fc4
     PC: ffffff8008274114  [compat_filldir64+120]
     LR: ffffff80083584d4  [f2fs_fill_dentries+448]
     SP: ffffffc001e67b80  PSTATE: 80400145
    X29: ffffffc001e67b80  X28: 0000000000000000  X27: 000000000000001a
    X26: 00000000000093d7  X25: ffffffc070d52480  X24: 0000000000000008
    X23: 0000000000000028  X22: 00000000d43dfd60  X21: ffffffc001e67e90
    X20: 0000000000000011  X19: ffffff80093a4000  X18: 0000000000000000
    X17: 0000000000000000  X16: 0000000000000000  X15: 0000000000000000
    X14: ffffffffffffffff  X13: 0000000000000008  X12: 0101010101010101
    X11: 7f7f7f7f7f7f7f7f  X10: 6a6a6a6a6a6a6a6a   X9: 7f7f7f7f7f7f7f7f
     X8: 0000000080808000   X7: ffffff800827409c   X6: 0000000080808000
     X5: 0000000000000008   X4: 00000000000093d7   X3: 000000000000001a
     X2: 0000000000000011   X1: ffffffc070d52480   X0: 0000000000800238
>> #9 [ffffffc001e67be0] f2fs_fill_dentries at ffffff80083584d0
     PC: 0000003c  LR: 00000000  SP: 00000000  PSTATE: 000000d9
    X12: f48a02ff X11: d4678960 X10: d43dfc00  X9: d4678ae4
     X8: 00000058  X7: d4678994  X6: d43de800  X5: 000000d9
     X4: d43dfc0c  X3: d43dfc10  X2: d46799c8  X1: 00000000
     X0: 00001068

Below potential deadlock will happen between three threads:
Thread A		Thread B		Thread C
- f2fs_do_sync_file
 - f2fs_write_checkpoint
  - down_write(&sbi->node_change) -- 1)
			- do_page_fault
			 - down_write(&mm->mmap_sem) -- 2)
			  - do_wp_page
			   - f2fs_vm_page_mkwrite
						- getdents64
						 - f2fs_read_inline_dir
						  - lock_page -- 3)
  - f2fs_sync_node_pages
   - lock_page -- 3)
			    - __do_map_lock
			     - down_read(&sbi->node_change) -- 1)
						  - f2fs_fill_dentries
						   - dir_emit
						    - compat_filldir64
						     - do_page_fault
						      - down_read(&mm->mmap_sem) -- 2)

Since f2fs_readdir is protected by inode.i_rwsem, there should not be
any updates in inode page, we're safe to lookup dents in inode page
without its lock held, so taking off the lock to improve concurrency
of readdir and avoid potential deadlock.

Reported-by: Jiqun Li <[email protected]>
Signed-off-by: Chao Yu <[email protected]>
Signed-off-by: Jaegeuk Kim <[email protected]>
amitwh pushed a commit to amitwh/android_kernel_zuk_msm8996 that referenced this pull request Jun 6, 2019
[ Upstream commit 42dfa451d825a2ad15793c476f73e7bbc0f9d312 ]

Using gcc's ASan, Changbin reports:

  =================================================================
  ==7494==ERROR: LeakSanitizer: detected memory leaks

  Direct leak of 48 byte(s) in 1 object(s) allocated from:
      #0 0x7f0333a89138 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xee138)
      DD3Boh#1 0x5625e5330a5e in zalloc util/util.h:23
      DD3Boh#2 0x5625e5330a9b in perf_counts__new util/counts.c:10
      DD3Boh#3 0x5625e5330ca0 in perf_evsel__alloc_counts util/counts.c:47
      DD3Boh#4 0x5625e520d8e5 in __perf_evsel__read_on_cpu util/evsel.c:1505
      DD3Boh#5 0x5625e517a985 in perf_evsel__read_on_cpu /home/work/linux/tools/perf/util/evsel.h:347
      DD3Boh#6 0x5625e517ad1a in test__openat_syscall_event tests/openat-syscall.c:47
      DD3Boh#7 0x5625e51528e6 in run_test tests/builtin-test.c:358
      DD3Boh#8 0x5625e5152baf in test_and_print tests/builtin-test.c:388
      DD3Boh#9 0x5625e51543fe in __cmd_test tests/builtin-test.c:583
      DD3Boh#10 0x5625e515572f in cmd_test tests/builtin-test.c:722
      DD3Boh#11 0x5625e51c3fb8 in run_builtin /home/changbin/work/linux/tools/perf/perf.c:302
      DD3Boh#12 0x5625e51c44f7 in handle_internal_command /home/changbin/work/linux/tools/perf/perf.c:354
      DD3Boh#13 0x5625e51c48fb in run_argv /home/changbin/work/linux/tools/perf/perf.c:398
      DD3Boh#14 0x5625e51c5069 in main /home/changbin/work/linux/tools/perf/perf.c:520
      #15 0x7f033214d09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)

  Indirect leak of 72 byte(s) in 1 object(s) allocated from:
      #0 0x7f0333a89138 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xee138)
      DD3Boh#1 0x5625e532560d in zalloc util/util.h:23
      DD3Boh#2 0x5625e532566b in xyarray__new util/xyarray.c:10
      DD3Boh#3 0x5625e5330aba in perf_counts__new util/counts.c:15
      DD3Boh#4 0x5625e5330ca0 in perf_evsel__alloc_counts util/counts.c:47
      DD3Boh#5 0x5625e520d8e5 in __perf_evsel__read_on_cpu util/evsel.c:1505
      DD3Boh#6 0x5625e517a985 in perf_evsel__read_on_cpu /home/work/linux/tools/perf/util/evsel.h:347
      DD3Boh#7 0x5625e517ad1a in test__openat_syscall_event tests/openat-syscall.c:47
      DD3Boh#8 0x5625e51528e6 in run_test tests/builtin-test.c:358
      DD3Boh#9 0x5625e5152baf in test_and_print tests/builtin-test.c:388
      DD3Boh#10 0x5625e51543fe in __cmd_test tests/builtin-test.c:583
      DD3Boh#11 0x5625e515572f in cmd_test tests/builtin-test.c:722
      DD3Boh#12 0x5625e51c3fb8 in run_builtin /home/changbin/work/linux/tools/perf/perf.c:302
      DD3Boh#13 0x5625e51c44f7 in handle_internal_command /home/changbin/work/linux/tools/perf/perf.c:354
      DD3Boh#14 0x5625e51c48fb in run_argv /home/changbin/work/linux/tools/perf/perf.c:398
      #15 0x5625e51c5069 in main /home/changbin/work/linux/tools/perf/perf.c:520
      #16 0x7f033214d09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)

His patch took care of evsel->prev_raw_counts, but the above backtraces
are about evsel->counts, so fix that instead.

Reported-by: Changbin Du <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: Jiri Olsa <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Steven Rostedt (VMware) <[email protected]>
Link: https://lkml.kernel.org/n/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
amitwh pushed a commit to amitwh/android_kernel_zuk_msm8996 that referenced this pull request Jun 6, 2019
…_event_on_all_cpus test

[ Upstream commit 93faa52e8371f0291ee1ff4994edae2b336b6233 ]

  =================================================================
  ==7497==ERROR: LeakSanitizer: detected memory leaks

  Direct leak of 40 byte(s) in 1 object(s) allocated from:
      #0 0x7f0333a88f30 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xedf30)
      DD3Boh#1 0x5625e5326213 in cpu_map__trim_new util/cpumap.c:45
      DD3Boh#2 0x5625e5326703 in cpu_map__read util/cpumap.c:103
      DD3Boh#3 0x5625e53267ef in cpu_map__read_all_cpu_map util/cpumap.c:120
      DD3Boh#4 0x5625e5326915 in cpu_map__new util/cpumap.c:135
      DD3Boh#5 0x5625e517b355 in test__openat_syscall_event_on_all_cpus tests/openat-syscall-all-cpus.c:36
      DD3Boh#6 0x5625e51528e6 in run_test tests/builtin-test.c:358
      DD3Boh#7 0x5625e5152baf in test_and_print tests/builtin-test.c:388
      DD3Boh#8 0x5625e51543fe in __cmd_test tests/builtin-test.c:583
      DD3Boh#9 0x5625e515572f in cmd_test tests/builtin-test.c:722
      DD3Boh#10 0x5625e51c3fb8 in run_builtin /home/changbin/work/linux/tools/perf/perf.c:302
      DD3Boh#11 0x5625e51c44f7 in handle_internal_command /home/changbin/work/linux/tools/perf/perf.c:354
      DD3Boh#12 0x5625e51c48fb in run_argv /home/changbin/work/linux/tools/perf/perf.c:398
      DD3Boh#13 0x5625e51c5069 in main /home/changbin/work/linux/tools/perf/perf.c:520
      DD3Boh#14 0x7f033214d09a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)

Signed-off-by: Changbin Du <[email protected]>
Reviewed-by: Jiri Olsa <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Steven Rostedt (VMware) <[email protected]>
Fixes: f30a79b ("perf tools: Add reference counting for cpu_map object")
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
amitwh pushed a commit to amitwh/android_kernel_zuk_msm8996 that referenced this pull request Jun 6, 2019
[ Upstream commit d982b33133284fa7efa0e52ae06b88f9be3ea764 ]

  =================================================================
  ==20875==ERROR: LeakSanitizer: detected memory leaks

  Direct leak of 1160 byte(s) in 1 object(s) allocated from:
      #0 0x7f1b6fc84138 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xee138)
      DD3Boh#1 0x55bd50005599 in zalloc util/util.h:23
      DD3Boh#2 0x55bd500068f5 in perf_evsel__newtp_idx util/evsel.c:327
      DD3Boh#3 0x55bd4ff810fc in perf_evsel__newtp /home/work/linux/tools/perf/util/evsel.h:216
      DD3Boh#4 0x55bd4ff81608 in test__perf_evsel__tp_sched_test tests/evsel-tp-sched.c:69
      DD3Boh#5 0x55bd4ff528e6 in run_test tests/builtin-test.c:358
      DD3Boh#6 0x55bd4ff52baf in test_and_print tests/builtin-test.c:388
      DD3Boh#7 0x55bd4ff543fe in __cmd_test tests/builtin-test.c:583
      DD3Boh#8 0x55bd4ff5572f in cmd_test tests/builtin-test.c:722
      DD3Boh#9 0x55bd4ffc4087 in run_builtin /home/changbin/work/linux/tools/perf/perf.c:302
      DD3Boh#10 0x55bd4ffc45c6 in handle_internal_command /home/changbin/work/linux/tools/perf/perf.c:354
      DD3Boh#11 0x55bd4ffc49ca in run_argv /home/changbin/work/linux/tools/perf/perf.c:398
      DD3Boh#12 0x55bd4ffc5138 in main /home/changbin/work/linux/tools/perf/perf.c:520
      DD3Boh#13 0x7f1b6e34809a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)

  Indirect leak of 19 byte(s) in 1 object(s) allocated from:
      #0 0x7f1b6fc83f30 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xedf30)
      DD3Boh#1 0x7f1b6e3ac30f in vasprintf (/lib/x86_64-linux-gnu/libc.so.6+0x8830f)

Signed-off-by: Changbin Du <[email protected]>
Reviewed-by: Jiri Olsa <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Steven Rostedt (VMware) <[email protected]>
Fixes: 6a6cd11 ("perf test: Add test for the sched tracepoint format fields")
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
amitwh pushed a commit to amitwh/android_kernel_zuk_msm8996 that referenced this pull request Dec 18, 2019
[ Upstream commit d982b33133284fa7efa0e52ae06b88f9be3ea764 ]

  =================================================================
  ==20875==ERROR: LeakSanitizer: detected memory leaks

  Direct leak of 1160 byte(s) in 1 object(s) allocated from:
      #0 0x7f1b6fc84138 in calloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xee138)
      DD3Boh#1 0x55bd50005599 in zalloc util/util.h:23
      DD3Boh#2 0x55bd500068f5 in perf_evsel__newtp_idx util/evsel.c:327
      DD3Boh#3 0x55bd4ff810fc in perf_evsel__newtp /home/work/linux/tools/perf/util/evsel.h:216
      DD3Boh#4 0x55bd4ff81608 in test__perf_evsel__tp_sched_test tests/evsel-tp-sched.c:69
      DD3Boh#5 0x55bd4ff528e6 in run_test tests/builtin-test.c:358
      DD3Boh#6 0x55bd4ff52baf in test_and_print tests/builtin-test.c:388
      DD3Boh#7 0x55bd4ff543fe in __cmd_test tests/builtin-test.c:583
      DD3Boh#8 0x55bd4ff5572f in cmd_test tests/builtin-test.c:722
      DD3Boh#9 0x55bd4ffc4087 in run_builtin /home/changbin/work/linux/tools/perf/perf.c:302
      DD3Boh#10 0x55bd4ffc45c6 in handle_internal_command /home/changbin/work/linux/tools/perf/perf.c:354
      DD3Boh#11 0x55bd4ffc49ca in run_argv /home/changbin/work/linux/tools/perf/perf.c:398
      DD3Boh#12 0x55bd4ffc5138 in main /home/changbin/work/linux/tools/perf/perf.c:520
      DD3Boh#13 0x7f1b6e34809a in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2409a)

  Indirect leak of 19 byte(s) in 1 object(s) allocated from:
      #0 0x7f1b6fc83f30 in __interceptor_malloc (/usr/lib/x86_64-linux-gnu/libasan.so.5+0xedf30)
      DD3Boh#1 0x7f1b6e3ac30f in vasprintf (/lib/x86_64-linux-gnu/libc.so.6+0x8830f)

Signed-off-by: Changbin Du <[email protected]>
Reviewed-by: Jiri Olsa <[email protected]>
Cc: Alexei Starovoitov <[email protected]>
Cc: Daniel Borkmann <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Steven Rostedt (VMware) <[email protected]>
Fixes: 6a6cd11 ("perf test: Add test for the sched tracepoint format fields")
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants