[Intel-gfx] [PATCH 1/2] drm/i915/selftests: Refine the i915_ppat_get test case
Zhi Wang
zhi.a.wang at intel.com
Thu Sep 21 17:27:09 UTC 2017
Refine the i915_ppat_get test case to catch a bug recently intrduced by
me. If the PPAT page table is filled first, then there will be PPAT
entries which has the same attributes with another one. If we try to
get our entry at this time. Tested on my SKL NUC box.
Cc: Ben Widawsky <benjamin.widawsky at intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi at intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen at linux.intel.com>
Signed-off-by: Zhi Wang <zhi.a.wang at intel.com>
---
drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 28 +++++++++++----------------
1 file changed, 11 insertions(+), 17 deletions(-)
diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
index cd7eeb6..75cb2d6 100644
--- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
+++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c
@@ -1284,7 +1284,7 @@ static int perform_perfect_match_test(struct intel_ppat *ppat)
{
struct drm_i915_private *i915 = ppat->i915;
const struct intel_ppat_entry *entry;
- int ret, i;
+ int i;
for_each_set_bit(i, ppat->used, ppat->max_entries) {
entry = intel_ppat_get(i915, ppat->entries[i].value);
@@ -1296,9 +1296,7 @@ static int perform_perfect_match_test(struct intel_ppat *ppat)
intel_ppat_put(entry);
return -EINVAL;
}
- ret = put_and_check_entry(entry);
- if (ret)
- return ret;
+ intel_ppat_put(entry);
}
return 0;
}
@@ -1328,7 +1326,6 @@ static int perform_partial_match_test(struct intel_ppat *ppat)
struct drm_i915_private *i915 = ppat->i915;
const struct intel_ppat_entry *entry;
u8 value;
- int ret;
value = generate_new_value(ppat, value_for_partial_test);
if (!value) {
@@ -1350,10 +1347,7 @@ static int perform_partial_match_test(struct intel_ppat *ppat)
return -EINVAL;
}
- ret = put_and_check_entry(entry);
- if (ret)
- return ret;
-
+ intel_ppat_put(entry);
return 0;
}
@@ -1373,14 +1367,7 @@ static int igt_ppat_get(void *arg)
if (ret)
return ret;
- /* case 1: perfect match */
- ret = perform_perfect_match_test(ppat);
- if (ret) {
- pr_err("fail on perfect match test\n");
- return ret;
- }
-
- /* case 2: alloc new entries */
+ /* case 1: alloc new entries */
entries = NULL;
ret = 0;
@@ -1407,6 +1394,13 @@ static int igt_ppat_get(void *arg)
*p = entry;
}
+ /* case 2: perfect match */
+ ret = perform_perfect_match_test(ppat);
+ if (ret) {
+ pr_err("fail on perfect match test\n");
+ return ret;
+ }
+
/* case 3: negative test 1, suppose PPAT table is full now */
ret = perform_negative_test(ppat);
if (ret) {
--
2.7.4
More information about the Intel-gfx
mailing list