drm/i915: Scratch page checker
Subsystems (3)
RFC PATCH 1/1 drm/i915: Scratch page checker
Periodically check the scratch page to see if it changes. Scratch page changes almost always indicate something is wrong.
We never expect a non-zero filled page, so potentially we could directly put that md5 value for checking. I think the code as it is will be a bit more robust.
Pretty RFC here since I've only compiled and run it for a few seconds.
Recommended-by Stephane Marchesin <[email protected]>
Signed-off-by Ben Widawsky <[email protected]>
--- drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/i915/i915_drv.c | 5 +++ drivers/gpu/drm/i915/i915_drv.h | 14 +++++++ drivers/gpu/drm/i915/i915_gem_gtt.c | 73 +++++++++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+)
drivers/gpu/drm/Kconfig +2 -0
@@ -125,6 +125,8 @@ config DRM_I915 depends on DRM depends on AGP depends on AGP_INTEL + select CRYPTO + select CRYPTO_MD5 # we need shmfs for the swappable backing store, and in particular # the shmem_readpage() which depends upon tmpfs select SHMEM
drivers/gpu/drm/i915/i915_drv.c +5 -0
@@ -128,6 +128,11 @@ module_param_named(disable_power_well, i915_disable_power_well, int, 0600);MODULE_PARM_DESC (disable_power_well,"Disable the power well when possible (default: false)" ); +int i915_enable_scratch_checker__read_mostly =0 ; +module_param_named (enable_scratch_checker, i915_enable_scratch_checker, int,0600 ); +MODULE_PARM_DESC (enable_scratch_checker, +"Enable periodic timer to find stray writes to the scratch page (default: false)" ); +static struct drm_driver driver;extern int intel_agp_enabled;
drivers/gpu/drm/i915/i915_drv.h +14 -0
@@ -43,6 +43,8 @@#include <linux/intel-iommu.h> #include <linux/kref.h> #include <linux/pm_qos.h> +#include <linux/crypto.h> +#include <crypto/md5.h> /* General customization: */
@@ -869,6 +871,16 @@ struct i915_gpu_error {unsigned int stop_rings; }; +struct i915_scratch_checker { +struct scatterlist sg;/* sg for scratch page */ +struct hash_desc hash; +char last_hash[MD5_DIGEST_SIZE ]; + +#define I915_SCRATCH_DIRT_PERIOD 1000/* in ms */ +#define I915_SCRATCH_DIRT_JIFFIES msecs_to_jiffies(I915_SCRATCH_DIRT_PERIOD) +struct timer_list timer; +}; +enum modeset_restore {MODESET_ON_LID_OPEN ,MODESET_DONE ,
@@ -1058,6 +1070,7 @@ typedef struct drm_i915_private {struct drm_mm_node *compressed_llb;struct i915_gpu_error gpu_error; +struct i915_scratch_checker scratch_checker;/* list of fbdev register on this device */ struct intel_fbdev *fbdev;
@@ -1435,6 +1448,7 @@ extern bool i915_enable_hangcheck __read_mostly;extern int i915_enable_ppgtt__read_mostly ;extern unsigned int i915_preliminary_hw_support__read_mostly ;extern int i915_disable_power_well__read_mostly ; +extern int i915_enable_scratch_checker__read_mostly ;extern int i915_suspend (struct drm_device *dev,pm_message_t state);extern int i915_resume (struct drm_device *dev);
drivers/gpu/drm/i915/i915_gem_gtt.c +73 -0
102 lines not on this page · raw message
Signature · 1 line
1.8.2.1