[Intel-gfx] [PATCH] drm/i915: Enable fine-grained kcov instrumentation

Jani Nikula jani.nikula at linux.intel.com
Thu Aug 4 07:12:30 UTC 2016


On Wed, 03 Aug 2016, Chris Wilson <chris at chris-wilson.co.uk> wrote:
> In the next merge, we can build support for kcov at the individual file,
> or driver level. This is useful to filter out the noise when doing
> coverage test, i.e. we do get edges through code outside of i915.ko.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
> ---
>  drivers/gpu/drm/i915/Kconfig.debug | 12 ++++++++++++
>  drivers/gpu/drm/i915/Makefile      |  1 +
>  2 files changed, 13 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/Kconfig.debug b/drivers/gpu/drm/i915/Kconfig.debug
> index cee87bfd10c4..eb38270d0ecd 100644
> --- a/drivers/gpu/drm/i915/Kconfig.debug
> +++ b/drivers/gpu/drm/i915/Kconfig.debug
> @@ -42,3 +42,15 @@ config DRM_I915_DEBUG_GEM
>  
>            If in doubt, say "N".
>  
> +config DRM_I915_KCOV
> +	bool "Generate fine-grained code coverage (for kcov)"
> +	default n
> +	select KCOV

depends on KCOV?

BR,
Jani

> +	help
> +	  Enable instrumentation of i915.ko to generate coverage via kcov
> +	  (/sys/kernel/debug/kcov). This allows coverage driven fuzzing,
> +	  such as AFL, to be used and focused on the driver.
> +
> +	  Recommended for driver developers only.
> +
> +	  If in doubt, say "N".
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index 0afe7b3cad07..2f4bbaca5b60 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -3,6 +3,7 @@
>  # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
>  
>  subdir-ccflags-$(CONFIG_DRM_I915_WERROR) := -Werror
> +subdir-ccflags-$(CONFIG_DRM_I915_KCOV) := $(CFLAGS_KCOV)
>  subdir-ccflags-y += \
>  	$(call as-instr,movntdqa (%eax)$(comma)%xmm0,-DCONFIG_AS_MOVNTDQA)

-- 
Jani Nikula, Intel Open Source Technology Center


More information about the Intel-gfx mailing list