Lines Matching full:process
56 /* For process termination handling */
184 mm = get_task_mm(pdd->process->lead_thread); in kfd_sdma_activity_worker()
255 * by current process. Translates acquired wave count into number of compute units
280 proc = pdd->process; in kfd_get_cu_occupancy()
282 pr_debug("Gpu-Id: %d has no active queues for process %d\n", in kfd_get_cu_occupancy()
498 if (!q || !q->process) in kfd_procfs_add_queue()
500 proc = q->process; in kfd_procfs_add_queue()
705 /* kfd_process_alloc_gpuvm - Allocate GPU VM for the KFD process
706 * This function should be only called right after the process
759 * process for IB usage The memory reserved is for KFD to submit
802 struct kfd_process *process; in kfd_create_process() local
815 * take kfd processes mutex before starting of process creation in kfd_create_process()
816 * so there won't be a case where two threads of the same process in kfd_create_process()
823 pr_debug("KFD is locked! Cannot create process"); in kfd_create_process()
827 /* A prior open of /dev/kfd could have already created the process. */ in kfd_create_process()
828 process = find_process(thread, false); in kfd_create_process()
829 if (process) { in kfd_create_process()
830 pr_debug("Process already found\n"); in kfd_create_process()
832 process = create_process(thread); in kfd_create_process()
833 if (IS_ERR(process)) in kfd_create_process()
839 process->kobj = kfd_alloc_struct(process->kobj); in kfd_create_process()
840 if (!process->kobj) { in kfd_create_process()
844 ret = kobject_init_and_add(process->kobj, &procfs_type, in kfd_create_process()
846 (int)process->lead_thread->pid); in kfd_create_process()
849 kobject_put(process->kobj); in kfd_create_process()
853 kfd_sysfs_create_file(process->kobj, &process->attr_pasid, in kfd_create_process()
856 process->kobj_queues = kobject_create_and_add("queues", in kfd_create_process()
857 process->kobj); in kfd_create_process()
858 if (!process->kobj_queues) in kfd_create_process()
861 kfd_procfs_add_sysfs_stats(process); in kfd_create_process()
862 kfd_procfs_add_sysfs_files(process); in kfd_create_process()
863 kfd_procfs_add_sysfs_counters(process); in kfd_create_process()
865 init_waitqueue_head(&process->wait_irq_drain); in kfd_create_process()
868 if (!IS_ERR(process)) in kfd_create_process()
869 kref_get(&process->ref); in kfd_create_process()
873 return process; in kfd_create_process()
878 struct kfd_process *process; in kfd_get_process() local
887 process = find_process(thread, false); in kfd_get_process()
888 if (!process) in kfd_get_process()
891 return process; in kfd_get_process()
896 struct kfd_process *process; in find_process_by_mm() local
898 hash_for_each_possible_rcu(kfd_processes_table, process, in find_process_by_mm()
900 if (process->mm == mm) in find_process_by_mm()
901 return process; in find_process_by_mm()
926 /* This increments the process->ref counter. */
949 struct kfd_process *p = pdd->process; in kfd_process_device_free_bos()
1021 pr_debug("Releasing pdd (topology id %d) for process (pasid 0x%x)\n", in kfd_process_destroy_pdds()
1104 /* No process locking is needed in this function, because the process
1106 * using it any more, otherwise we couldn't safely free the process
1260 * Move all remaining kfd_process from the process table to a in kfd_cleanup_processes()
1353 pdd->process->debug_trap_enabled); in kfd_process_device_init_cwsr_dgpu()
1402 * XNACK mode for this process that's compatible with all GPUs. in kfd_process_xnack_mode()
1420 * per-process XNACK mode selection. But let the dev->noretry in kfd_process_xnack_mode()
1462 struct kfd_process *process; in create_process() local
1466 process = kzalloc(sizeof(*process), GFP_KERNEL); in create_process()
1467 if (!process) in create_process()
1470 kref_init(&process->ref); in create_process()
1471 mutex_init(&process->mutex); in create_process()
1472 process->mm = thread->mm; in create_process()
1473 process->lead_thread = thread->group_leader; in create_process()
1474 process->n_pdds = 0; in create_process()
1475 process->queues_paused = false; in create_process()
1476 INIT_DELAYED_WORK(&process->eviction_work, evict_process_worker); in create_process()
1477 INIT_DELAYED_WORK(&process->restore_work, restore_process_worker); in create_process()
1478 process->last_restore_timestamp = get_jiffies_64(); in create_process()
1479 err = kfd_event_init_process(process); in create_process()
1482 process->is_32bit_user_mode = in_compat_syscall(); in create_process()
1483 process->debug_trap_enabled = false; in create_process()
1484 process->debugger_process = NULL; in create_process()
1485 process->exception_enable_mask = 0; in create_process()
1486 atomic_set(&process->debugged_process_count, 0); in create_process()
1487 sema_init(&process->runtime_enable_sema, 0); in create_process()
1489 process->pasid = kfd_pasid_alloc(); in create_process()
1490 if (process->pasid == 0) { in create_process()
1495 err = pqm_init(&process->pqm, process); in create_process()
1499 /* init process apertures*/ in create_process()
1500 err = kfd_init_apertures(process); in create_process()
1505 process->xnack_enabled = kfd_process_xnack_mode(process, false); in create_process()
1507 err = svm_range_list_init(process); in create_process()
1511 /* alloc_notifier needs to find the process in the hash table */ in create_process()
1512 hash_add_rcu(kfd_processes_table, &process->kfd_processes, in create_process()
1513 (uintptr_t)process->mm); in create_process()
1518 kref_get(&process->ref); in create_process()
1521 * because after this point we cannot unwind the process creation. in create_process()
1523 * dropping the last process reference in the free_notifier. in create_process()
1525 mn = mmu_notifier_get(&kfd_process_mmu_notifier_ops, process->mm); in create_process()
1530 BUG_ON(mn != &process->mmu_notifier); in create_process()
1532 kfd_unref_process(process); in create_process()
1533 get_task_struct(process->lead_thread); in create_process()
1535 INIT_WORK(&process->debug_event_workarea, debug_event_write_work_handler); in create_process()
1537 return process; in create_process()
1540 hash_del_rcu(&process->kfd_processes); in create_process()
1541 svm_range_list_fini(process); in create_process()
1543 kfd_process_free_outstanding_kfd_bos(process); in create_process()
1544 kfd_process_destroy_pdds(process); in create_process()
1546 pqm_uninit(&process->pqm); in create_process()
1548 kfd_pasid_free(process->pasid); in create_process()
1550 kfd_event_free_process(process); in create_process()
1552 mutex_destroy(&process->mutex); in create_process()
1553 kfree(process); in create_process()
1589 pdd->process = p; in kfd_create_process_device_data()
1606 pr_err("failed to allocate process context bo\n"); in kfd_create_process_device_data()
1630 * kfd_process_device_init_vm - Initialize a VM for a process-device
1632 * @pdd: The process-device
1664 p = pdd->process; in kfd_process_device_init_vm()
1671 pr_err("Failed to create process VM object\n"); in kfd_process_device_init_vm()
1704 * Direct the IOMMU to bind the process (specifically the pasid->mm)
1706 * Unbinding occurs when the process dies or the device is removed.
1708 * Assumes that the process lock is held.
1718 pr_err("Process device data doesn't exist\n"); in kfd_bind_process_to_device()
1747 /* Create specific handle mapped to mem from process local memory idr
1748 * Assumes that the process lock is held.
1756 /* Translate specific handle from process local memory idr
1757 * Assumes that the process lock is held.
1768 /* Remove specific handle from process local memory idr
1769 * Assumes that the process lock is held.
1778 /* This increments the process->ref counter. */
1799 /* This increments the process->ref counter. */
1815 /* kfd_process_evict_queues - Evict all user queues of a process
1817 * Eviction is reference-counted per process-device. This means multiple
1839 pr_err("Failed to evict process queues\n"); in kfd_process_evict_queues()
1869 /* kfd_process_restore_queues - Restore all user queues of a process */
1883 pr_err("Failed to restore process queues\n"); in kfd_process_restore_queues()
1940 /* Process termination destroys this worker thread. So during the in evict_process_worker()
1992 /* Process termination destroys this worker thread. So during the in restore_process_worker()
2000 * before KFD BOs are unreserved. If not, the process can be evicted in restore_process_worker()
2029 pr_err("Failed to suspend process 0x%x\n", p->pasid); in kfd_suspend_all_processes()
2043 pr_err("Restore process %d failed during resume\n", in kfd_resume_all_processes()
2052 int kfd_reserved_mem_mmap(struct kfd_node *dev, struct kfd_process *process, in kfd_reserved_mem_mmap() argument
2063 pdd = kfd_get_process_device_data(dev, process); in kfd_reserved_mem_mmap()
2071 pr_err("Error allocating per process CWSR buffer.\n"); in kfd_reserved_mem_mmap()
2077 /* Mapping pages to user process */ in kfd_reserved_mem_mmap()
2083 /* assumes caller holds process lock. */
2093 pdd->process->irq_drain_is_open = true; in kfd_process_drain_interrupts()
2098 irq_drain_fence[3] = pdd->process->pasid; in kfd_process_drain_interrupts()
2111 pdd->process->irq_drain_is_open = false; in kfd_process_drain_interrupts()
2115 r = wait_event_interruptible(pdd->process->wait_irq_drain, in kfd_process_drain_interrupts()
2116 !READ_ONCE(pdd->process->irq_drain_is_open)); in kfd_process_drain_interrupts()
2118 pdd->process->irq_drain_is_open = false; in kfd_process_drain_interrupts()
2248 seq_printf(m, "Process %d PASID 0x%x:\n", in kfd_debugfs_mqds_by_process()