Skip to contentSkip to conversation

(hopefully) improve error message upon incorrect pgraph irq

PATCH In review Maarten Maathuis 2 participants 3 messages Nov 6, 2008 – Nov 7, 2008 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 (hopefully) improve error message upon incorrect pgraph irq

My main question is, do the error messages accurately reflect the situation. Anything else wrong with this patch?

A (n)ack by darktama would be nice.

Maarten.

shared-core/nouveau_irq.c +18 -3
index 2a3d8a0..b84aa5e 100644
@@ -205,6 +205,12 @@ nouveau_graph_chid_from_grctx(struct drm_device *dev)
 	else
 		inst = NV_READ(0x40032c) & 0xfffff;
 
+	if (!inst) {
+		DRM_ERROR("PGRAPH instance is zero, probably caused a spurious interrupt.\n");
+		DRM_ERROR("A single occurance before allocating the first FIFO is not considered very harmful.\n");
+		return -1;
+	}
+
 	for (i = 0; i < dev_priv->Engine.fifo.channels; i++) {
 		struct nouveau_channel *chan = dev_priv->fifos[i];
 
@@ -220,6 +226,10 @@ nouveau_graph_chid_from_grctx(struct drm_device *dev)
 		}
 	}
 
+	/* No channel found, return -1 so we don't access memory out of bound. */
+	if (i == dev_priv->Engine.fifo.channels)
+		return -1;
+
 	return i;
 }
 
@@ -227,7 +237,6 @@ static int
 nouveau_graph_trapped_channel(struct drm_device *dev, int *channel_ret)
 {
 	struct drm_nouveau_private *dev_priv = dev->dev_private;
-	struct nouveau_engine *engine = &dev_priv->Engine;
 	int channel;
 
 	if (dev_priv->card_type < NV_10)
@@ -238,8 +247,14 @@ nouveau_graph_trapped_channel(struct drm_device *dev, int *channel_ret)
 	else
 		channel = nouveau_graph_chid_from_grctx(dev);
 
-	if (channel >= engine->fifo.channels || !dev_priv->fifos[channel]) {
-		DRM_ERROR("AIII, invalid/inactive channel id %d\n", channel);
+	if (channel == -1) {
+		DRM_ERROR("PGRAPH interrupt from unknown channel.\n");
+		return -EINVAL;
+	}
+
+	/* channel will never exceed 127. */
+	if (!dev_priv->fifos[channel]) {
+		DRM_ERROR("PGRAPH interrupt from inactive channel id %d\n", channel);
 		return -EINVAL;
 	}
 

_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): 6d4bc9fc0811061543g7ca8eb67j85068b611f0daf56-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#2 lore raw
Quoted 4 lines · Maarten Maathuis

My main question is, do the error messages accurately reflect the situation. Anything else wrong with this patch?

A (n)ack by darktama would be nice.

An instance value of zero can very well be valid, a definite NACK on that part of the patch. Also, the PGRAPH interrupt generated on nv5x while creating the first channel, that *is* a bug, things still work regardless but painting over it with a "not very harmful" message... Just, no.

While I don't see it entirely necessary to split the error message up when we come across a non-sane channel id, if it bothers you that much go for it, but the current message gives all the needed info already..

Ben.

Quoted 6 lines

Maarten.
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

#3 lore raw
Quoted 11 lines · Ben Skeggs
Quoted 4 lines · Maarten Maathuis

My main question is, do the error messages accurately reflect the situation. Anything else wrong with this patch?

A (n)ack by darktama would be nice.

An instance value of zero can very well be valid, a definite NACK on that part of the patch. Also, the PGRAPH interrupt generated on nv5x while creating the first channel, that *is* a bug, things still work regardless but painting over it with a "not very harmful" message... Just, no.

Quoted 13 lines

While I don't see it entirely necessary to split the error message up when we come across a non-sane channel id, if it bothers you that much go for it, but the current message gives all the needed info already..

Ben.

Quoted 6 lines

Maarten.
_______________________________________________
Nouveau mailing list [email protected]
http://lists.freedesktop.org/mailman/listinfo/nouveau

I'll have a deeper look into the strange irq's the blob gets at startup. Maybe i can find the answer there.

Maarten.