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()
704 /* kfd_process_alloc_gpuvm - Allocate GPU VM for the KFD process
705 * This function should be only called right after the process
758 * process for IB usage The memory reserved is for KFD to submit
801 struct kfd_process *process; in kfd_create_process() local
814 * take kfd processes mutex before starting of process creation in kfd_create_process()
815 * so there won't be a case where two threads of the same process in kfd_create_process()
822 pr_debug("KFD is locked! Cannot create process"); in kfd_create_process()
826 /* A prior open of /dev/kfd could have already created the process. */ in kfd_create_process()
827 process = find_process(thread, false); in kfd_create_process()
828 if (process) { in kfd_create_process()
829 pr_debug("Process already found\n"); in kfd_create_process()
831 process = create_process(thread); in kfd_create_process()
832 if (IS_ERR(process)) in kfd_create_process()
838 process->kobj = kfd_alloc_struct(process->kobj); in kfd_create_process()
839 if (!process->kobj) { in kfd_create_process()
843 ret = kobject_init_and_add(process->kobj, &procfs_type, in kfd_create_process()
845 (int)process->lead_thread->pid); in kfd_create_process()
848 kobject_put(process->kobj); in kfd_create_process()
852 kfd_sysfs_create_file(process->kobj, &process->attr_pasid, in kfd_create_process()
855 process->kobj_queues = kobject_create_and_add("queues", in kfd_create_process()
856 process->kobj); in kfd_create_process()
857 if (!process->kobj_queues) in kfd_create_process()
860 kfd_procfs_add_sysfs_stats(process); in kfd_create_process()
861 kfd_procfs_add_sysfs_files(process); in kfd_create_process()
862 kfd_procfs_add_sysfs_counters(process); in kfd_create_process()
864 init_waitqueue_head(&process->wait_irq_drain); in kfd_create_process()
867 if (!IS_ERR(process)) in kfd_create_process()
868 kref_get(&process->ref); in kfd_create_process()
872 return process; in kfd_create_process()
877 struct kfd_process *process; in kfd_get_process() local
886 process = find_process(thread, false); in kfd_get_process()
887 if (!process) in kfd_get_process()
890 return process; in kfd_get_process()
895 struct kfd_process *process; in find_process_by_mm() local
897 hash_for_each_possible_rcu(kfd_processes_table, process, in find_process_by_mm()
899 if (process->mm == mm) in find_process_by_mm()
900 return process; in find_process_by_mm()
925 /* This increments the process->ref counter. */
948 struct kfd_process *p = pdd->process; in kfd_process_device_free_bos()
1020 pr_debug("Releasing pdd (topology id %d) for process (pasid 0x%x)\n", in kfd_process_destroy_pdds()
1103 /* No process locking is needed in this function, because the process
1105 * using it any more, otherwise we couldn't safely free the process
1256 * Move all remaining kfd_process from the process table to a in kfd_cleanup_processes()
1349 pdd->process->debug_trap_enabled); in kfd_process_device_init_cwsr_dgpu()
1398 * XNACK mode for this process that's compatible with all GPUs. in kfd_process_xnack_mode()
1416 * per-process XNACK mode selection. But let the dev->noretry in kfd_process_xnack_mode()
1453 struct kfd_process *process; in create_process() local
1457 process = kzalloc(sizeof(*process), GFP_KERNEL); in create_process()
1458 if (!process) in create_process()
1461 kref_init(&process->ref); in create_process()
1462 mutex_init(&process->mutex); in create_process()
1463 process->mm = thread->mm; in create_process()
1464 process->lead_thread = thread->group_leader; in create_process()
1465 process->n_pdds = 0; in create_process()
1466 process->queues_paused = false; in create_process()
1467 INIT_DELAYED_WORK(&process->eviction_work, evict_process_worker); in create_process()
1468 INIT_DELAYED_WORK(&process->restore_work, restore_process_worker); in create_process()
1469 process->last_restore_timestamp = get_jiffies_64(); in create_process()
1470 err = kfd_event_init_process(process); in create_process()
1473 process->is_32bit_user_mode = in_compat_syscall(); in create_process()
1474 process->debug_trap_enabled = false; in create_process()
1475 process->debugger_process = NULL; in create_process()
1476 process->exception_enable_mask = 0; in create_process()
1477 atomic_set(&process->debugged_process_count, 0); in create_process()
1478 sema_init(&process->runtime_enable_sema, 0); in create_process()
1480 process->pasid = kfd_pasid_alloc(); in create_process()
1481 if (process->pasid == 0) { in create_process()
1486 err = pqm_init(&process->pqm, process); in create_process()
1490 /* init process apertures*/ in create_process()
1491 err = kfd_init_apertures(process); in create_process()
1496 process->xnack_enabled = kfd_process_xnack_mode(process, false); in create_process()
1498 err = svm_range_list_init(process); in create_process()
1502 /* alloc_notifier needs to find the process in the hash table */ in create_process()
1503 hash_add_rcu(kfd_processes_table, &process->kfd_processes, in create_process()
1504 (uintptr_t)process->mm); in create_process()
1509 kref_get(&process->ref); in create_process()
1512 * because after this point we cannot unwind the process creation. in create_process()
1514 * dropping the last process reference in the free_notifier. in create_process()
1516 mn = mmu_notifier_get(&kfd_process_mmu_notifier_ops, process->mm); in create_process()
1521 BUG_ON(mn != &process->mmu_notifier); in create_process()
1523 kfd_unref_process(process); in create_process()
1524 get_task_struct(process->lead_thread); in create_process()
1526 INIT_WORK(&process->debug_event_workarea, debug_event_write_work_handler); in create_process()
1528 return process; in create_process()
1531 hash_del_rcu(&process->kfd_processes); in create_process()
1532 svm_range_list_fini(process); in create_process()
1534 kfd_process_free_outstanding_kfd_bos(process); in create_process()
1535 kfd_process_destroy_pdds(process); in create_process()
1537 pqm_uninit(&process->pqm); in create_process()
1539 kfd_pasid_free(process->pasid); in create_process()
1541 kfd_event_free_process(process); in create_process()
1543 mutex_destroy(&process->mutex); in create_process()
1544 kfree(process); in create_process()
1580 pdd->process = p; in kfd_create_process_device_data()
1597 pr_err("failed to allocate process context bo\n"); in kfd_create_process_device_data()
1621 * kfd_process_device_init_vm - Initialize a VM for a process-device
1623 * @pdd: The process-device
1654 p = pdd->process; in kfd_process_device_init_vm()
1661 pr_err("Failed to create process VM object\n"); in kfd_process_device_init_vm()
1694 * Direct the IOMMU to bind the process (specifically the pasid->mm)
1696 * Unbinding occurs when the process dies or the device is removed.
1698 * Assumes that the process lock is held.
1708 pr_err("Process device data doesn't exist\n"); in kfd_bind_process_to_device()
1737 /* Create specific handle mapped to mem from process local memory idr
1738 * Assumes that the process lock is held.
1746 /* Translate specific handle from process local memory idr
1747 * Assumes that the process lock is held.
1758 /* Remove specific handle from process local memory idr
1759 * Assumes that the process lock is held.
1768 /* This increments the process->ref counter. */
1789 /* This increments the process->ref counter. */
1805 /* kfd_process_evict_queues - Evict all user queues of a process
1807 * Eviction is reference-counted per process-device. This means multiple
1829 pr_err("Failed to evict process queues\n"); in kfd_process_evict_queues()
1859 /* kfd_process_restore_queues - Restore all user queues of a process */
1873 pr_err("Failed to restore process queues\n"); in kfd_process_restore_queues()
1915 /* Process termination destroys this worker thread. So during the in evict_process_worker()
1952 /* Process termination destroys this worker thread. So during the in restore_process_worker()
1960 * before KFD BOs are unreserved. If not, the process can be evicted in restore_process_worker()
2001 pr_err("Failed to suspend process 0x%x\n", p->pasid); in kfd_suspend_all_processes()
2017 pr_err("Restore process %d failed during resume\n", in kfd_resume_all_processes()
2026 int kfd_reserved_mem_mmap(struct kfd_node *dev, struct kfd_process *process, in kfd_reserved_mem_mmap() argument
2037 pdd = kfd_get_process_device_data(dev, process); in kfd_reserved_mem_mmap()
2045 pr_err("Error allocating per process CWSR buffer.\n"); in kfd_reserved_mem_mmap()
2051 /* Mapping pages to user process */ in kfd_reserved_mem_mmap()
2083 dev->adev, pdd->process->pasid, type, xcc); in kfd_flush_tlb()
2087 /* assumes caller holds process lock. */
2097 pdd->process->irq_drain_is_open = true; in kfd_process_drain_interrupts()
2102 irq_drain_fence[3] = pdd->process->pasid; in kfd_process_drain_interrupts()
2115 pdd->process->irq_drain_is_open = false; in kfd_process_drain_interrupts()
2119 r = wait_event_interruptible(pdd->process->wait_irq_drain, in kfd_process_drain_interrupts()
2120 !READ_ONCE(pdd->process->irq_drain_is_open)); in kfd_process_drain_interrupts()
2122 pdd->process->irq_drain_is_open = false; in kfd_process_drain_interrupts()
2252 seq_printf(m, "Process %d PASID 0x%x:\n", in kfd_debugfs_mqds_by_process()