Lines Matching full:process
56 /* For process termination handling */
182 mm = get_task_mm(pdd->process->lead_thread); in kfd_sdma_activity_worker()
253 * by current process. Translates acquired wave count into number of compute units
279 proc = pdd->process; in kfd_get_cu_occupancy()
281 pr_debug("Gpu-Id: %d has no active queues for process %d\n", in kfd_get_cu_occupancy()
496 if (!q || !q->process) in kfd_procfs_add_queue()
498 proc = q->process; in kfd_procfs_add_queue()
697 /* kfd_process_alloc_gpuvm - Allocate GPU VM for the KFD process
698 * This function should be only called right after the process
729 * will take care of the bo removal when the process finishes. in kfd_process_alloc_gpuvm()
730 * We do not need to take p->mutex, because the process is just in kfd_process_alloc_gpuvm()
767 * process for IB usage The memory reserved is for KFD to submit
798 struct kfd_process *process; in kfd_create_process() local
810 * take kfd processes mutex before starting of process creation in kfd_create_process()
811 * so there won't be a case where two threads of the same process in kfd_create_process()
816 /* A prior open of /dev/kfd could have already created the process. */ in kfd_create_process()
817 process = find_process(thread); in kfd_create_process()
818 if (process) { in kfd_create_process()
819 pr_debug("Process already found\n"); in kfd_create_process()
821 process = create_process(thread); in kfd_create_process()
822 if (IS_ERR(process)) in kfd_create_process()
825 ret = kfd_process_init_cwsr_apu(process, filep); in kfd_create_process()
832 process->kobj = kfd_alloc_struct(process->kobj); in kfd_create_process()
833 if (!process->kobj) { in kfd_create_process()
837 ret = kobject_init_and_add(process->kobj, &procfs_type, in kfd_create_process()
839 (int)process->lead_thread->pid); in kfd_create_process()
842 kobject_put(process->kobj); in kfd_create_process()
846 kfd_sysfs_create_file(process->kobj, &process->attr_pasid, in kfd_create_process()
849 process->kobj_queues = kobject_create_and_add("queues", in kfd_create_process()
850 process->kobj); in kfd_create_process()
851 if (!process->kobj_queues) in kfd_create_process()
854 kfd_procfs_add_sysfs_stats(process); in kfd_create_process()
855 kfd_procfs_add_sysfs_files(process); in kfd_create_process()
856 kfd_procfs_add_sysfs_counters(process); in kfd_create_process()
859 if (!IS_ERR(process)) in kfd_create_process()
860 kref_get(&process->ref); in kfd_create_process()
863 return process; in kfd_create_process()
866 hash_del_rcu(&process->kfd_processes); in kfd_create_process()
870 mmu_notifier_put(&process->mmu_notifier); in kfd_create_process()
876 struct kfd_process *process; in kfd_get_process() local
885 process = find_process(thread); in kfd_get_process()
886 if (!process) in kfd_get_process()
889 return process; in kfd_get_process()
894 struct kfd_process *process; in find_process_by_mm() local
896 hash_for_each_possible_rcu(kfd_processes_table, process, in find_process_by_mm()
898 if (process->mm == mm) in find_process_by_mm()
899 return process; in find_process_by_mm()
924 struct kfd_process *p = pdd->process; in kfd_process_device_free_bos()
965 pr_debug("Releasing pdd (topology id %d) for process (pasid 0x%x)\n", in kfd_process_destroy_pdds()
1043 /* No process locking is needed in this function, because the process
1045 * using it any more, otherwise we couldn't safely free the process
1119 /* Iterate over all process device data structures and if the in kfd_process_notifier_release()
1254 * XNACK mode for this process that's compatible with all GPUs. in kfd_process_xnack_mode()
1272 * per-process XNACK mode selection. But let the dev->noretry in kfd_process_xnack_mode()
1300 struct kfd_process *process; in create_process() local
1304 process = kzalloc(sizeof(*process), GFP_KERNEL); in create_process()
1305 if (!process) in create_process()
1308 kref_init(&process->ref); in create_process()
1309 mutex_init(&process->mutex); in create_process()
1310 process->mm = thread->mm; in create_process()
1311 process->lead_thread = thread->group_leader; in create_process()
1312 process->n_pdds = 0; in create_process()
1313 INIT_DELAYED_WORK(&process->eviction_work, evict_process_worker); in create_process()
1314 INIT_DELAYED_WORK(&process->restore_work, restore_process_worker); in create_process()
1315 process->last_restore_timestamp = get_jiffies_64(); in create_process()
1316 kfd_event_init_process(process); in create_process()
1317 process->is_32bit_user_mode = in_compat_syscall(); in create_process()
1319 process->pasid = kfd_pasid_alloc(); in create_process()
1320 if (process->pasid == 0) in create_process()
1323 err = pqm_init(&process->pqm, process); in create_process()
1327 /* init process apertures*/ in create_process()
1328 err = kfd_init_apertures(process); in create_process()
1333 process->xnack_enabled = kfd_process_xnack_mode(process, false); in create_process()
1335 err = svm_range_list_init(process); in create_process()
1339 /* alloc_notifier needs to find the process in the hash table */ in create_process()
1340 hash_add_rcu(kfd_processes_table, &process->kfd_processes, in create_process()
1341 (uintptr_t)process->mm); in create_process()
1344 * because after this point we cannot unwind the process creation. in create_process()
1346 * dropping the last process reference in the free_notifier. in create_process()
1348 mn = mmu_notifier_get(&kfd_process_mmu_notifier_ops, process->mm); in create_process()
1353 BUG_ON(mn != &process->mmu_notifier); in create_process()
1355 get_task_struct(process->lead_thread); in create_process()
1357 return process; in create_process()
1360 hash_del_rcu(&process->kfd_processes); in create_process()
1361 svm_range_list_fini(process); in create_process()
1363 kfd_process_free_outstanding_kfd_bos(process); in create_process()
1364 kfd_process_destroy_pdds(process); in create_process()
1366 pqm_uninit(&process->pqm); in create_process()
1368 kfd_pasid_free(process->pasid); in create_process()
1370 mutex_destroy(&process->mutex); in create_process()
1371 kfree(process); in create_process()
1438 pr_err("Failed to init doorbell for process\n"); in kfd_create_process_device_data()
1449 pdd->process = p; in kfd_create_process_device_data()
1469 * kfd_process_device_init_vm - Initialize a VM for a process-device
1471 * @pdd: The process-device
1495 p = pdd->process; in kfd_process_device_init_vm()
1502 pr_err("Failed to create process VM object\n"); in kfd_process_device_init_vm()
1527 * Direct the IOMMU to bind the process (specifically the pasid->mm)
1529 * Unbinding occurs when the process dies or the device is removed.
1531 * Assumes that the process lock is held.
1541 pr_err("Process device data doesn't exist\n"); in kfd_bind_process_to_device()
1583 /* Create specific handle mapped to mem from process local memory idr
1584 * Assumes that the process lock is held.
1592 /* Translate specific handle from process local memory idr
1593 * Assumes that the process lock is held.
1604 /* Remove specific handle from process local memory idr
1605 * Assumes that the process lock is held.
1614 /* This increments the process->ref counter. */
1635 /* This increments the process->ref counter. */
1651 /* kfd_process_evict_queues - Evict all user queues of a process
1653 * Eviction is reference-counted per process-device. This means multiple
1668 pr_err("Failed to evict process queues\n"); in kfd_process_evict_queues()
1695 /* kfd_process_restore_queues - Restore all user queues of a process */
1707 pr_err("Failed to restore process queues\n"); in kfd_process_restore_queues()
1750 /* Process termination destroys this worker thread. So during the in evict_process_worker()
1787 /* Process termination destroys this worker thread. So during the in restore_process_worker()
1795 * before KFD BOs are unreserved. If not, the process can be evicted in restore_process_worker()
1834 pr_err("Failed to suspend process 0x%x\n", p->pasid); in kfd_suspend_all_processes()
1850 pr_err("Restore process %d failed during resume\n", in kfd_resume_all_processes()
1859 int kfd_reserved_mem_mmap(struct kfd_dev *dev, struct kfd_process *process, in kfd_reserved_mem_mmap() argument
1870 pdd = kfd_get_process_device_data(dev, process); in kfd_reserved_mem_mmap()
1878 pr_err("Error allocating per process CWSR buffer.\n"); in kfd_reserved_mem_mmap()
1884 /* Mapping pages to user process */ in kfd_reserved_mem_mmap()
1903 pdd->process->pasid, type); in kfd_flush_tlb()
1918 seq_printf(m, "Process %d PASID 0x%x:\n", in kfd_debugfs_mqds_by_process()