Lines Matching +full:trigger +full:- +full:address

1 // SPDX-License-Identifier: GPL-2.0 OR MIT
3 * Copyright 2020-2022 Advanced Micro Devices, Inc.
68 struct kfd_smi_client *client = filep->private_data; in kfd_smi_ev_poll()
71 poll_wait(filep, &client->wait_queue, wait); in kfd_smi_ev_poll()
73 spin_lock(&client->lock); in kfd_smi_ev_poll()
74 if (!kfifo_is_empty(&client->fifo)) in kfd_smi_ev_poll()
76 spin_unlock(&client->lock); in kfd_smi_ev_poll()
86 struct kfd_smi_client *client = filep->private_data; in kfd_smi_ev_read()
92 return -ENOMEM; in kfd_smi_ev_read()
97 spin_lock(&client->lock); in kfd_smi_ev_read()
98 to_copy = kfifo_len(&client->fifo); in kfd_smi_ev_read()
100 spin_unlock(&client->lock); in kfd_smi_ev_read()
101 ret = -EAGAIN; in kfd_smi_ev_read()
105 ret = kfifo_out(&client->fifo, buf, to_copy); in kfd_smi_ev_read()
106 spin_unlock(&client->lock); in kfd_smi_ev_read()
108 ret = -EAGAIN; in kfd_smi_ev_read()
114 ret = -EFAULT; in kfd_smi_ev_read()
129 struct kfd_smi_client *client = filep->private_data; in kfd_smi_ev_write()
133 return -EFAULT; in kfd_smi_ev_write()
135 return -EFAULT; in kfd_smi_ev_write()
137 WRITE_ONCE(client->events, events); in kfd_smi_ev_write()
146 kfifo_free(&ev->fifo); in kfd_smi_ev_client_free()
152 struct kfd_smi_client *client = filep->private_data; in kfd_smi_ev_release()
153 struct kfd_node *dev = client->dev; in kfd_smi_ev_release()
155 spin_lock(&dev->smi_lock); in kfd_smi_ev_release()
156 list_del_rcu(&client->list); in kfd_smi_ev_release()
157 spin_unlock(&dev->smi_lock); in kfd_smi_ev_release()
159 call_rcu(&client->rcu, kfd_smi_ev_client_free); in kfd_smi_ev_release()
167 uint64_t events = READ_ONCE(client->events); in kfd_smi_ev_enabled()
169 if (pid && client->pid != pid && !(client->suser && (events & all))) in kfd_smi_ev_enabled()
182 list_for_each_entry_rcu(client, &dev->smi_clients, list) { in add_event_to_kfifo()
185 spin_lock(&client->lock); in add_event_to_kfifo()
186 if (kfifo_avail(&client->fifo) >= len) { in add_event_to_kfifo()
187 kfifo_in(&client->fifo, event_msg, len); in add_event_to_kfifo()
188 wake_up_all(&client->wait_queue); in add_event_to_kfifo()
193 spin_unlock(&client->lock); in add_event_to_kfifo()
207 if (list_empty(&dev->smi_clients)) in kfd_smi_event_add()
213 len += vsnprintf(fifo_in + len, sizeof(fifo_in) - len, fmt, args); in kfd_smi_event_add()
229 ++(dev->reset_seq_num); in kfd_smi_event_update_gpu_reset()
239 dev->reset_seq_num, reset_cause)); in kfd_smi_event_update_gpu_reset()
247 amdgpu_dpm_get_thermal_throttling_counter(dev->adev))); in kfd_smi_event_update_thermal_throttling()
254 task_info = amdgpu_vm_get_task_info_pasid(dev->adev, pasid); in kfd_smi_event_update_vmfault()
257 if (task_info->pid) in kfd_smi_event_update_vmfault()
259 task_info->pid, task_info->task_name)); in kfd_smi_event_update_vmfault()
265 unsigned long address, bool write_fault, in kfd_smi_event_page_fault_start() argument
270 address, node->id, write_fault ? 'W' : 'R')); in kfd_smi_event_page_fault_start()
274 unsigned long address, bool migration) in kfd_smi_event_page_fault_end() argument
278 pid, address, node->id, migration ? 'M' : 'U')); in kfd_smi_event_page_fault_end()
285 uint32_t trigger) in kfd_smi_event_migration_start() argument
289 ktime_get_boottime_ns(), pid, start, end - start, in kfd_smi_event_migration_start()
290 from, to, prefetch_loc, preferred_loc, trigger)); in kfd_smi_event_migration_start()
295 uint32_t from, uint32_t to, uint32_t trigger) in kfd_smi_event_migration_end() argument
299 ktime_get_boottime_ns(), pid, start, end - start, in kfd_smi_event_migration_end()
300 from, to, trigger)); in kfd_smi_event_migration_end()
304 uint32_t trigger) in kfd_smi_event_queue_eviction() argument
308 node->id, trigger)); in kfd_smi_event_queue_eviction()
315 node->id, 0)); in kfd_smi_event_queue_restore()
327 for (i = 0; i < p->n_pdds; i++) { in kfd_smi_event_queue_restore_rescheduled()
328 struct kfd_process_device *pdd = p->pdds[i]; in kfd_smi_event_queue_restore_rescheduled()
330 kfd_smi_event_add(p->lead_thread->pid, pdd->dev, in kfd_smi_event_queue_restore_rescheduled()
333 p->lead_thread->pid, pdd->dev->id, 'R')); in kfd_smi_event_queue_restore_rescheduled()
339 unsigned long address, unsigned long last, in kfd_smi_event_unmap_from_gpu() argument
340 uint32_t trigger) in kfd_smi_event_unmap_from_gpu() argument
344 pid, address, last - address + 1, node->id, trigger)); in kfd_smi_event_unmap_from_gpu()
354 return -ENOMEM; in kfd_smi_event_open()
355 INIT_LIST_HEAD(&client->list); in kfd_smi_event_open()
357 ret = kfifo_alloc(&client->fifo, MAX_KFIFO_SIZE, GFP_KERNEL); in kfd_smi_event_open()
363 init_waitqueue_head(&client->wait_queue); in kfd_smi_event_open()
364 spin_lock_init(&client->lock); in kfd_smi_event_open()
365 client->events = 0; in kfd_smi_event_open()
366 client->dev = dev; in kfd_smi_event_open()
367 client->pid = current->tgid; in kfd_smi_event_open()
368 client->suser = capable(CAP_SYS_ADMIN); in kfd_smi_event_open()
370 spin_lock(&dev->smi_lock); in kfd_smi_event_open()
371 list_add_rcu(&client->list, &dev->smi_clients); in kfd_smi_event_open()
372 spin_unlock(&dev->smi_lock); in kfd_smi_event_open()
377 spin_lock(&dev->smi_lock); in kfd_smi_event_open()
378 list_del_rcu(&client->list); in kfd_smi_event_open()
379 spin_unlock(&dev->smi_lock); in kfd_smi_event_open()
383 kfifo_free(&client->fifo); in kfd_smi_event_open()