Commit eed41975 authored by Tao Zhou's avatar Tao Zhou Committed by Alex Deucher
Browse files

drm/amdkfd: refine event_interrupt_poison_consumption



Combine reading and setting poison flag as one atomic operation
and add print message for the function.

Signed-off-by: default avatarTao Zhou <tao.zhou1@amd.com>
Reviewed-by: default avatarHawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: default avatarFelix Kuehling <Felix.Kuehling@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent c5b26681
Loading
Loading
Loading
Loading
+5 −6
Original line number Diff line number Diff line
@@ -93,20 +93,19 @@ enum SQ_INTERRUPT_ERROR_TYPE {
static void event_interrupt_poison_consumption(struct kfd_dev *dev,
				uint16_t pasid, uint16_t source_id)
{
	int ret = -EINVAL;
	int old_poison, ret = -EINVAL;
	struct kfd_process *p = kfd_lookup_process_by_pasid(pasid);

	if (!p)
		return;

	/* all queues of a process will be unmapped in one time */
	if (atomic_read(&p->poison)) {
	old_poison = atomic_cmpxchg(&p->poison, 0, 1);
	kfd_unref_process(p);
	if (old_poison)
		return;
	}

	atomic_set(&p->poison, 1);
	kfd_unref_process(p);
	pr_warn("RAS poison consumption handling\n");

	switch (source_id) {
	case SOC15_INTSRC_SQ_INTERRUPT_MSG: