Lines Matching full:process
55 /* For process termination handling */
183 mm = get_task_mm(pdd->process->lead_thread); in kfd_sdma_activity_worker()
254 * 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()
469 if (!q || !q->process) in kfd_procfs_add_queue()
471 proc = q->process; in kfd_procfs_add_queue()
651 /* kfd_process_alloc_gpuvm - Allocate GPU VM for the KFD process
652 * This function should be only called right after the process
682 * will take care of the bo removal when the process finishes. in kfd_process_alloc_gpuvm()
683 * We do not need to take p->mutex, because the process is just in kfd_process_alloc_gpuvm()
719 * process for IB usage The memory reserved is for KFD to submit
750 struct kfd_process *process; in kfd_create_process() local
762 * take kfd processes mutex before starting of process creation in kfd_create_process()
763 * so there won't be a case where two threads of the same process in kfd_create_process()
768 /* A prior open of /dev/kfd could have already created the process. */ in kfd_create_process()
769 process = find_process(thread); in kfd_create_process()
770 if (process) { in kfd_create_process()
771 pr_debug("Process already found\n"); in kfd_create_process()
773 process = create_process(thread); in kfd_create_process()
774 if (IS_ERR(process)) in kfd_create_process()
777 ret = kfd_process_init_cwsr_apu(process, filep); in kfd_create_process()
779 process = ERR_PTR(ret); in kfd_create_process()
786 process->kobj = kfd_alloc_struct(process->kobj); in kfd_create_process()
787 if (!process->kobj) { in kfd_create_process()
791 ret = kobject_init_and_add(process->kobj, &procfs_type, in kfd_create_process()
793 (int)process->lead_thread->pid); in kfd_create_process()
796 kobject_put(process->kobj); in kfd_create_process()
800 process->attr_pasid.name = "pasid"; in kfd_create_process()
801 process->attr_pasid.mode = KFD_SYSFS_FILE_MODE; in kfd_create_process()
802 sysfs_attr_init(&process->attr_pasid); in kfd_create_process()
803 ret = sysfs_create_file(process->kobj, &process->attr_pasid); in kfd_create_process()
806 (int)process->lead_thread->pid); in kfd_create_process()
808 process->kobj_queues = kobject_create_and_add("queues", in kfd_create_process()
809 process->kobj); in kfd_create_process()
810 if (!process->kobj_queues) in kfd_create_process()
813 ret = kfd_procfs_add_sysfs_stats(process); in kfd_create_process()
816 (int)process->lead_thread->pid); in kfd_create_process()
818 ret = kfd_procfs_add_sysfs_files(process); in kfd_create_process()
821 (int)process->lead_thread->pid); in kfd_create_process()
824 if (!IS_ERR(process)) in kfd_create_process()
825 kref_get(&process->ref); in kfd_create_process()
828 return process; in kfd_create_process()
833 struct kfd_process *process; in kfd_get_process() local
842 process = find_process(thread); in kfd_get_process()
843 if (!process) in kfd_get_process()
846 return process; in kfd_get_process()
851 struct kfd_process *process; in find_process_by_mm() local
853 hash_for_each_possible_rcu(kfd_processes_table, process, in find_process_by_mm()
855 if (process->mm == mm) in find_process_by_mm()
856 return process; in find_process_by_mm()
880 struct kfd_process *p = pdd->process; in kfd_process_device_free_bos()
918 pr_debug("Releasing pdd (topology id %d) for process (pasid 0x%x)\n", in kfd_process_destroy_pdds()
955 /* No process locking is needed in this function, because the process
957 * using it any more, otherwise we couldn't safely free the process
1043 /* Iterate over all process device data structures and if the in kfd_process_notifier_release()
1154 struct kfd_process *process; in create_process() local
1157 process = kzalloc(sizeof(*process), GFP_KERNEL); in create_process()
1158 if (!process) in create_process()
1161 kref_init(&process->ref); in create_process()
1162 mutex_init(&process->mutex); in create_process()
1163 process->mm = thread->mm; in create_process()
1164 process->lead_thread = thread->group_leader; in create_process()
1165 INIT_LIST_HEAD(&process->per_device_data); in create_process()
1166 INIT_DELAYED_WORK(&process->eviction_work, evict_process_worker); in create_process()
1167 INIT_DELAYED_WORK(&process->restore_work, restore_process_worker); in create_process()
1168 process->last_restore_timestamp = get_jiffies_64(); in create_process()
1169 kfd_event_init_process(process); in create_process()
1170 process->is_32bit_user_mode = in_compat_syscall(); in create_process()
1172 process->pasid = kfd_pasid_alloc(); in create_process()
1173 if (process->pasid == 0) in create_process()
1176 err = pqm_init(&process->pqm, process); in create_process()
1180 /* init process apertures*/ in create_process()
1181 err = kfd_init_apertures(process); in create_process()
1186 process->mmu_notifier.ops = &kfd_process_mmu_notifier_ops; in create_process()
1187 err = mmu_notifier_register(&process->mmu_notifier, process->mm); in create_process()
1191 get_task_struct(process->lead_thread); in create_process()
1192 hash_add_rcu(kfd_processes_table, &process->kfd_processes, in create_process()
1193 (uintptr_t)process->mm); in create_process()
1195 return process; in create_process()
1198 kfd_process_free_outstanding_kfd_bos(process); in create_process()
1199 kfd_process_destroy_pdds(process); in create_process()
1201 pqm_uninit(&process->pqm); in create_process()
1203 kfd_pasid_free(process->pasid); in create_process()
1205 mutex_destroy(&process->mutex); in create_process()
1206 kfree(process); in create_process()
1271 pr_err("Failed to init doorbell for process\n"); in kfd_create_process_device_data()
1282 pdd->process = p; in kfd_create_process_device_data()
1302 * kfd_process_device_init_vm - Initialize a VM for a process-device
1304 * @pdd: The process-device
1325 p = pdd->process; in kfd_process_device_init_vm()
1336 pr_err("Failed to create process VM object\n"); in kfd_process_device_init_vm()
1364 * Direct the IOMMU to bind the process (specifically the pasid->mm)
1366 * Unbinding occurs when the process dies or the device is removed.
1368 * Assumes that the process lock is held.
1378 pr_err("Process device data doesn't exist\n"); in kfd_bind_process_to_device()
1443 /* Create specific handle mapped to mem from process local memory idr
1444 * Assumes that the process lock is held.
1452 /* Translate specific handle from process local memory idr
1453 * Assumes that the process lock is held.
1464 /* Remove specific handle from process local memory idr
1465 * Assumes that the process lock is held.
1474 /* This increments the process->ref counter. */
1495 /* This increments the process->ref counter. */
1511 /* kfd_process_evict_queues - Evict all user queues of a process
1513 * Eviction is reference-counted per process-device. This means multiple
1526 pr_err("Failed to evict process queues\n"); in kfd_process_evict_queues()
1551 /* kfd_process_restore_queues - Restore all user queues of a process */
1561 pr_err("Failed to restore process queues\n"); in kfd_process_restore_queues()
1578 /* Process termination destroys this worker thread. So during the in evict_process_worker()
1615 /* Process termination destroys this worker thread. So during the in restore_process_worker()
1623 * before KFD BOs are unreserved. If not, the process can be evicted in restore_process_worker()
1662 pr_err("Failed to suspend process 0x%x\n", p->pasid); in kfd_suspend_all_processes()
1678 pr_err("Restore process %d failed during resume\n", in kfd_resume_all_processes()
1687 int kfd_reserved_mem_mmap(struct kfd_dev *dev, struct kfd_process *process, in kfd_reserved_mem_mmap() argument
1698 pdd = kfd_get_process_device_data(dev, process); in kfd_reserved_mem_mmap()
1706 pr_err("Error allocating per process CWSR buffer.\n"); in kfd_reserved_mem_mmap()
1712 /* Mapping pages to user process */ in kfd_reserved_mem_mmap()
1731 pdd->process->pasid); in kfd_flush_tlb()
1746 seq_printf(m, "Process %d PASID 0x%x:\n", in kfd_debugfs_mqds_by_process()