drm/i915: give more distinctive names to ring hangcheck action enums
Subsystems (2)
PATCH 1/2 drm/i915: give more distinctive names to ring hangcheck action enums
The short lowercase names are bound to collide. The default warnings don't even warn about shadowing.
--- drivers/gpu/drm/i915/i915_gem.c | 2 +- drivers/gpu/drm/i915/i915_irq.c | 22 +++++++++++----------- drivers/gpu/drm/i915/intel_ringbuffer.h | 7 ++++++- 3 files changed, 18 insertions(+), 13 deletions(-)
drivers/gpu/drm/i915/i915_gem.c +1 -1
@@ -2201,7 +2201,7 @@ static void i915_set_reset_status(struct intel_ring_buffer *ring, offset =i915_gem_obj_offset (request->batch_obj,request_to_vm (request)); -if (ring->hangcheck.action != wait && +if (ring->hangcheck.action !=HANGCHECK_WAIT &&i915_request_guilty (request, acthd, &inside)) { DRM_ERROR("%s hung %s bo (0x%lx ctx %d) at 0x%x\n", ring->name,
drivers/gpu/drm/i915/i915_irq.c +11 -11
@@ -1826,10 +1826,10 @@ ring_stuck(struct intel_ring_buffer *ring, u32 acthd)u32 tmp;if (ring->hangcheck.acthd != acthd) -return active; +return HANGCHECK_ACTIVE ;if (IS_GEN2 (dev)) -return hung; +return HANGCHECK_HUNG ;/* Is the chip hanging on a WAIT_FOR_EVENT? * If so we can simply poke the RB_WAIT bit
@@ -1841,24 +1841,24 @@ ring_stuck(struct intel_ring_buffer *ring, u32 acthd)DRM_ERROR ("Kicking stuck wait on %s\n" , ring->name);I915_WRITE_CTL (ring, tmp); -return kick; +return HANGCHECK_KICK ; }if (INTEL_INFO (dev)->gen >=6 && tmp &RING_WAIT_SEMAPHORE ) {switch (semaphore_passed (ring)) {default : -return hung; +return HANGCHECK_HUNG ;case 1 :DRM_ERROR ("Kicking stuck semaphore on %s\n" , ring->name);I915_WRITE_CTL (ring, tmp); -return kick; +return HANGCHECK_KICK ;case 0 : -return wait; +return HANGCHECK_WAIT ; } } -return hung; +return HANGCHECK_HUNG ; }/**
@@ -1926,16 +1926,16 @@ static void i915_hangcheck_elapsed(unsigned long data) acthd);switch (ring->hangcheck.action) { -case wait: +case HANGCHECK_WAIT : score =0 ;break ; -case active: +case HANGCHECK_ACTIVE : score =BUSY ;break ; -case kick: +case HANGCHECK_KICK : score =KICK ;break ; -case hung: +case HANGCHECK_HUNG : score =HUNG ; stuck[i] = true;break ;
drivers/gpu/drm/i915/intel_ringbuffer.h +6 -1
@@ -37,7 +37,12 @@ struct intel_hw_status_page {#define I915_READ_SYNC_0 (ring) I915_READ(RING_SYNC_0((ring)->mmio_base))#define I915_READ_SYNC_1 (ring) I915_READ(RING_SYNC_1((ring)->mmio_base)) -enum intel_ring_hangcheck_action { wait, active, kick, hung }; +enum intel_ring_hangcheck_action { +HANGCHECK_WAIT , +HANGCHECK_ACTIVE , +HANGCHECK_KICK , +HANGCHECK_HUNG , +};struct intel_ring_hangcheck {bool deadlock;
Signature · 1 line
1.7.10.4
PATCH 2/2 drm/i915: drop unnecessary local variable to suppress build warning
Although I could not reproduce this (different compiler version, perhaps), reportedly we get:
drivers/gpu/drm/i915/i915_irq.c:1943:27: warning: ‘score’ may be used uninitialized in this function [-Wuninitialized]
Drop the 'score' variable altogether as it's not really needed.
--- drivers/gpu/drm/i915/i915_irq.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/gpu/drm/i915/i915_irq.c +3 -7
@@ -1905,8 +1905,6 @@ static void i915_hangcheck_elapsed(unsigned long data) }else busy = false; }else { -int score; -/* We always increment the hangcheck score * if the ring is busy and still processing * the same request, so that no single request
@@ -1927,20 +1925,18 @@ static void i915_hangcheck_elapsed(unsigned long data)switch (ring->hangcheck.action) {case HANGCHECK_WAIT : - score =0 ;break ;case HANGCHECK_ACTIVE : - score =BUSY ; + ring->hangcheck.score +=BUSY ;break ;case HANGCHECK_KICK : - score =KICK ; + ring->hangcheck.score +=KICK ;break ;case HANGCHECK_HUNG : - score =HUNG ; + ring->hangcheck.score +=HUNG ; stuck[i] = true;break ; } - ring->hangcheck.score += score; } }else {/* Gradually reduce the count so that we catch DoS
Signature · 6 lines
1.7.10.4 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: drop unnecessary local variable to suppress build warning
Quoted 7 lines · Jani Nikula
Although I could not reproduce this (different compiler version, perhaps), reportedly we get:
drivers/gpu/drm/i915/i915_irq.c:1943:27: warning: ‘score’ may be used uninitialized in this function [-Wuninitialized]Drop the 'score' variable altogether as it's not really needed.
Right, it was only there because I thought the switch was more readable with the temporary.
Quoted 1 line
Reported-by Kees Cook <[email protected]>
Go fix your compiler!
Quoted 1 line
Signed-off-by Jani Nikula <[email protected]>
Both patches
-Chris
Signature · 5 lines
Chris Wilson, Intel Open Source Technology Centre _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: drop unnecessary local variable to suppress build warning
Quoted 7 lines · Chris Wilson
Quoted 6 lines · Jani Nikula
Although I could not reproduce this (different compiler version, perhaps), reportedly we get:
drivers/gpu/drm/i915/i915_irq.c:1943:27: warning: ‘score’ may be used uninitialized in this function [-Wuninitialized]
Quoted 7 lines
Quoted 1 line
Drop the 'score' variable altogether as it's not really needed.
Right, it was only there because I thought the switch was more readable with the temporary.
Quoted 1 line
Reported-by Kees Cook <[email protected]>Go fix your compiler!
Indeed, Kees seems to have an especially dense bread of gcc ;-)
Quoted 3 lines
Quoted 1 line
Signed-off-by Jani Nikula <[email protected]>Both patches
Reviewed-by Chris Wilson <[email protected]>
Both merged to dinq, thanks for the patches and review. -Daniel
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/2] drm/i915: drop unnecessary local variable to suppress build warning
Quoted 10 lines · Daniel Vetter
Quoted 9 lines · Chris Wilson
Quoted 7 lines · Jani Nikula
Although I could not reproduce this (different compiler version, perhaps), reportedly we get:
drivers/gpu/drm/i915/i915_irq.c:1943:27: warning: ‘score’ may be used uninitialized in this function [-Wuninitialized]Drop the 'score' variable altogether as it's not really needed.
Quoted 7 lines
Quoted 5 lines
Right, it was only there because I thought the switch was more readable with the temporary.
Quoted 1 line
Reported-by Kees Cook <[email protected]>Go fix your compiler!
Indeed, Kees seems to have an especially dense bread of gcc ;-)
4.6.3! :P What're you all using? (Regardless, I'm looking forward to 4.9.)
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Signed-off-by Jani Nikula <[email protected]>Both patches
Reviewed-by Chris Wilson <[email protected]>Both merged to dinq, thanks for the patches and review.
Cool. My stderr during compilation thanks you. :)
-Kees
Signature · 2 lines
Kees Cook Chrome OS Security