1. 04 Mar, 2022 4 commits
  2. 03 Mar, 2022 11 commits
  3. 23 Feb, 2022 1 commit
  4. 17 Feb, 2022 19 commits
  5. 16 Feb, 2022 4 commits
  6. 08 Feb, 2022 1 commit
    • Tsuchiya Yuto's avatar
      media: atomisp: fix dummy_ptr check to avoid duplicate active_bo · 127efdbc
      Tsuchiya Yuto authored
      The dummy_ptr check in hmm_init() [1] results in the following
      "hmm_init Failed to create sysfs" error exactly once every
      two times on atomisp reload by rmmod/insmod (although atomisp module
      loads and works fine regardless of this error):
      
      	[  140.230662] sysfs: cannot create duplicate filename '/devices/pci0000:00/0000:00:03.0/active_bo'
      	[  140.230668] CPU: 1 PID: 2502 Comm: insmod Tainted: G         C OE     5.15.0-rc4-1-surface-mainline #1 b8acf6eb64994414b2e20bad312a7a2c45f748f9
      	[  140.230675] Hardware name: OEMB OEMB/OEMB, BIOS 1.51116.238 03/09/2015
      	[  140.230678] Call Trace:
      	[  140.230687]  dump_stack_lvl+0x46/0x5a
      	[  140.230702]  sysfs_warn_dup.cold+0x17/0x24
      	[  140.230710]  sysfs_add_file_mode_ns+0x160/0x170
      	[  140.230717]  internal_create_group+0x126/0x390
      	[  140.230723]  hmm_init+0x5c/0x70 [atomisp 7a6a680bf400629363d2a6f58fd10e7299678b99]
      	[  140.230811]  atomisp_pci_probe.cold+0x1136/0x148e [atomisp 7a6a680bf400629363d2a6f58fd10e7299678b99]
      	[  140.230875]  local_pci_probe+0x45/0x80
      	[  140.230882]  ? pci_match_device+0xd7/0x130
      	[  140.230887]  pci_device_probe+0xfa/0x1b0
      	[  140.230892]  really_probe+0x1f5/0x3f0
      	[  140.230899]  __driver_probe_device+0xfe/0x180
      	[  140.230903]  driver_probe_device+0x1e/0x90
      	[  140.230908]  __driver_attach+0xc0/0x1c0
      	[  140.230912]  ? __device_attach_driver+0xe0/0xe0
      	[  140.230915]  ? __device_attach_driver+0xe0/0xe0
      	[  140.230919]  bus_for_each_dev+0x89/0xd0
      	[  140.230924]  bus_add_driver+0x12b/0x1e0
      	[  140.230929]  driver_register+0x8f/0xe0
      	[  140.230933]  ? 0xffffffffc153f000
      	[  140.230937]  do_one_initcall+0x57/0x220
      	[  140.230945]  do_init_module+0x5c/0x260
      	[  140.230952]  load_module+0x24bd/0x26a0
      	[  140.230962]  ? __do_sys_finit_module+0xae/0x110
      	[  140.230966]  __do_sys_finit_module+0xae/0x110
      	[  140.230972]  do_syscall_64+0x5c/0x80
      	[  140.230979]  ? syscall_exit_to_user_mode+0x23/0x40
      	[  140.230983]  ? do_syscall_64+0x69/0x80
      	[  140.230988]  ? exc_page_fault+0x72/0x170
      	[  140.230991]  entry_SYSCALL_64_after_hwframe+0x44/0xae
      	[  140.230997] RIP: 0033:0x7f7fd5d8718d
      	[  140.231003] Code: b4 0c 00 0f 05 eb a9 66 0f 1f 44 00 00 f3 0f 1e fa 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 73 01 c3 48 8b 0d b3 6c 0c 00 f7 d8 64 89 01 48
      	[  140.231006] RSP: 002b:00007ffefc25f0e8 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
      	[  140.231012] RAX: ffffffffffffffda RBX: 000055ac3edcd7f0 RCX: 00007f7fd5d8718d
      	[  140.231015] RDX: 0000000000000000 RSI: 000055ac3d723270 RDI: 0000000000000003
      	[  140.231017] RBP: 0000000000000000 R08: 0000000000000000 R09: 00007f7fd5e52380
      	[  140.231019] R10: 0000000000000003 R11: 0000000000000246 R12: 000055ac3d723270
      	[  140.231021] R13: 0000000000000000 R14: 000055ac3edd06e0 R15: 0000000000000000
      	[  140.231038] atomisp-isp2 0000:00:03.0: hmm_init Failed to create sysfs
      
      The problem is that dummy_ptr == 0 is a valid value. So, change the logic
      which checks if dummy_ptr was allocated.
      
      At this point, atomisp now gives WARN_ON() in hmm_free() [2] on atomisp
      reload by rmmod/insmod. Again, the check is wrong there.
      
      So, change both checks for mmgr_EXCEPTION, which is the error value when
      HMM allocation fails, and initialize dummy_ptr with such value.
      
      [1] added on commit
          d9ab8395 ("media: atomisp: don't cause a warn if probe failed")
      [2] added on commit
          b83cc378 ("atomisp: clean up the hmm init/cleanup indirections")
      
      Link: https://lore.kernel.org/linux-media/20211017162337.44860-3-kitakar@gmail.comSigned-off-by: default avatarTsuchiya Yuto <kitakar@gmail.com>
      Co-developed-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
      127efdbc