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
285 proc = pdd->process; in kfd_get_cu_occupancy()
287 pr_debug("Gpu-Id: %d has no active queues for process %d\n", in kfd_get_cu_occupancy()
524 if (!q || !q->process) in kfd_procfs_add_queue()
526 proc = q->process; in kfd_procfs_add_queue()
731 /* kfd_process_alloc_gpuvm - Allocate GPU VM for the KFD process
732 * This function should be only called right after the process
785 * process for IB usage The memory reserved is for KFD to submit
828 struct kfd_process *process; in kfd_create_process() local
841 * take kfd processes mutex before starting of process creation in kfd_create_process()
842 * so there won't be a case where two threads of the same process in kfd_create_process()
848 pr_debug("KFD is locked! Cannot create process"); in kfd_create_process()
849 process = ERR_PTR(-EINVAL); in kfd_create_process()
853 /* A prior open of /dev/kfd could have already created the process. */ in kfd_create_process()
854 process = find_process(thread, false); in kfd_create_process()
855 if (process) { in kfd_create_process()
856 pr_debug("Process already found\n"); in kfd_create_process()
858 /* If the process just called exec(3), it is possible that the in kfd_create_process()
860 * of the old process image) is still in the cleanup work queue. in kfd_create_process()
862 * resource for this process. in kfd_create_process()
866 process = create_process(thread); in kfd_create_process()
867 if (IS_ERR(process)) in kfd_create_process()
873 process->kobj = kfd_alloc_struct(process->kobj); in kfd_create_process()
874 if (!process->kobj) { in kfd_create_process()
878 ret = kobject_init_and_add(process->kobj, &procfs_type, in kfd_create_process()
880 (int)process->lead_thread->pid); in kfd_create_process()
883 kobject_put(process->kobj); in kfd_create_process()
887 kfd_sysfs_create_file(process->kobj, &process->attr_pasid, in kfd_create_process()
890 process->kobj_queues = kobject_create_and_add("queues", in kfd_create_process()
891 process->kobj); in kfd_create_process()
892 if (!process->kobj_queues) in kfd_create_process()
895 kfd_procfs_add_sysfs_stats(process); in kfd_create_process()
896 kfd_procfs_add_sysfs_files(process); in kfd_create_process()
897 kfd_procfs_add_sysfs_counters(process); in kfd_create_process()
899 init_waitqueue_head(&process->wait_irq_drain); in kfd_create_process()
902 if (!IS_ERR(process)) in kfd_create_process()
903 kref_get(&process->ref); in kfd_create_process()
907 return process; in kfd_create_process()
912 struct kfd_process *process; in kfd_get_process() local
921 process = find_process(thread, false); in kfd_get_process()
922 if (!process) in kfd_get_process()
925 return process; in kfd_get_process()
930 struct kfd_process *process; in find_process_by_mm() local
932 hash_for_each_possible_rcu(kfd_processes_table, process, in find_process_by_mm()
934 if (process->mm == mm) in find_process_by_mm()
935 return process; in find_process_by_mm()
960 /* This increments the process->ref counter. */
983 struct kfd_process *p = pdd->process; in kfd_process_device_free_bos()
1055 pr_debug("Releasing pdd (topology id %d) for process (pasid 0x%x)\n", in kfd_process_destroy_pdds()
1138 /* No process locking is needed in this function, because the process
1140 * using it any more, otherwise we couldn't safely free the process
1294 * Move all remaining kfd_process from the process table to a in kfd_cleanup_processes()
1388 pdd->process->debug_trap_enabled); in kfd_process_device_init_cwsr_dgpu()
1437 * XNACK mode for this process that's compatible with all GPUs. in kfd_process_xnack_mode()
1455 * per-process XNACK mode selection. But let the dev->noretry in kfd_process_xnack_mode()
1497 struct kfd_process *process; in create_process() local
1501 process = kzalloc(sizeof(*process), GFP_KERNEL); in create_process()
1502 if (!process) in create_process()
1505 kref_init(&process->ref); in create_process()
1506 mutex_init(&process->mutex); in create_process()
1507 process->mm = thread->mm; in create_process()
1508 process->lead_thread = thread->group_leader; in create_process()
1509 process->n_pdds = 0; in create_process()
1510 process->queues_paused = false; in create_process()
1511 INIT_DELAYED_WORK(&process->eviction_work, evict_process_worker); in create_process()
1512 INIT_DELAYED_WORK(&process->restore_work, restore_process_worker); in create_process()
1513 process->last_restore_timestamp = get_jiffies_64(); in create_process()
1514 err = kfd_event_init_process(process); in create_process()
1517 process->is_32bit_user_mode = in_compat_syscall(); in create_process()
1518 process->debug_trap_enabled = false; in create_process()
1519 process->debugger_process = NULL; in create_process()
1520 process->exception_enable_mask = 0; in create_process()
1521 atomic_set(&process->debugged_process_count, 0); in create_process()
1522 sema_init(&process->runtime_enable_sema, 0); in create_process()
1524 process->pasid = kfd_pasid_alloc(); in create_process()
1525 if (process->pasid == 0) { in create_process()
1530 err = pqm_init(&process->pqm, process); in create_process()
1534 /* init process apertures*/ in create_process()
1535 err = kfd_init_apertures(process); in create_process()
1540 process->xnack_enabled = kfd_process_xnack_mode(process, false); in create_process()
1542 err = svm_range_list_init(process); in create_process()
1546 /* alloc_notifier needs to find the process in the hash table */ in create_process()
1547 hash_add_rcu(kfd_processes_table, &process->kfd_processes, in create_process()
1548 (uintptr_t)process->mm); in create_process()
1553 kref_get(&process->ref); in create_process()
1556 * because after this point we cannot unwind the process creation. in create_process()
1558 * dropping the last process reference in the free_notifier. in create_process()
1560 mn = mmu_notifier_get(&kfd_process_mmu_notifier_ops, process->mm); in create_process()
1565 BUG_ON(mn != &process->mmu_notifier); in create_process()
1567 kfd_unref_process(process); in create_process()
1568 get_task_struct(process->lead_thread); in create_process()
1570 INIT_WORK(&process->debug_event_workarea, debug_event_write_work_handler); in create_process()
1572 return process; in create_process()
1575 hash_del_rcu(&process->kfd_processes); in create_process()
1576 svm_range_list_fini(process); in create_process()
1578 kfd_process_free_outstanding_kfd_bos(process); in create_process()
1579 kfd_process_destroy_pdds(process); in create_process()
1581 pqm_uninit(&process->pqm); in create_process()
1583 kfd_pasid_free(process->pasid); in create_process()
1585 kfd_event_free_process(process); in create_process()
1587 mutex_destroy(&process->mutex); in create_process()
1588 kfree(process); in create_process()
1624 pdd->process = p; in kfd_create_process_device_data()
1642 "failed to allocate process context bo\n"); in kfd_create_process_device_data()
1666 * kfd_process_device_init_vm - Initialize a VM for a process-device
1668 * @pdd: The process-device
1700 p = pdd->process; in kfd_process_device_init_vm()
1707 dev_err(dev->adev->dev, "Failed to create process VM object\n"); in kfd_process_device_init_vm()
1743 * Direct the IOMMU to bind the process (specifically the pasid->mm)
1745 * Unbinding occurs when the process dies or the device is removed.
1747 * Assumes that the process lock is held.
1757 dev_err(dev->adev->dev, "Process device data doesn't exist\n"); in kfd_bind_process_to_device()
1786 /* Create specific handle mapped to mem from process local memory idr
1787 * Assumes that the process lock is held.
1795 /* Translate specific handle from process local memory idr
1796 * Assumes that the process lock is held.
1807 /* Remove specific handle from process local memory idr
1808 * Assumes that the process lock is held.
1817 /* This increments the process->ref counter. */
1838 /* This increments the process->ref counter. */
1854 /* kfd_process_evict_queues - Evict all user queues of a process
1856 * Eviction is reference-counted per process-device. This means multiple
1879 dev_err(dev, "Failed to evict process queues\n"); in kfd_process_evict_queues()
1912 /* kfd_process_restore_queues - Restore all user queues of a process */
1927 dev_err(dev, "Failed to restore process queues\n"); in kfd_process_restore_queues()
1986 /* Process termination destroys this worker thread. So during the in evict_process_worker()
2037 /* Process termination destroys this worker thread. So during the in restore_process_worker()
2045 * before KFD BOs are unreserved. If not, the process can be evicted in restore_process_worker()
2074 pr_err("Failed to suspend process 0x%x\n", p->pasid); in kfd_suspend_all_processes()
2088 pr_err("Restore process %d failed during resume\n", in kfd_resume_all_processes()
2097 int kfd_reserved_mem_mmap(struct kfd_node *dev, struct kfd_process *process, in kfd_reserved_mem_mmap() argument
2108 pdd = kfd_get_process_device_data(dev, process); in kfd_reserved_mem_mmap()
2117 "Error allocating per process CWSR buffer.\n"); in kfd_reserved_mem_mmap()
2123 /* Mapping pages to user process */ in kfd_reserved_mem_mmap()
2129 /* assumes caller holds process lock. */
2139 pdd->process->irq_drain_is_open = true; in kfd_process_drain_interrupts()
2144 irq_drain_fence[3] = pdd->process->pasid; in kfd_process_drain_interrupts()
2158 pdd->process->irq_drain_is_open = false; in kfd_process_drain_interrupts()
2162 r = wait_event_interruptible(pdd->process->wait_irq_drain, in kfd_process_drain_interrupts()
2163 !READ_ONCE(pdd->process->irq_drain_is_open)); in kfd_process_drain_interrupts()
2165 pdd->process->irq_drain_is_open = false; in kfd_process_drain_interrupts()
2295 seq_printf(m, "Process %d PASID 0x%x:\n", in kfd_debugfs_mqds_by_process()