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

fail to build ZUFS on ubuntu 19.10, please help #3

Open
gwnet opened this issue Apr 18, 2020 · 1 comment
Open

fail to build ZUFS on ubuntu 19.10, please help #3

gwnet opened this issue Apr 18, 2020 · 1 comment

Comments

@gwnet
Copy link

gwnet commented Apr 18, 2020

could you please check why I cannot make the driver on 19.10. the module.mk is missing.

===below is detail error.
wayne@ubuntu:/zufs-zuf/fs/zuf$ sudo make -f fs/zuf/module.mk KDIR=linux-headers-5.3.0-46
make: fs/zuf/module.mk: No such file or directory
make: *** No rule to make target 'fs/zuf/module.mk'. Stop.
wayne@ubuntu:
/zufs-zuf/fs/zuf$ ls -l fs/zuf
ls: cannot access 'fs/zuf': No such file or directory
wayne@ubuntu:/zufs-zuf/fs/zuf$ ls
acl.c _extern.h inode.c Kconfig md.c md.h module.c Module.symvers _pr.h rw.c symlink.c t2.c xattr.c zuf.h zus_api.h
directory.c file.c ioctl.c Makefile md_def.h mmap.c modules.order namei.c relay.h super.c t1.c t2.h zuf-core.c zuf-root.c
wayne@ubuntu:
/zufs-zuf/fs/zuf$ ls -l
total 340
-rw-r--r-- 1 wayne wayne 5961 Apr 18 01:00 acl.c
-rw-r--r-- 1 wayne wayne 4143 Apr 18 01:00 directory.c
-rw-r--r-- 1 wayne wayne 6886 Apr 18 01:00 _extern.h
-rw-r--r-- 1 wayne wayne 22269 Apr 18 01:00 file.c
-rw-r--r-- 1 wayne wayne 17620 Apr 18 01:00 inode.c
-rw-r--r-- 1 wayne wayne 8309 Apr 18 01:00 ioctl.c
-rw-r--r-- 1 wayne wayne 565 Apr 18 01:00 Kconfig
-rw-r--r-- 1 wayne wayne 462 Apr 18 01:00 Makefile
-rw-r--r-- 1 wayne wayne 17617 Apr 18 01:00 md.c
-rw-r--r-- 1 wayne wayne 3562 Apr 18 01:00 md_def.h
-rw-r--r-- 1 wayne wayne 7151 Apr 18 01:00 md.h
-rw-r--r-- 1 wayne wayne 7920 Apr 18 01:00 mmap.c
-rw-r--r-- 1 wayne wayne 1044 Apr 18 01:00 module.c
-rw-r--r-- 1 root root 0 Apr 18 01:10 modules.order
-rw-r--r-- 1 root root 0 Apr 18 01:05 Module.symvers
-rw-r--r-- 1 wayne wayne 10917 Apr 18 01:00 namei.c
-rw-r--r-- 1 wayne wayne 2331 Apr 18 01:00 _pr.h
-rw-r--r-- 1 wayne wayne 2058 Apr 18 01:00 relay.h
-rw-r--r-- 1 wayne wayne 28358 Apr 18 01:00 rw.c
-rw-r--r-- 1 wayne wayne 22095 Apr 18 01:00 super.c
-rw-r--r-- 1 wayne wayne 1788 Apr 18 01:00 symlink.c
-rw-r--r-- 1 wayne wayne 4283 Apr 18 01:00 t1.c
-rw-r--r-- 1 wayne wayne 8581 Apr 18 01:00 t2.c
-rw-r--r-- 1 wayne wayne 1720 Apr 18 01:00 t2.h
-rw-r--r-- 1 wayne wayne 8021 Apr 18 01:00 xattr.c
-rw-r--r-- 1 wayne wayne 46954 Apr 18 01:00 zuf-core.c
-rw-r--r-- 1 wayne wayne 9809 Apr 18 01:00 zuf.h
-rw-r--r-- 1 wayne wayne 12255 Apr 18 01:00 zuf-root.c
-rw-r--r-- 1 wayne wayne 25626 Apr 18 01:00 zus_api.h
wayne@ubuntu:~/zufs-zuf/fs/zuf$

@gwnet
Copy link
Author

gwnet commented Apr 18, 2020

I tried another way to build module, also failed.
wayne@ubuntu:/zufs-zuf/fs/zuf$ sudo make -C /lib/modules/5.3.0-46-generic/build M=/home/wayne/zufs-zuf/fs/zuf modules
make: Entering directory '/usr/src/linux-headers-5.3.0-46-generic'
Building modules, stage 2.
MODPOST 0 modules
make: Leaving directory '/usr/src/linux-headers-5.3.0-46-generic'
wayne@ubuntu:
/zufs-zuf/fs/zuf$

===detail info===
wayne@ubuntu:~/zufs-zuf/fs/zuf$ sudo make -C /lib/modules/5.3.0-46-generic/build M=/home/wayne/zufs-zuf/fs/zuf modules -d
GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Reading makefile 'Makefile'...
Reading makefile 'scripts/Kbuild.include' (search path) (no ~ expansion)...
Reading makefile 'scripts/subarch.include' (search path) (no ~ expansion)...
make: Entering directory '/usr/src/linux-headers-5.3.0-46-generic'
Reading makefile 'include/config/auto.conf' (search path) (no ~ expansion)...
Reading makefile 'arch/x86/Makefile' (search path) (no ~ expansion)...
Reading makefile 'scripts/Makefile.kcov' (search path) (no ~ expansion)...
Reading makefile 'scripts/Makefile.gcc-plugins' (search path) (no ~ expansion)...
Reading makefile 'scripts/Makefile.kasan' (search path) (no ~ expansion)...
Reading makefile 'scripts/Makefile.extrawarn' (search path) (no ~ expansion)...
Reading makefile 'scripts/Makefile.ubsan' (search path) (no ~ expansion)...
Updating makefiles....
Considering target file 'scripts/Makefile.ubsan'.
Looking for an implicit rule for 'scripts/Makefile.ubsan'.
No implicit rule found for 'scripts/Makefile.ubsan'.
Finished prerequisites of target file 'scripts/Makefile.ubsan'.
No need to remake target 'scripts/Makefile.ubsan'.
Considering target file 'scripts/Makefile.extrawarn'.
Looking for an implicit rule for 'scripts/Makefile.extrawarn'.
No implicit rule found for 'scripts/Makefile.extrawarn'.
Finished prerequisites of target file 'scripts/Makefile.extrawarn'.
No need to remake target 'scripts/Makefile.extrawarn'.
Considering target file 'scripts/Makefile.kasan'.
Looking for an implicit rule for 'scripts/Makefile.kasan'.
No implicit rule found for 'scripts/Makefile.kasan'.
Finished prerequisites of target file 'scripts/Makefile.kasan'.
No need to remake target 'scripts/Makefile.kasan'.
Considering target file 'scripts/Makefile.gcc-plugins'.
Looking for an implicit rule for 'scripts/Makefile.gcc-plugins'.
No implicit rule found for 'scripts/Makefile.gcc-plugins'.
Finished prerequisites of target file 'scripts/Makefile.gcc-plugins'.
No need to remake target 'scripts/Makefile.gcc-plugins'.
Considering target file 'scripts/Makefile.kcov'.
Looking for an implicit rule for 'scripts/Makefile.kcov'.
No implicit rule found for 'scripts/Makefile.kcov'.
Finished prerequisites of target file 'scripts/Makefile.kcov'.
No need to remake target 'scripts/Makefile.kcov'.
Considering target file 'arch/x86/Makefile'.
Looking for an implicit rule for 'arch/x86/Makefile'.
No implicit rule found for 'arch/x86/Makefile'.
Finished prerequisites of target file 'arch/x86/Makefile'.
No need to remake target 'arch/x86/Makefile'.
Considering target file 'include/config/auto.conf'.
File 'include/config/auto.conf' does not exist.
Finished prerequisites of target file 'include/config/auto.conf'.
Must remake target 'include/config/auto.conf'.
Putting child 0x55e1ed264870 (include/config/auto.conf) PID 15487 on the chain.
Live child 0x55e1ed264870 (include/config/auto.conf) PID 15487
Reaping winning child 0x55e1ed264870 PID 15487
Removing child 0x55e1ed264870 PID 15487 from chain.
Successfully remade target file 'include/config/auto.conf'.
Considering target file 'scripts/subarch.include'.
Looking for an implicit rule for 'scripts/subarch.include'.
No implicit rule found for 'scripts/subarch.include'.
Finished prerequisites of target file 'scripts/subarch.include'.
No need to remake target 'scripts/subarch.include'.
Considering target file 'scripts/Kbuild.include'.
Looking for an implicit rule for 'scripts/Kbuild.include'.
No implicit rule found for 'scripts/Kbuild.include'.
Finished prerequisites of target file 'scripts/Kbuild.include'.
No need to remake target 'scripts/Kbuild.include'.
Considering target file 'Makefile'.
Looking for an implicit rule for 'Makefile'.
No implicit rule found for 'Makefile'.
Finished prerequisites of target file 'Makefile'.
No need to remake target 'Makefile'.
Updating goal targets....
Considering target file 'modules'.
File 'modules' does not exist.
Considering target file 'module/home/wayne/zufs-zuf/fs/zuf'.
File 'module/home/wayne/zufs-zuf/fs/zuf' does not exist.
Considering target file 'prepare'.
File 'prepare' does not exist.
Finished prerequisites of target file 'prepare'.
Must remake target 'prepare'.
Successfully remade target file 'prepare'.
Considering target file 'Module.symvers'.
File 'Module.symvers' does not exist.
Finished prerequisites of target file 'Module.symvers'.
Must remake target 'Module.symvers'.
Putting child 0x55e1ed25d4a0 (Module.symvers) PID 15494 on the chain.
Live child 0x55e1ed25d4a0 (Module.symvers) PID 15494
Reaping winning child 0x55e1ed25d4a0 PID 15494
Removing child 0x55e1ed25d4a0 PID 15494 from chain.
Successfully remade target file 'Module.symvers'.
Considering target file 'prepare'.
File 'prepare' was considered already.
Considering target file 'Module.symvers'.
File 'Module.symvers' was considered already.
Finished prerequisites of target file 'module/home/wayne/zufs-zuf/fs/zuf'.
Must remake target 'module/home/wayne/zufs-zuf/fs/zuf'.
Putting child 0x55e1ed2635e0 (module/home/wayne/zufs-zuf/fs/zuf) PID 15501 on the chain.
Live child 0x55e1ed2635e0 (module/home/wayne/zufs-zuf/fs/zuf) PID 15501
GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Reading makefile 'scripts/Makefile.build'...
Reading makefile 'include/config/auto.conf' (search path) (don't care) (no ~ expansion)...
Reading makefile 'scripts/Kbuild.include' (search path) (no ~ expansion)...
Reading makefile '/home/wayne/zufs-zuf/fs/zuf/Makefile' (search path) (no ~ expansion)...
Reading makefile 'scripts/Makefile.lib' (search path) (no ~ expansion)...
Updating makefiles....
Considering target file 'scripts/Makefile.lib'.
Looking for an implicit rule for 'scripts/Makefile.lib'.
No implicit rule found for 'scripts/Makefile.lib'.
Finished prerequisites of target file 'scripts/Makefile.lib'.
No need to remake target 'scripts/Makefile.lib'.
Considering target file '/home/wayne/zufs-zuf/fs/zuf/Makefile'.
Looking for an implicit rule for '/home/wayne/zufs-zuf/fs/zuf/Makefile'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite '/home/wayne/zufs-zuf/fs/zuf/Makefile_shipped'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite '/home/wayne/zufs-zuf/fs/zuf/Makefile_shipped'.
Looking for a rule with intermediate file '/home/wayne/zufs-zuf/fs/zuf/Makefile_shipped'.
Avoiding implicit rule recursion.
No implicit rule found for '/home/wayne/zufs-zuf/fs/zuf/Makefile'.
Finished prerequisites of target file '/home/wayne/zufs-zuf/fs/zuf/Makefile'.
No need to remake target '/home/wayne/zufs-zuf/fs/zuf/Makefile'.
Considering target file 'scripts/Kbuild.include'.
Looking for an implicit rule for 'scripts/Kbuild.include'.
No implicit rule found for 'scripts/Kbuild.include'.
Finished prerequisites of target file 'scripts/Kbuild.include'.
No need to remake target 'scripts/Kbuild.include'.
Considering target file 'include/config/auto.conf'.
Looking for an implicit rule for 'include/config/auto.conf'.
No implicit rule found for 'include/config/auto.conf'.
Finished prerequisites of target file 'include/config/auto.conf'.
No need to remake target 'include/config/auto.conf'.
Considering target file 'scripts/Makefile.build'.
Looking for an implicit rule for 'scripts/Makefile.build'.
No implicit rule found for 'scripts/Makefile.build'.
Finished prerequisites of target file 'scripts/Makefile.build'.
No need to remake target 'scripts/Makefile.build'.
Updating goal targets....
Considering target file '__build'.
File '__build' does not exist.
Considering target file '/home/wayne/zufs-zuf/fs/zuf/modules.order'.
Considering target file 'FORCE'.
File 'FORCE' does not exist.
Finished prerequisites of target file 'FORCE'.
Must remake target 'FORCE'.
Successfully remade target file 'FORCE'.
Considering target file 'FORCE'.
File 'FORCE' was considered already.
Finished prerequisites of target file '/home/wayne/zufs-zuf/fs/zuf/modules.order'.
Prerequisite 'FORCE' of target '/home/wayne/zufs-zuf/fs/zuf/modules.order' does not exist.
Must remake target '/home/wayne/zufs-zuf/fs/zuf/modules.order'.
Putting child 0x55bf0fdcad00 (/home/wayne/zufs-zuf/fs/zuf/modules.order) PID 15502 on the chain.
Live child 0x55bf0fdcad00 (/home/wayne/zufs-zuf/fs/zuf/modules.order) PID 15502
Reaping winning child 0x55bf0fdcad00 PID 15502
Removing child 0x55bf0fdcad00 PID 15502 from chain.
Successfully remade target file '/home/wayne/zufs-zuf/fs/zuf/modules.order'.
Finished prerequisites of target file '__build'.
Must remake target '__build'.
Successfully remade target file '__build'.
Reaping winning child 0x55e1ed2635e0 PID 15501
Removing child 0x55e1ed2635e0 PID 15501 from chain.
Successfully remade target file 'module/home/wayne/zufs-zuf/fs/zuf'.
Considering target file 'module/home/wayne/zufs-zuf/fs/zuf'.
File 'module/home/wayne/zufs-zuf/fs/zuf' was considered already.
Finished prerequisites of target file 'modules'.
Must remake target 'modules'.
Putting child 0x55e1ed2635e0 (modules) PID 15511 on the chain.
Live child 0x55e1ed2635e0 (modules) PID 15511
Building modules, stage 2.
Reaping winning child 0x55e1ed2635e0 PID 15511
Live child 0x55e1ed2635e0 (modules) PID 15512
GNU Make 4.2.1
Built for x86_64-pc-linux-gnu
Copyright (C) 1988-2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Reading makefiles...
Reading makefile 'scripts/Makefile.modpost'...
Reading makefile 'include/config/auto.conf' (search path) (no ~ expansion)...
Reading makefile 'scripts/Kbuild.include' (search path) (no ~ expansion)...
Reading makefile '/home/wayne/zufs-zuf/fs/zuf/Makefile' (search path) (no ~ expansion)...
Reading makefile 'scripts/Makefile.lib' (search path) (no ~ expansion)...
Updating makefiles....
Considering target file 'scripts/Makefile.lib'.
Looking for an implicit rule for 'scripts/Makefile.lib'.
No implicit rule found for 'scripts/Makefile.lib'.
Finished prerequisites of target file 'scripts/Makefile.lib'.
No need to remake target 'scripts/Makefile.lib'.
Considering target file '/home/wayne/zufs-zuf/fs/zuf/Makefile'.
Looking for an implicit rule for '/home/wayne/zufs-zuf/fs/zuf/Makefile'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite '/home/wayne/zufs-zuf/fs/zuf/Makefile_shipped'.
Trying pattern rule with stem 'Makefile'.
Trying implicit prerequisite '/home/wayne/zufs-zuf/fs/zuf/Makefile_shipped'.
Looking for a rule with intermediate file '/home/wayne/zufs-zuf/fs/zuf/Makefile_shipped'.
Avoiding implicit rule recursion.
No implicit rule found for '/home/wayne/zufs-zuf/fs/zuf/Makefile'.
Finished prerequisites of target file '/home/wayne/zufs-zuf/fs/zuf/Makefile'.
No need to remake target '/home/wayne/zufs-zuf/fs/zuf/Makefile'.
Considering target file 'scripts/Kbuild.include'.
Looking for an implicit rule for 'scripts/Kbuild.include'.
No implicit rule found for 'scripts/Kbuild.include'.
Finished prerequisites of target file 'scripts/Kbuild.include'.
No need to remake target 'scripts/Kbuild.include'.
Considering target file 'include/config/auto.conf'.
Looking for an implicit rule for 'include/config/auto.conf'.
No implicit rule found for 'include/config/auto.conf'.
Finished prerequisites of target file 'include/config/auto.conf'.
No need to remake target 'include/config/auto.conf'.
Considering target file 'scripts/Makefile.modpost'.
Looking for an implicit rule for 'scripts/Makefile.modpost'.
No implicit rule found for 'scripts/Makefile.modpost'.
Finished prerequisites of target file 'scripts/Makefile.modpost'.
No need to remake target 'scripts/Makefile.modpost'.
Updating goal targets....
Considering target file '_modpost'.
File '_modpost' does not exist.
Considering target file '__modpost'.
File '__modpost' does not exist.
Finished prerequisites of target file '__modpost'.
Must remake target '__modpost'.
Putting child 0x5580cb2294d0 (__modpost) PID 15514 on the chain.
Live child 0x5580cb2294d0 (__modpost) PID 15514
MODPOST 0 modules
Reaping winning child 0x5580cb2294d0 PID 15514
Removing child 0x5580cb2294d0 PID 15514 from chain.
Successfully remade target file '__modpost'.
Considering target file '__modpost'.
File '__modpost' was considered already.
Finished prerequisites of target file '_modpost'.
Must remake target '_modpost'.
Successfully remade target file '_modpost'.
Reaping winning child 0x55e1ed2635e0 PID 15512
Removing child 0x55e1ed2635e0 PID 15512 from chain.
Successfully remade target file 'modules'.
make: Leaving directory '/usr/src/linux-headers-5.3.0-46-generic'

sagimnl pushed a commit that referenced this issue Jul 16, 2020
When lockdep is enabled, plugging Thunderbolt dock on Dominik's laptop
triggers following splat:

  ======================================================
  WARNING: possible circular locking dependency detected
  5.3.0-rc6+ #1 Tainted: G                T
  ------------------------------------------------------
  pool-/usr/lib/b/1258 is trying to acquire lock:
  000000005ab0ad43 (pci_rescan_remove_lock){+.+.}, at: authorized_store+0xe8/0x210

  but task is already holding lock:
  00000000bfb796b5 (&tb->lock){+.+.}, at: authorized_store+0x7c/0x210

  which lock already depends on the new lock.

  the existing dependency chain (in reverse order) is:

  -> #1 (&tb->lock){+.+.}:
         __mutex_lock+0xac/0x9a0
         tb_domain_add+0x2d/0x130
         nhi_probe+0x1dd/0x330
         pci_device_probe+0xd2/0x150
         really_probe+0xee/0x280
         driver_probe_device+0x50/0xc0
         bus_for_each_drv+0x84/0xd0
         __device_attach+0xe4/0x150
         pci_bus_add_device+0x4e/0x70
         pci_bus_add_devices+0x2e/0x66
         pci_bus_add_devices+0x59/0x66
         pci_bus_add_devices+0x59/0x66
         enable_slot+0x344/0x450
         acpiphp_check_bridge.part.0+0x119/0x150
         acpiphp_hotplug_notify+0xaa/0x140
         acpi_device_hotplug+0xa2/0x3f0
         acpi_hotplug_work_fn+0x1a/0x30
         process_one_work+0x234/0x580
         worker_thread+0x50/0x3b0
         kthread+0x10a/0x140
         ret_from_fork+0x3a/0x50

  -> #0 (pci_rescan_remove_lock){+.+.}:
         __lock_acquire+0xe54/0x1ac0
         lock_acquire+0xb8/0x1b0
         __mutex_lock+0xac/0x9a0
         authorized_store+0xe8/0x210
         kernfs_fop_write+0x125/0x1b0
         vfs_write+0xc2/0x1d0
         ksys_write+0x6c/0xf0
         do_syscall_64+0x50/0x180
         entry_SYSCALL_64_after_hwframe+0x49/0xbe

  other info that might help us debug this:
   Possible unsafe locking scenario:
         CPU0                    CPU1
         ----                    ----
    lock(&tb->lock);
                                 lock(pci_rescan_remove_lock);
                                 lock(&tb->lock);
    lock(pci_rescan_remove_lock);

   *** DEADLOCK ***
  5 locks held by pool-/usr/lib/b/1258:
   #0: 000000003df1a1ad (&f->f_pos_lock){+.+.}, at: __fdget_pos+0x4d/0x60
   #1: 0000000095a40b02 (sb_writers#6){.+.+}, at: vfs_write+0x185/0x1d0
   #2: 0000000017a7d714 (&of->mutex){+.+.}, at: kernfs_fop_write+0xf2/0x1b0
   #3: 000000004f262981 (kn->count#208){.+.+}, at: kernfs_fop_write+0xfa/0x1b0
   #4: 00000000bfb796b5 (&tb->lock){+.+.}, at: authorized_store+0x7c/0x210

  stack backtrace:
  CPU: 0 PID: 1258 Comm: pool-/usr/lib/b Tainted: G                T 5.3.0-rc6+ #1

On an system using ACPI hotplug the host router gets hotplugged first and then
the firmware starts sending notifications about connected devices so the above
scenario should not happen in reality. However, after taking a second
look at commit a03e828 ("thunderbolt: Serialize PCIe tunnel
creation with PCI rescan") that introduced the locking, I don't think it
is actually correct. It may have cured the symptom but probably the real
root cause was somewhere closer to PCI stack and possibly is already
fixed with recent kernels. I also tried to reproduce the original issue
with the commit reverted but could not.

So to keep lockdep happy and the code bit less complex drop calls to
pci_lock_rescan_remove()/pci_unlock_rescan_remove() in
tb_switch_set_authorized() effectively reverting a03e828.

Link: https://lkml.org/lkml/2019/8/30/513
Fixes: a03e828 ("thunderbolt: Serialize PCIe tunnel creation with PCI rescan")
Reported-by: Dominik Brodowski <[email protected]>
Signed-off-by: Mika Westerberg <[email protected]>
sagimnl pushed a commit that referenced this issue Jul 16, 2020
8-letter strings representing ARC perf events are stores in two
32-bit registers as ASCII characters like that: "IJMP", "IALL", "IJMPTAK" etc.

And the same order of bytes in the word is used regardless CPU endianness.

Which means in case of big-endian CPU core we need to swap bytes to get
the same order as if it was on little-endian CPU.

Otherwise we're seeing the following error message on boot:
------------------------->8----------------------
ARC perf        : 8 counters (32 bits), 40 conditions, [overflow IRQ support]
sysfs: cannot create duplicate filename '/devices/arc_pct/events/pmji'
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.2.18 #3
Stack Trace:
  arc_unwind_core+0xd4/0xfc
  dump_stack+0x64/0x80
  sysfs_warn_dup+0x46/0x58
  sysfs_add_file_mode_ns+0xb2/0x168
  create_files+0x70/0x2a0
------------[ cut here ]------------
WARNING: CPU: 0 PID: 1 at kernel/events/core.c:12144 perf_event_sysfs_init+0x70/0xa0
Failed to register pmu: arc_pct, reason -17
Modules linked in:
CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.2.18 #3
Stack Trace:
  arc_unwind_core+0xd4/0xfc
  dump_stack+0x64/0x80
  __warn+0x9c/0xd4
  warn_slowpath_fmt+0x22/0x2c
  perf_event_sysfs_init+0x70/0xa0
---[ end trace a75fb9a9837bd1ec ]---
------------------------->8----------------------

What happens here we're trying to register more than one raw perf event
with the same name "PMJI". Why? Because ARC perf events are 4 to 8 letters
and encoded into two 32-bit words. In this particular case we deal with 2
events:
 * "IJMP____" which counts all jump & branch instructions
 * "IJMPC___" which counts only conditional jumps & branches

Those strings are split in two 32-bit words this way "IJMP" + "____" &
"IJMP" + "C___" correspondingly. Now if we read them swapped due to CPU core
being big-endian then we read "PMJI" + "____" & "PMJI" + "___C".

And since we interpret read array of ASCII letters as a null-terminated string
on big-endian CPU we end up with 2 events of the same name "PMJI".

Signed-off-by: Alexey Brodkin <[email protected]>
Cc: [email protected]
Signed-off-by: Vineet Gupta <[email protected]>
sagimnl pushed a commit that referenced this issue Jul 16, 2020
Call napi_disable() twice would cause dead lock. There are three situations
may result in the issue.

1. rtl8152_pre_reset() and set_carrier() are run at the same time.
2. Call rtl8152_set_tunable() after rtl8152_close().
3. Call rtl8152_set_ringparam() after rtl8152_close().

For #1, use the same solution as commit 8481141 ("r8152: Re-order
napi_disable in rtl8152_close"). For #2 and #3, add checking the flag
of IFF_UP and using napi_disable/napi_enable during mutex.

Signed-off-by: Hayes Wang <[email protected]>
Signed-off-by: David S. Miller <[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

No branches or pull requests

1 participant