Skip to contentSkip to conversation

drm/amdkfd: use pasid to drop non KFD irqs for v11 for sq intr

PATCH In review Sunil Khatri 2 participants 3 messages Jun 18

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/amdkfd: use pasid to drop non KFD irqs for v11 for sq intr

With KGD userqueues the VMID's could overlap for userqueues and KFD queues and due to which SQ interrupts of KGD process are routed to KFD interrupt handlers.

To avoid Noise of SQ interrupt for KGD user queues use the pasid id's to identify the non KFD processes and return without any interrupt processing in WQ.

---
 drivers/gpu/drm/amd/amdkfd/kfd_int_process_v11.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_int_process_v11.c +9 -0
index 12d81abed748..72ffef331418 100644
@@ -307,6 +307,7 @@ static bool event_interrupt_isr_v11(struct kfd_node *dev,
 static void event_interrupt_wq_v11(struct kfd_node *dev,
 					const uint32_t *ih_ring_entry)
 {
+	struct kfd_process *p;
 	uint16_t source_id, client_id, ring_id, pasid, vmid;
 	uint32_t context_id0, context_id1;
 	uint8_t sq_int_enc, sq_int_priv, sq_int_errtype;
@@ -321,6 +322,14 @@ static void event_interrupt_wq_v11(struct kfd_node *dev,
 	context_id0 = SOC15_CONTEXT_ID0_FROM_IH_ENTRY(ih_ring_entry);
 	context_id1 = SOC15_CONTEXT_ID1_FROM_IH_ENTRY(ih_ring_entry);
 
+	if (source_id == SOC15_INTSRC_SQ_INTERRUPT_MSG) {
+		p = kfd_lookup_process_by_pasid(pasid, NULL);
+		if (!p)
+			return;
+
+		kfd_unref_process(p);
+	}
+
 	/* VMC, UTCL2 */
 	if (client_id == SOC21_IH_CLIENTID_VMC ||
 	     ((client_id == SOC21_IH_CLIENTID_GFX) &&
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 drm/amdkfd: use pasid to drop non KFD irqs in v12 for sq intr

With KGD userqueues the VMID's could overlap for userqueues and KFD queues and due to which SQ interrupts of KGD process are routed to KFD interrupt handlers.

To avoid Noise of SQ interrupt for KGD user queues use the pasid id's to identify the non KFD processes and return without any interrupt processing in WQ.

---
 drivers/gpu/drm/amd/amdkfd/kfd_int_process_v12_1.c | 9 +++++++++
 1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_int_process_v12_1.c +9 -0
index 0da7e1db55c9..e02f63c0c845 100644
@@ -296,6 +296,7 @@ static bool event_interrupt_isr_v12_1(struct kfd_node *node,
 static void event_interrupt_wq_v12_1(struct kfd_node *node,
 					const uint32_t *ih_ring_entry)
 {
+	struct kfd_process *p;
 	uint16_t source_id, client_id, ring_id, pasid, vmid;
 	uint32_t context_id0, context_id1;
 	uint8_t sq_int_enc, sq_int_priv, sq_int_errtype;
@@ -310,6 +311,14 @@ static void event_interrupt_wq_v12_1(struct kfd_node *node,
 	context_id0 = SOC15_CONTEXT_ID0_FROM_IH_ENTRY(ih_ring_entry);
 	context_id1 = SOC15_CONTEXT_ID1_FROM_IH_ENTRY(ih_ring_entry);
 
+	if (source_id == SOC15_INTSRC_SQ_INTERRUPT_MSG) {
+		p = kfd_lookup_process_by_pasid(pasid, NULL);
+		if (!p)
+			return;
+
+		kfd_unref_process(p);
+	}
+
 	/* VMC, UTCL2 */
 	if (client_id == SOC21_IH_CLIENTID_VMC ||
 	    client_id == SOC21_IH_CLIENTID_UTCL2) {
Signature · 1 line
2.34.1
maintainer
#2 lore raw

Re: [PATCH v1 2/2] drm/amdkfd: use pasid to drop non KFD irqs in v12 for sq intr

Quoted 9 lines · Sunil Khatri

With KGD userqueues the VMID's could overlap for userqueues and KFD queues and due to which SQ interrupts of KGD process are routed to KFD interrupt handlers.

To avoid Noise of SQ interrupt for KGD user queues use the pasid id's to identify the non KFD processes and return without any interrupt processing in WQ.

The patch series looks reasonable. But now every interrupt needs to look up the process from pasid twice. It's not very efficient because that lookup is currently a linear search. A bike-shedding suggestion:

Keep the kfd_process reference for the whole interrupt handling function and pass it to the different signaling functions instead of the pasid so they don't need to repeat the lookup.

Regards,
  Felix

Quoted 31 lines
---
  drivers/gpu/drm/amd/amdkfd/kfd_int_process_v12_1.c | 9 +++++++++
  1 file changed, 9 insertions(+)
drivers/gpu/drm/amd/amdkfd/kfd_int_process_v12_1.c +9 -0
index 0da7e1db55c9..e02f63c0c845 100644
@@ -296,6 +296,7 @@ static bool event_interrupt_isr_v12_1(struct kfd_node *node,
  static void event_interrupt_wq_v12_1(struct kfd_node *node,
  					const uint32_t *ih_ring_entry)
  {
+	struct kfd_process *p;
  	uint16_t source_id, client_id, ring_id, pasid, vmid;
  	uint32_t context_id0, context_id1;
  	uint8_t sq_int_enc, sq_int_priv, sq_int_errtype;
@@ -310,6 +311,14 @@ static void event_interrupt_wq_v12_1(struct kfd_node *node,
  	context_id0 = SOC15_CONTEXT_ID0_FROM_IH_ENTRY(ih_ring_entry);
  	context_id1 = SOC15_CONTEXT_ID1_FROM_IH_ENTRY(ih_ring_entry);
 
+	if (source_id == SOC15_INTSRC_SQ_INTERRUPT_MSG) {
+		p = kfd_lookup_process_by_pasid(pasid, NULL);
+		if (!p)
+			return;
+
+		kfd_unref_process(p);
+	}
+
  	/* VMC, UTCL2 */
  	if (client_id == SOC21_IH_CLIENTID_VMC ||
  	    client_id == SOC21_IH_CLIENTID_UTCL2) {