Skip to content

Commit

Permalink
drm/i915: If the GPU hangs twice within 5 seconds, declare it wedged.
Browse files Browse the repository at this point in the history
The issue is that we may become stuck executing a long running shader
and continually attempt to reset the GPU. (Or maybe we tickle some bug
and need to break the vicious cycle.) So if we are detect a second hang
within 5 seconds, give up trying to programme the GPU and report it
wedged.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
  • Loading branch information
Chris Wilson committed Oct 1, 2010
1 parent 2fa772f commit ae681d9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
15 changes: 9 additions & 6 deletions drivers/gpu/drm/i915/i915_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,11 @@ static int i965_do_reset(struct drm_device *dev, u8 flags)
{
u8 gdrst;

/*
* Set the domains we want to reset (GRDOM/bits 2 and 3) as
* well as the reset bit (GR/bit 0). Setting the GR bit
* triggers the reset; when done, the hardware will clear it.
*/
pci_read_config_byte(dev->pdev, I965_GDRST, &gdrst);
pci_write_config_byte(dev->pdev, I965_GDRST, gdrst | flags | 0x1);

Expand Down Expand Up @@ -427,13 +432,10 @@ int i915_reset(struct drm_device *dev, u8 flags)

i915_gem_reset(dev);

/*
* Set the domains we want to reset (GRDOM/bits 2 and 3) as
* well as the reset bit (GR/bit 0). Setting the GR bit
* triggers the reset; when done, the hardware will clear it.
*/
ret = -ENODEV;
switch (INTEL_INFO(dev)->gen) {
if (get_seconds() - dev_priv->last_gpu_reset < 5) {
DRM_ERROR("GPU hanging too fast, declaring wedged!\n");
} else switch (INTEL_INFO(dev)->gen) {
case 5:
ret = ironlake_do_reset(dev, flags);
break;
Expand All @@ -444,6 +446,7 @@ int i915_reset(struct drm_device *dev, u8 flags)
ret = i8xx_do_reset(dev, flags);
break;
}
dev_priv->last_gpu_reset = get_seconds();
if (ret) {
DRM_ERROR("Failed to reset chip.\n");
mutex_unlock(&dev->struct_mutex);
Expand Down
2 changes: 2 additions & 0 deletions drivers/gpu/drm/i915/i915_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,8 @@ typedef struct drm_i915_private {
struct drm_mm_node *compressed_fb;
struct drm_mm_node *compressed_llb;

unsigned long last_gpu_reset;

/* list of fbdev register on this device */
struct intel_fbdev *fbdev;
} drm_i915_private_t;
Expand Down

0 comments on commit ae681d9

Please sign in to comment.