From patchwork Thu Sep 21 17:29:48 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Zhi A" X-Patchwork-Id: 9964635 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 9675A600C5 for ; Thu, 21 Sep 2017 17:30:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7C7712961F for ; Thu, 21 Sep 2017 17:30:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6900B2962A; Thu, 21 Sep 2017 17:30:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7D01229629 for ; Thu, 21 Sep 2017 17:30:48 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EDF5C6E8CC; Thu, 21 Sep 2017 17:30:06 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by gabe.freedesktop.org (Postfix) with ESMTPS id 74F406E8CB; Thu, 21 Sep 2017 17:30:05 +0000 (UTC) Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 Sep 2017 10:30:04 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.42,425,1500966000"; d="scan'208";a="151904109" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga005.jf.intel.com with ESMTP; 21 Sep 2017 10:30:01 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 21 Sep 2017 10:29:51 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.159]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.213]) with mapi id 14.03.0319.002; Fri, 22 Sep 2017 01:29:49 +0800 From: "Wang, Zhi A" To: "intel-gfx@lists.freedesktop.org" , "intel-gvt-dev@lists.freedesktop.org" Thread-Topic: [PATCH 1/2] drm/i915/selftests: Refine the i915_ppat_get test case Thread-Index: AQHTMv7l5N0jB9r6EEmecjEe1L8ikaK/mGDg Date: Thu, 21 Sep 2017 17:29:48 +0000 Message-ID: References: <1506014831-1903-1-git-send-email-zhi.a.wang@intel.com> <1506014831-1903-2-git-send-email-zhi.a.wang@intel.com> In-Reply-To: <1506014831-1903-2-git-send-email-zhi.a.wang@intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Cc: "Widawsky, Benjamin" , "Vivi, Rodrigo" Subject: Re: [Intel-gfx] [PATCH 1/2] drm/i915/selftests: Refine the i915_ppat_get test case X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP Please drop this one. -----Original Message----- From: Wang, Zhi A Sent: Thursday, September 21, 2017 8:27 PM To: intel-gfx@lists.freedesktop.org; intel-gvt-dev@lists.freedesktop.org Cc: joonas.lahtinen@linux.intel.com; chris@chris-wilson.co.uk; zhenyuw@linux.intel.com; Wang, Zhi A ; Widawsky, Benjamin ; Vivi, Rodrigo Subject: [PATCH 1/2] drm/i915/selftests: Refine the i915_ppat_get test case 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 Cc: Rodrigo Vivi Cc: Joonas Lahtinen Signed-off-by: Zhi Wang --- drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 28 +++++++++++---------------- 1 file changed, 11 insertions(+), 17 deletions(-) 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 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);