Skip to contentSkip to conversation

drm/i915: forcewake warning fixes in debugfs

PATCH Dieter Mummenschanz 2 participants 2 messages Oct 6, 2011 – Oct 8, 2011 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 201919764.351482.1317923658800.JavaMail.fmail@mwmweb004

#1 lore raw

Hello,

I also have the same problem and would like to try the patch. Where can I find the git source repository where I can get the latest development sources?

Regards
Dieter

Quoted 162 lines

-----Ursprüngliche Nachricht-----
Von: "Ben Widawsky" <[email protected]>
Gesendet: Oct 5, 2011 8:44:54 PM
An: [email protected]
Betreff: [PATCH] drm/i915: forcewake warning fixes in debugfs

Quoted 1 line

Some more unsafe debugfs access are fixed with this patch. I tested all

reads,

Quoted 5 lines

but didn't thoroughly test the writes.

---
drivers/gpu/drm/i915/i915_debugfs.c | 57

+++++++++++++++++++++++++++++++----

Review

Quoted 6 lines
1 files changed, 51 insertions(+), 6 deletions(-)

---
Can you please try this patch to see if it helps?

(quoted diff) +0 -0

b/drivers/gpu/drm/i915/i915_debugfs.c

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ringbuffer_info(struct seq_file *m,

Quoted 4 lines

index 3c395a5..de233df 100644

drivers/gpu/drm/i915/i915_debugfs.c +0 -0
@@ -635,11 +635,16 @@ static int i915_ringbuffer_info(struct seq_file *m,

void *data)

drivers/gpu/drm/i915/i915_debugfs.c static int i915_ringbuffer_info(struct seq_file *m,

Quoted 17 lines
drivers/gpu/drm/i915/i915_debugfs.c +5 -0
 struct drm_device *dev = node->minor->dev;
 drm_i915_private_t *dev_priv = dev->dev_private;
 struct intel_ring_buffer *ring;
+ int ret;
 
 ring = &dev_priv->ring[(uintptr_t)node->info_ent->data];
 if (ring->size == 0)
 return 0;
 
+ ret = mutex_lock_interruptible(&dev->struct_mutex);
+ if (ret)
+ return ret;
+
 seq_printf(m, "Ring %s:\n", ring->name);
 seq_printf(m, " Head : %08x\n", I915_READ_HEAD(ring) & HEAD_ADDR);
 seq_printf(m, " Tail : %08x\n", I915_READ_TAIL(ring) & TAIL_ADDR);
@@ -653,6 +658,8 @@ static int i915_ringbuffer_info(struct seq_file *m,

void *data)

drivers/gpu/drm/i915/i915_debugfs.c static int i915_rstdby_delays(struct seq_file *m,

Quoted 9 lines
drivers/gpu/drm/i915/i915_debugfs.c +2 -0
 seq_printf(m, " Control : %08x\n", I915_READ_CTL(ring));
 seq_printf(m, " Start : %08x\n", I915_READ_START(ring));
 
+ mutex_unlock(&dev->struct_mutex);
+
 return 0;
 }
 
@@ -841,7 +848,16 @@ static int i915_rstdby_delays(struct seq_file *m,

void *unused)

Quoted 6 lines
drivers/gpu/drm/i915/i915_debugfs.c +2 -1
 struct drm_info_node *node = (struct drm_info_node *) m->private;
 struct drm_device *dev = node->minor->dev;
 drm_i915_private_t *dev_priv = dev->dev_private;
- u16 crstanddelay = I915_READ16(CRSTANDVID);
+ u16 crstanddelay;
+ int ret;

drivers/gpu/drm/i915/i915_debugfs.c static int i915_rstdby_delays(struct seq_file *m, · line 862

Quoted 10 lines
drivers/gpu/drm/i915/i915_debugfs.c +8 -0
+
+ ret = mutex_lock_interruptible(&dev->struct_mutex);
+ if (ret)
+ return ret;
+
+ crstanddelay = I915_READ16(CRSTANDVID);
+
+ mutex_unlock(&dev->struct_mutex);
 
 seq_printf(m, "w/ctx: %d, w/o ctx: %d\n", (crstanddelay >> 8) & 0x3f,

(crstanddelay & 0x3f));

drivers/gpu/drm/i915/i915_debugfs.c static int i915_delayfreq_table(struct seq_file *m,

Quoted 2 lines
drivers/gpu/drm/i915/i915_debugfs.c +0 -0
@@ -939,7 +955,11 @@ static int i915_delayfreq_table(struct seq_file *m,

void *unused)

drivers/gpu/drm/i915/i915_debugfs.c static int i915_delayfreq_table(struct seq_file *m,

Quoted 13 lines
drivers/gpu/drm/i915/i915_debugfs.c +5 -1
 struct drm_device *dev = node->minor->dev;
 drm_i915_private_t *dev_priv = dev->dev_private;
 u32 delayfreq;
- int i;
+ int ret, i;
+
+ ret = mutex_lock_interruptible(&dev->struct_mutex);
+ if (ret)
+ return ret;
 
 for (i = 0; i < 16; i++) {
 delayfreq = I915_READ(PXVFREQ_BASE + i * 4);
@@ -947,6 +967,8 @@ static int i915_delayfreq_table(struct seq_file *m,

void *unused)

drivers/gpu/drm/i915/i915_debugfs.c static int i915_inttoext_table(struct seq_file *m,

Quoted 9 lines
drivers/gpu/drm/i915/i915_debugfs.c +2 -0
 (delayfreq & PXVFREQ_PX_MASK) >> PXVFREQ_PX_SHIFT);
 }
 
+ mutex_unlock(&dev->struct_mutex);
+
 return 0;
 }
 
@@ -961,13 +983,19 @@ static int i915_inttoext_table(struct seq_file *m,

void *unused)

drivers/gpu/drm/i915/i915_debugfs.c static int i915_drpc_info(struct seq_file *m, void

Quoted 21 lines
drivers/gpu/drm/i915/i915_debugfs.c +7 -1
 struct drm_device *dev = node->minor->dev;
 drm_i915_private_t *dev_priv = dev->dev_private;
 u32 inttoext;
- int i;
+ int ret, i;
+
+ ret = mutex_lock_interruptible(&dev->struct_mutex);
+ if (ret)
+ return ret;
 
 for (i = 1; i <= 32; i++) {
 inttoext = I915_READ(INTTOEXT_BASE_ILK + i * 4);
 seq_printf(m, "INTTOEXT%02d: 0x%08x\n", i, inttoext);
 }
 
+ mutex_unlock(&dev->struct_mutex);
+
 return 0;
 }
 
@@ -976,9 +1004,19 @@ static int i915_drpc_info(struct seq_file *m, void

*unused)

drivers/gpu/drm/i915/i915_debugfs.c static int i915_gfxec(struct seq_file *m, void

Quoted 23 lines
drivers/gpu/drm/i915/i915_debugfs.c +13 -3
 struct drm_info_node *node = (struct drm_info_node *) m->private;
 struct drm_device *dev = node->minor->dev;
 drm_i915_private_t *dev_priv = dev->dev_private;
- u32 rgvmodectl = I915_READ(MEMMODECTL);
- u32 rstdbyctl = I915_READ(RSTDBYCTL);
- u16 crstandvid = I915_READ16(CRSTANDVID);
+ u32 rgvmodectl, rstdbyctl;
+ u16 crstandvid;
+ int ret;
+
+ ret = mutex_lock_interruptible(&dev->struct_mutex);
+ if (ret)
+ return ret;
+
+ rgvmodectl = I915_READ(MEMMODECTL);
+ rstdbyctl = I915_READ(RSTDBYCTL);
+ crstandvid = I915_READ16(CRSTANDVID);
+
+ mutex_unlock(&dev->struct_mutex);
 

seq_printf(m, "HD boost: %s\n", (rgvmodectl & MEMMODE_BOOST_EN) ? "yes" : "no");

drivers/gpu/drm/i915/i915_debugfs.c +0 -0
@@ -1166,9 +1204,16 @@ static int i915_gfxec(struct seq_file *m, void

*unused)

Quoted 18 lines
drivers/gpu/drm/i915/i915_debugfs.c +7 -1
 struct drm_info_node *node = (struct drm_info_node *) m->private;
 struct drm_device *dev = node->minor->dev;
 drm_i915_private_t *dev_priv = dev->dev_private;
+ int ret;
+
+ ret = mutex_lock_interruptible(&dev->struct_mutex);
+ if (ret)
+ return ret;
 
 seq_printf(m, "GFXEC: %ld\n", (unsigned long)I915_READ(0x112f4));
 
+ mutex_unlock(&dev->struct_mutex);
+
 return 0;
 }
 
--

1.7.7

Signature · 6 lines
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!		
Jetzt informieren: http://www.gmx.net/de/go/freephone
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
#2 lore raw
Quoted 6 lines · Dieter Mummenschanz

Hello,

I also have the same problem and would like to try the patch. Where can I find the git source repository where I can get the latest development sources?

Regards
Dieter

I've pushed this patch on top of drm-intel-fixes to my repo here:
http://cgit.freedesktop.org/~bwidawsk/drm-intel/log/?h=drm-intel-fixes

This is only for convenience, do expect this repo to be rebased constantly.

Ben