From: Michel Dänzer <michel.daenzer@xxxxxxx> The entries were only initialized once in amdgpu_sa_bo_new. If a fence wasn't signalled yet in the first amdgpu_sa_bo_next_hole call, but then got signalled before a later amdgpu_sa_bo_next_hole call, it could destroy the fence but leave its pointer in the array, resulting in use-after-free in amdgpu_sa_bo_new. Signed-off-by: Michel Dänzer <michel.daenzer at amd.com> --- I think this should fix an issue hit by today's piglit run: Sep 12 13:31:41 kaveri kernel: [ 2776.375043] refcount_t: increment on 0; use-after-free. Sep 12 13:31:41 kaveri kernel: [ 2776.375076] WARNING: CPU: 14 PID: 14012 at lib/refcount.c:153 refcount_inc_checked+0x26/0x30 Sep 12 13:31:41 kaveri kernel: [ 2776.375079] Modules linked in: fuse(E) lz4(E) lz4_compress(E) cpufreq_powersave(E) cpufreq_userspace(E) cpufreq_conservative(E) amdgpu(OE) chash(OE) gpu_sched(OE) binfmt_misc(E) nls_ascii(E) nls_cp437(E) vfat(E) fat(E) edac_mce_amd(E) radeon(OE) kvm(E) irqbypass(E) ttm(OE) crct10dif_pclmul(E) crc32_pclmul(E) snd_hda_codec_realtek(E) ghash_clmulni_intel(E) wmi_bmof(E) pcbc(E) snd_hda_codec_generic(E) snd_hda_codec_hdmi(E) drm_kms_helper(OE) aesni_intel(E) snd_hda_intel(E) aes_x86_64(E) snd_hda_codec(E) crypto_simd(E) r8169(E) snd_hda_core(E) cryptd(E) efi_pstore(E) drm(OE) glue_helper(E) sg(E) snd_hwdep(E) libphy(E) i2c_algo_bit(E) snd_pcm(E) fb_sys_fops(E) syscopyarea(E) sysfillrect(E) snd_timer(E) sysimgblt(E) efivars(E) pcspkr(E) snd(E) ccp(E) soundcore(E) sp5100_tco(E) rng_core(E) i2c_piix4(E) Sep 12 13:31:41 kaveri kernel: [ 2776.375237] k10temp(E) wmi(E) button(E) pcc_cpufreq(E) acpi_cpufreq(E) tcp_bbr(E) sch_fq(E) sunrpc(E) nct6775(E) hwmon_vid(E) efivarfs(E) ip_tables(E) x_tables(E) autofs4(E) ext4(E) crc32c_generic(E) crc16(E) mbcache(E) jbd2(E) fscrypto(E) dm_mod(E) raid10(E) raid1(E) raid0(E) multipath(E) linear(E) md_mod(E) sd_mod(E) evdev(E) hid_generic(E) usbhid(E) hid(E) ahci(E) libahci(E) libata(E) xhci_pci(E) xhci_hcd(E) crc32c_intel(E) usbcore(E) scsi_mod(E) gpio_amdpt(E) gpio_generic(E) Sep 12 13:31:41 kaveri kernel: [ 2776.375355] CPU: 14 PID: 14012 Comm: arb_shader:cs0 Tainted: G OE 4.19.0-rc1+ #112 Sep 12 13:31:41 kaveri kernel: [ 2776.375359] Hardware name: Micro-Star International Co., Ltd. MS-7A34/B350 TOMAHAWK (MS-7A34), BIOS 1.80 09/13/2017 Sep 12 13:31:41 kaveri kernel: [ 2776.375364] RIP: 0010:refcount_inc_checked+0x26/0x30 Sep 12 13:31:41 kaveri kernel: [ 2776.375369] Code: 00 00 00 00 e8 ab fe ff ff 84 c0 74 01 c3 80 3d f3 35 b3 01 00 75 f6 48 c7 c7 a0 c5 fe 9f c6 05 e3 35 b3 01 01 e8 85 7f 58 ff <0f> 0b c3 0f 1f 80 00 00 00 00 41 56 41 55 41 54 41 89 fc 55 48 bd Sep 12 13:31:41 kaveri kernel: [ 2776.375372] RSP: 0018:ffff8803de50f070 EFLAGS: 00010286 Sep 12 13:31:41 kaveri kernel: [ 2776.375379] RAX: 0000000000000000 RBX: ffff8803de50f278 RCX: ffffffff9e65c7f0 Sep 12 13:31:41 kaveri kernel: [ 2776.375383] RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff8803ee19e9c0 Sep 12 13:31:41 kaveri kernel: [ 2776.375386] RBP: ffff88020c8453e0 R08: ffffed007dc33d39 R09: ffffed007dc33d38 Sep 12 13:31:41 kaveri kernel: [ 2776.375390] R10: ffffed007dc33d38 R11: ffff8803ee19e9c7 R12: 0000000000000003 Sep 12 13:31:41 kaveri kernel: [ 2776.375393] R13: dffffc0000000000 R14: 0000000000000002 R15: ffff8803de50f330 Sep 12 13:31:41 kaveri kernel: [ 2776.375397] FS: 00007f2901924700(0000) GS:ffff8803ee180000(0000) knlGS:0000000000000000 Sep 12 13:31:41 kaveri kernel: [ 2776.375401] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 Sep 12 13:31:41 kaveri kernel: [ 2776.375404] CR2: 000055b1f3c5e000 CR3: 00000003e5ca0000 CR4: 00000000003406e0 Sep 12 13:31:41 kaveri kernel: [ 2776.375407] Call Trace: Sep 12 13:31:41 kaveri kernel: [ 2776.375494] amdgpu_sa_bo_new+0x630/0xf40 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.375581] ? amdgpu_sa_bo_manager_fini+0x260/0x260 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.375672] ? amdgpu_job_alloc+0x3d/0x310 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.375762] ? amdgpu_job_alloc_with_ib+0x24/0xe0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.375838] ? amdgpu_vm_bo_update_mapping+0x2b5/0xb40 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.375914] ? amdgpu_vm_bo_update+0x938/0x1c60 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.375989] ? amdgpu_vm_handle_moved+0x206/0x2c0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.376063] ? amdgpu_cs_ioctl+0x27ee/0x4a80 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.376083] ? drm_ioctl_kernel+0x197/0x220 [drm] Sep 12 13:31:41 kaveri kernel: [ 2776.376101] ? drm_ioctl+0x40e/0x860 [drm] Sep 12 13:31:41 kaveri kernel: [ 2776.376171] ? amdgpu_drm_ioctl+0xcc/0x1b0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.376176] ? do_vfs_ioctl+0x193/0xf70 Sep 12 13:31:41 kaveri kernel: [ 2776.376179] ? ksys_ioctl+0x60/0x90 Sep 12 13:31:41 kaveri kernel: [ 2776.376182] ? __x64_sys_ioctl+0x6f/0xb0 Sep 12 13:31:41 kaveri kernel: [ 2776.376186] ? do_syscall_64+0xa5/0x3e0 Sep 12 13:31:41 kaveri kernel: [ 2776.376201] ? find_held_lock+0x33/0x1c0 Sep 12 13:31:41 kaveri kernel: [ 2776.376225] ? __kmalloc+0x117/0x260 Sep 12 13:31:41 kaveri kernel: [ 2776.376304] amdgpu_ib_get+0x35/0x240 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.376398] amdgpu_job_alloc_with_ib+0x7f/0xe0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.376477] amdgpu_vm_bo_update_mapping+0x2b5/0xb40 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.376560] ? amdgpu_vm_frag_ptes+0x1b0/0x1b0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.376566] ? mark_held_locks+0x140/0x140 Sep 12 13:31:41 kaveri kernel: [ 2776.376571] ? mark_held_locks+0x140/0x140 Sep 12 13:31:41 kaveri kernel: [ 2776.376651] ? amdgpu_vm_update_func+0x150/0x150 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.376656] ? __lock_is_held+0xad/0x140 Sep 12 13:31:41 kaveri kernel: [ 2776.376737] amdgpu_vm_bo_update+0x938/0x1c60 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.376756] ? mutex_trylock+0x167/0x1a0 Sep 12 13:31:41 kaveri kernel: [ 2776.376831] ? amdgpu_vm_handle_moved+0x1f1/0x2c0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.376910] amdgpu_vm_handle_moved+0x206/0x2c0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.376989] amdgpu_cs_ioctl+0x27ee/0x4a80 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.376999] ? mark_held_locks+0x140/0x140 Sep 12 13:31:41 kaveri kernel: [ 2776.377074] ? amdgpu_cs_find_mapping+0x3c0/0x3c0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.377082] ? mark_held_locks+0x140/0x140 Sep 12 13:31:41 kaveri kernel: [ 2776.377090] ? __lock_acquire+0x6ea/0x4820 Sep 12 13:31:41 kaveri kernel: [ 2776.377099] ? quarantine_put+0xca/0x170 Sep 12 13:31:41 kaveri kernel: [ 2776.377212] ? amdgpu_cs_find_mapping+0x3c0/0x3c0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.377232] drm_ioctl_kernel+0x197/0x220 [drm] Sep 12 13:31:41 kaveri kernel: [ 2776.377252] ? drm_setversion+0x800/0x800 [drm] Sep 12 13:31:41 kaveri kernel: [ 2776.377279] drm_ioctl+0x40e/0x860 [drm] Sep 12 13:31:41 kaveri kernel: [ 2776.377356] ? amdgpu_cs_find_mapping+0x3c0/0x3c0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.377376] ? drm_version+0x390/0x390 [drm] Sep 12 13:31:41 kaveri kernel: [ 2776.377387] ? lock_downgrade+0x5e0/0x5e0 Sep 12 13:31:41 kaveri kernel: [ 2776.377390] ? lock_acquire+0x115/0x2b0 Sep 12 13:31:41 kaveri kernel: [ 2776.377395] ? __pm_runtime_resume+0x98/0xf0 Sep 12 13:31:41 kaveri kernel: [ 2776.377401] ? _raw_spin_unlock_irqrestore+0x44/0x60 Sep 12 13:31:41 kaveri kernel: [ 2776.377406] ? lockdep_hardirqs_on+0x381/0x570 Sep 12 13:31:41 kaveri kernel: [ 2776.377482] amdgpu_drm_ioctl+0xcc/0x1b0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.377491] do_vfs_ioctl+0x193/0xf70 Sep 12 13:31:41 kaveri kernel: [ 2776.377495] ? lock_downgrade+0x5e0/0x5e0 Sep 12 13:31:41 kaveri kernel: [ 2776.377500] ? ioctl_preallocate+0x1b0/0x1b0 Sep 12 13:31:41 kaveri kernel: [ 2776.377510] ? __fget+0x287/0x3e0 Sep 12 13:31:41 kaveri kernel: [ 2776.377518] ? __ia32_sys_dup2+0x2e0/0x2e0 Sep 12 13:31:41 kaveri kernel: [ 2776.377533] ksys_ioctl+0x60/0x90 Sep 12 13:31:41 kaveri kernel: [ 2776.377540] __x64_sys_ioctl+0x6f/0xb0 Sep 12 13:31:41 kaveri kernel: [ 2776.377543] ? lockdep_hardirqs_on+0x381/0x570 Sep 12 13:31:41 kaveri kernel: [ 2776.377547] do_syscall_64+0xa5/0x3e0 Sep 12 13:31:41 kaveri kernel: [ 2776.377553] entry_SYSCALL_64_after_hwframe+0x49/0xbe Sep 12 13:31:41 kaveri kernel: [ 2776.377557] RIP: 0033:0x7f29080d8067 Sep 12 13:31:41 kaveri kernel: [ 2776.377561] Code: b3 66 90 48 8b 05 21 7e 0c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d f1 7d 0c 00 f7 d8 64 89 01 48 Sep 12 13:31:41 kaveri kernel: [ 2776.377563] RSP: 002b:00007f2901923bf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 Sep 12 13:31:41 kaveri kernel: [ 2776.377568] RAX: ffffffffffffffda RBX: 00007f2901923d28 RCX: 00007f29080d8067 Sep 12 13:31:41 kaveri kernel: [ 2776.377570] RDX: 00007f2901923c70 RSI: 00000000c0186444 RDI: 0000000000000006 Sep 12 13:31:41 kaveri kernel: [ 2776.377572] RBP: 00007f2901923c20 R08: 00007f2901923d80 R09: 00007f2901923d28 Sep 12 13:31:41 kaveri kernel: [ 2776.377574] R10: 00007f2901923d80 R11: 0000000000000246 R12: 00007f2901923c70 Sep 12 13:31:41 kaveri kernel: [ 2776.377576] R13: 00000000c0186444 R14: 0000000000000006 R15: 0000562ee0b01ac0 Sep 12 13:31:41 kaveri kernel: [ 2776.377590] irq event stamp: 404674 Sep 12 13:31:41 kaveri kernel: [ 2776.377595] hardirqs last enabled at (404673): [<ffffffff9e46ba41>] console_unlock+0x5c1/0xab0 Sep 12 13:31:41 kaveri kernel: [ 2776.377599] hardirqs last disabled at (404674): [<ffffffff9e203522>] trace_hardirqs_off_thunk+0x1a/0x1c Sep 12 13:31:41 kaveri kernel: [ 2776.377602] softirqs last enabled at (399884): [<ffffffff9fc00580>] __do_softirq+0x580/0x82f Sep 12 13:31:41 kaveri kernel: [ 2776.377607] softirqs last disabled at (399875): [<ffffffff9e3378f0>] irq_exit+0x1a0/0x1d0 Sep 12 13:31:41 kaveri kernel: [ 2776.377609] ---[ end trace 7a15e3be73c1c169 ]--- Sep 12 13:31:41 kaveri kernel: [ 2776.386607] ------------[ cut here ]------------ Sep 12 13:31:41 kaveri kernel: [ 2776.386612] refcount_t: underflow; use-after-free. Sep 12 13:31:41 kaveri kernel: [ 2776.386642] WARNING: CPU: 14 PID: 14012 at lib/refcount.c:187 refcount_sub_and_test_checked+0x147/0x160 Sep 12 13:31:41 kaveri kernel: [ 2776.386645] Modules linked in: fuse(E) lz4(E) lz4_compress(E) cpufreq_powersave(E) cpufreq_userspace(E) cpufreq_conservative(E) amdgpu(OE) chash(OE) gpu_sched(OE) binfmt_misc(E) nls_ascii(E) nls_cp437(E) vfat(E) fat(E) edac_mce_amd(E) radeon(OE) kvm(E) irqbypass(E) ttm(OE) crct10dif_pclmul(E) crc32_pclmul(E) snd_hda_codec_realtek(E) ghash_clmulni_intel(E) wmi_bmof(E) pcbc(E) snd_hda_codec_generic(E) snd_hda_codec_hdmi(E) drm_kms_helper(OE) aesni_intel(E) snd_hda_intel(E) aes_x86_64(E) snd_hda_codec(E) crypto_simd(E) r8169(E) snd_hda_core(E) cryptd(E) efi_pstore(E) drm(OE) glue_helper(E) sg(E) snd_hwdep(E) libphy(E) i2c_algo_bit(E) snd_pcm(E) fb_sys_fops(E) syscopyarea(E) sysfillrect(E) snd_timer(E) sysimgblt(E) efivars(E) pcspkr(E) snd(E) ccp(E) soundcore(E) sp5100_tco(E) rng_core(E) i2c_piix4(E) Sep 12 13:31:41 kaveri kernel: [ 2776.386794] k10temp(E) wmi(E) button(E) pcc_cpufreq(E) acpi_cpufreq(E) tcp_bbr(E) sch_fq(E) sunrpc(E) nct6775(E) hwmon_vid(E) efivarfs(E) ip_tables(E) x_tables(E) autofs4(E) ext4(E) crc32c_generic(E) crc16(E) mbcache(E) jbd2(E) fscrypto(E) dm_mod(E) raid10(E) raid1(E) raid0(E) multipath(E) linear(E) md_mod(E) sd_mod(E) evdev(E) hid_generic(E) usbhid(E) hid(E) ahci(E) libahci(E) libata(E) xhci_pci(E) xhci_hcd(E) crc32c_intel(E) usbcore(E) scsi_mod(E) gpio_amdpt(E) gpio_generic(E) Sep 12 13:31:41 kaveri kernel: [ 2776.386911] CPU: 14 PID: 14012 Comm: arb_shader:cs0 Tainted: G W OE 4.19.0-rc1+ #112 Sep 12 13:31:41 kaveri kernel: [ 2776.386914] Hardware name: Micro-Star International Co., Ltd. MS-7A34/B350 TOMAHAWK (MS-7A34), BIOS 1.80 09/13/2017 Sep 12 13:31:41 kaveri kernel: [ 2776.386919] RIP: 0010:refcount_sub_and_test_checked+0x147/0x160 Sep 12 13:31:41 kaveri kernel: [ 2776.386924] Code: c2 44 29 e0 89 c5 85 d2 74 8a 80 3d a5 34 b3 01 00 74 04 31 c0 eb aa 48 c7 c7 00 c6 fe 9f c6 05 91 34 b3 01 01 e8 34 7e 58 ff <0f> 0b 31 c0 eb 91 48 89 df e8 9b 7d ae ff e9 34 ff ff ff e8 61 79 Sep 12 13:31:41 kaveri kernel: [ 2776.386927] RSP: 0018:ffff8803de50efe0 EFLAGS: 00010286 Sep 12 13:31:41 kaveri kernel: [ 2776.386933] RAX: 0000000000000000 RBX: ffff88020c8453e0 RCX: ffffffff9e65c7f0 Sep 12 13:31:41 kaveri kernel: [ 2776.386935] RDX: 0000000000000000 RSI: 0000000000000008 RDI: ffff8803ee19e9c0 Sep 12 13:31:41 kaveri kernel: [ 2776.386938] RBP: 00000000ffffffff R08: ffffed007dc33d39 R09: ffffed007dc33d38 Sep 12 13:31:41 kaveri kernel: [ 2776.386941] R10: ffffed007dc33d38 R11: ffff8803ee19e9c7 R12: 0000000000000001 Sep 12 13:31:41 kaveri kernel: [ 2776.386943] R13: ffff8803de50f008 R14: 1ffff1007bca1dfd R15: ffff8803de50f230 Sep 12 13:31:41 kaveri kernel: [ 2776.386947] FS: 00007f2901924700(0000) GS:ffff8803ee180000(0000) knlGS:0000000000000000 Sep 12 13:31:41 kaveri kernel: [ 2776.386949] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 Sep 12 13:31:41 kaveri kernel: [ 2776.386952] CR2: 00007f1f586aac00 CR3: 00000003e5ca0000 CR4: 00000000003406e0 Sep 12 13:31:41 kaveri kernel: [ 2776.386957] Call Trace: Sep 12 13:31:41 kaveri kernel: [ 2776.386969] ? refcount_inc_checked+0x30/0x30 Sep 12 13:31:41 kaveri kernel: [ 2776.386985] ? irq_work_claim+0x40/0x70 Sep 12 13:31:41 kaveri kernel: [ 2776.387116] amdgpu_sa_bo_new+0xb49/0xf40 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.387244] ? amdgpu_sa_bo_manager_fini+0x260/0x260 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.387373] ? amdgpu_job_alloc+0x3d/0x310 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.387500] ? amdgpu_job_alloc_with_ib+0x24/0xe0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.387609] ? amdgpu_vm_bo_update_mapping+0x2b5/0xb40 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.387725] ? amdgpu_vm_bo_update+0x938/0x1c60 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.387839] ? amdgpu_vm_handle_moved+0x206/0x2c0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.387955] ? amdgpu_cs_ioctl+0x27ee/0x4a80 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.387983] ? drm_ioctl_kernel+0x197/0x220 [drm] Sep 12 13:31:41 kaveri kernel: [ 2776.388008] ? drm_ioctl+0x40e/0x860 [drm] Sep 12 13:31:41 kaveri kernel: [ 2776.388117] ? amdgpu_drm_ioctl+0xcc/0x1b0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.388129] ? do_vfs_ioctl+0x193/0xf70 Sep 12 13:31:41 kaveri kernel: [ 2776.388134] ? ksys_ioctl+0x60/0x90 Sep 12 13:31:41 kaveri kernel: [ 2776.388138] ? __x64_sys_ioctl+0x6f/0xb0 Sep 12 13:31:41 kaveri kernel: [ 2776.388144] ? do_syscall_64+0xa5/0x3e0 Sep 12 13:31:41 kaveri kernel: [ 2776.388167] ? find_held_lock+0x33/0x1c0 Sep 12 13:31:41 kaveri kernel: [ 2776.388204] ? __kmalloc+0x117/0x260 Sep 12 13:31:41 kaveri kernel: [ 2776.388326] amdgpu_ib_get+0x35/0x240 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.388460] amdgpu_job_alloc_with_ib+0x7f/0xe0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.388579] amdgpu_vm_bo_update_mapping+0x2b5/0xb40 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.388706] ? amdgpu_vm_frag_ptes+0x1b0/0x1b0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.388715] ? mark_held_locks+0x140/0x140 Sep 12 13:31:41 kaveri kernel: [ 2776.388724] ? mark_held_locks+0x140/0x140 Sep 12 13:31:41 kaveri kernel: [ 2776.388841] ? amdgpu_vm_update_func+0x150/0x150 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.388848] ? __lock_is_held+0xad/0x140 Sep 12 13:31:41 kaveri kernel: [ 2776.388972] amdgpu_vm_bo_update+0x938/0x1c60 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.389001] ? mutex_trylock+0x167/0x1a0 Sep 12 13:31:41 kaveri kernel: [ 2776.389113] ? amdgpu_vm_handle_moved+0x1f1/0x2c0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.389232] amdgpu_vm_handle_moved+0x206/0x2c0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.389347] amdgpu_cs_ioctl+0x27ee/0x4a80 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.389362] ? mark_held_locks+0x140/0x140 Sep 12 13:31:41 kaveri kernel: [ 2776.389478] ? amdgpu_cs_find_mapping+0x3c0/0x3c0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.389489] ? mark_held_locks+0x140/0x140 Sep 12 13:31:41 kaveri kernel: [ 2776.389504] ? __lock_acquire+0x6ea/0x4820 Sep 12 13:31:41 kaveri kernel: [ 2776.389515] ? quarantine_put+0xca/0x170 Sep 12 13:31:41 kaveri kernel: [ 2776.389689] ? amdgpu_cs_find_mapping+0x3c0/0x3c0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.389717] drm_ioctl_kernel+0x197/0x220 [drm] Sep 12 13:31:41 kaveri kernel: [ 2776.389746] ? drm_setversion+0x800/0x800 [drm] Sep 12 13:31:41 kaveri kernel: [ 2776.389786] drm_ioctl+0x40e/0x860 [drm] Sep 12 13:31:41 kaveri kernel: [ 2776.389906] ? amdgpu_cs_find_mapping+0x3c0/0x3c0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.389935] ? drm_version+0x390/0x390 [drm] Sep 12 13:31:41 kaveri kernel: [ 2776.389954] ? lock_downgrade+0x5e0/0x5e0 Sep 12 13:31:41 kaveri kernel: [ 2776.389958] ? lock_acquire+0x115/0x2b0 Sep 12 13:31:41 kaveri kernel: [ 2776.389965] ? __pm_runtime_resume+0x98/0xf0 Sep 12 13:31:41 kaveri kernel: [ 2776.389975] ? _raw_spin_unlock_irqrestore+0x44/0x60 Sep 12 13:31:41 kaveri kernel: [ 2776.389983] ? lockdep_hardirqs_on+0x381/0x570 Sep 12 13:31:41 kaveri kernel: [ 2776.390101] amdgpu_drm_ioctl+0xcc/0x1b0 [amdgpu] Sep 12 13:31:41 kaveri kernel: [ 2776.390114] do_vfs_ioctl+0x193/0xf70 Sep 12 13:31:41 kaveri kernel: [ 2776.390122] ? lock_downgrade+0x5e0/0x5e0 Sep 12 13:31:41 kaveri kernel: [ 2776.390129] ? ioctl_preallocate+0x1b0/0x1b0 Sep 12 13:31:41 kaveri kernel: [ 2776.390144] ? __fget+0x287/0x3e0 Sep 12 13:31:41 kaveri kernel: [ 2776.390157] ? __ia32_sys_dup2+0x2e0/0x2e0 Sep 12 13:31:41 kaveri kernel: [ 2776.390180] ksys_ioctl+0x60/0x90 Sep 12 13:31:41 kaveri kernel: [ 2776.390190] __x64_sys_ioctl+0x6f/0xb0 Sep 12 13:31:41 kaveri kernel: [ 2776.390194] ? lockdep_hardirqs_on+0x381/0x570 Sep 12 13:31:41 kaveri kernel: [ 2776.390202] do_syscall_64+0xa5/0x3e0 Sep 12 13:31:41 kaveri kernel: [ 2776.390210] entry_SYSCALL_64_after_hwframe+0x49/0xbe Sep 12 13:31:41 kaveri kernel: [ 2776.390216] RIP: 0033:0x7f29080d8067 Sep 12 13:31:41 kaveri kernel: [ 2776.390222] Code: b3 66 90 48 8b 05 21 7e 0c 00 64 c7 00 26 00 00 00 48 c7 c0 ff ff ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 b8 10 00 00 00 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d f1 7d 0c 00 f7 d8 64 89 01 48 Sep 12 13:31:41 kaveri kernel: [ 2776.390225] RSP: 002b:00007f2901923bf8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 Sep 12 13:31:41 kaveri kernel: [ 2776.390233] RAX: ffffffffffffffda RBX: 00007f2901923d28 RCX: 00007f29080d8067 Sep 12 13:31:41 kaveri kernel: [ 2776.390236] RDX: 00007f2901923c70 RSI: 00000000c0186444 RDI: 0000000000000006 Sep 12 13:31:41 kaveri kernel: [ 2776.390241] RBP: 00007f2901923c20 R08: 00007f2901923d80 R09: 00007f2901923d28 Sep 12 13:31:41 kaveri kernel: [ 2776.390245] R10: 00007f2901923d80 R11: 0000000000000246 R12: 00007f2901923c70 Sep 12 13:31:41 kaveri kernel: [ 2776.390248] R13: 00000000c0186444 R14: 0000000000000006 R15: 0000562ee0b01ac0 Sep 12 13:31:41 kaveri kernel: [ 2776.390271] irq event stamp: 404696 Sep 12 13:31:41 kaveri kernel: [ 2776.390277] hardirqs last enabled at (404695): [<ffffffff9e46ba41>] console_unlock+0x5c1/0xab0 Sep 12 13:31:41 kaveri kernel: [ 2776.390283] hardirqs last disabled at (404696): [<ffffffff9e203522>] trace_hardirqs_off_thunk+0x1a/0x1c Sep 12 13:31:41 kaveri kernel: [ 2776.390288] softirqs last enabled at (399884): [<ffffffff9fc00580>] __do_softirq+0x580/0x82f Sep 12 13:31:41 kaveri kernel: [ 2776.390294] softirqs last disabled at (399875): [<ffffffff9e3378f0>] irq_exit+0x1a0/0x1d0 drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c index fb1667b35daa..12f2bf97611f 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c @@ -226,6 +226,8 @@ static bool amdgpu_sa_bo_next_hole(struct amdgpu_sa_manager *sa_manager, for (i = 0; i < AMDGPU_SA_NUM_FENCE_LISTS; ++i) { struct amdgpu_sa_bo *sa_bo; + fences[i] = NULL; + if (list_empty(&sa_manager->flist[i])) continue; @@ -296,10 +298,8 @@ int amdgpu_sa_bo_new(struct amdgpu_sa_manager *sa_manager, spin_lock(&sa_manager->wq.lock); do { - for (i = 0; i < AMDGPU_SA_NUM_FENCE_LISTS; ++i) { - fences[i] = NULL; + for (i = 0; i < AMDGPU_SA_NUM_FENCE_LISTS; ++i) tries[i] = 0; - } do { amdgpu_sa_bo_try_free(sa_manager); -- 2.19.0.rc2