[Intel-gfx] [PATCH 1/3] drm/i915: Live testing for context execution
Joonas Lahtinen
joonas.lahtinen at linux.intel.com
Mon Feb 13 14:20:41 UTC 2017
On ma, 2017-02-13 at 12:06 +0000, Chris Wilson wrote:
> Check we can create and execution within a context.
>
> v2: Write one set of dwords through each context/engine to exercise more
> contexts within the same time period.
>
> Signed-off-by: Chris Wilson <chris at chris-wilson.co.uk>
<SNIP>
> +static struct i915_vma *
> +gpu_fill_dw(struct i915_vma *vma, u64 offset, unsigned long count, u32 value)
> +{
> + struct drm_i915_gem_object *obj;
> + const int gen = INTEL_GEN(vma->vm->i915);
> + unsigned long n;
> + u32 *cmd;
> + int err;
> +
> + GEM_BUG_ON(!igt_can_mi_store_dword_imm(vma->vm->i915));
> +
> + n = (4*count + 1)*sizeof(u32);
> + obj = i915_gem_object_create_internal(vma->vm->i915,
> + round_up(n, PAGE_SIZE));
Reuse of variable "n" purpose later.
> +static int cpu_check(struct drm_i915_gem_object *obj, unsigned int max)
> +{
> + unsigned int n, m, needs_flush;
> + int err;
> +
> + err = i915_gem_obj_prepare_shmem_read(obj, &needs_flush);
> + if (err)
> + return err;
> +
> + for (n = 0; !err && n < real_page_count(obj); n++) {
> + u32 *map;
> +
> + map = kmap_atomic(i915_gem_object_get_page(obj, n));
> + if (needs_flush & CLFLUSH_BEFORE)
> + drm_clflush_virt_range(map, PAGE_SIZE);
> +
> + for (m = 0; !err && m < max; m++) {
> + if (map[m] != m) {
> + pr_err("Invalid value at page %d, offset %d: found %x expected %x\n",
> + n, m, map[m], m);
> + err = -EINVAL;
> + }
> + }
Use breaks or gotos to avoid cluttering the loop conditions.
<SNIP>
> + pr_err("Failed to fill dword %lu [%lu/%lu] with gpu (%s) in ctx %u [full-ppgtt? %d], err=%d\n",
> + ndwords, dw, max_dwords(obj),
> + engine->name, ctx->hw_id, !!ctx->ppgtt,
yesno(!!ctx->ppgtt)
Reviewed-by: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
Regards, Joonas
--
Joonas Lahtinen
Open Source Technology Center
Intel Corporation
More information about the Intel-gfx
mailing list