From patchwork Wed Oct 23 09:07:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11206065 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7057A112B for ; Wed, 23 Oct 2019 09:08:25 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5854F20663 for ; Wed, 23 Oct 2019 09:08:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5854F20663 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 40AA66E9F9; Wed, 23 Oct 2019 09:08:24 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id 70B626E9F9; Wed, 23 Oct 2019 09:08:22 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2019 02:08:21 -0700 X-IronPort-AV: E=Sophos;i="5.68,220,1569308400"; d="scan'208";a="188189825" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.17]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2019 02:08:19 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Wed, 23 Oct 2019 11:07:51 +0200 Message-Id: <20191023090752.23566-1-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 1/2] tests/gem_exec_reloc: Don't filter out addresses when on PPGTT X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Commit a355b2d6eb42 ("igt/gem_exec_reloc: Filter out unavailable addresses for !ppgtt") introduced filtering of addresses possibly occupied by other users of shared GTT. Unfortunately, that filtering is unconditional, no matter if running on old shared GTT or not. When running on PPGTT, that may result in errors other than those intended to be skipped over being silently ignored. Skip over unavailable addresses only when not running on PPGTT. Signed-off-by: Janusz Krzysztofik Cc: Chris Wilson --- tests/i915/gem_exec_reloc.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/tests/i915/gem_exec_reloc.c b/tests/i915/gem_exec_reloc.c index fdd9661d..8f88826e 100644 --- a/tests/i915/gem_exec_reloc.c +++ b/tests/i915/gem_exec_reloc.c @@ -539,12 +539,13 @@ static void basic_range(int fd, unsigned flags) obj[n].offset = (1ull << (i + 12)) - 4096; obj[n].offset = gen8_canonical_address(obj[n].offset); obj[n].flags = EXEC_OBJECT_PINNED | EXEC_OBJECT_SUPPORTS_48B_ADDRESS; - gem_write(fd, obj[n].handle, 0, &bbe, sizeof(bbe)); - execbuf.buffers_ptr = to_user_pointer(&obj[n]); - execbuf.buffer_count = 1; - if (__gem_execbuf(fd, &execbuf)) - continue; - + if (!gem_uses_ppgtt(fd)) { + gem_write(fd, obj[n].handle, 0, &bbe, sizeof(bbe)); + execbuf.buffers_ptr = to_user_pointer(&obj[n]); + execbuf.buffer_count = 1; + if (__gem_execbuf(fd, &execbuf)) + continue; + } igt_debug("obj[%d] handle=%d, address=%llx\n", n, obj[n].handle, (long long)obj[n].offset); @@ -559,12 +560,13 @@ static void basic_range(int fd, unsigned flags) obj[n].offset = 1ull << (i + 12); obj[n].offset = gen8_canonical_address(obj[n].offset); obj[n].flags = EXEC_OBJECT_PINNED | EXEC_OBJECT_SUPPORTS_48B_ADDRESS; - gem_write(fd, obj[n].handle, 0, &bbe, sizeof(bbe)); - execbuf.buffers_ptr = to_user_pointer(&obj[n]); - execbuf.buffer_count = 1; - if (__gem_execbuf(fd, &execbuf)) - continue; - + if (!gem_uses_ppgtt(fd)) { + gem_write(fd, obj[n].handle, 0, &bbe, sizeof(bbe)); + execbuf.buffers_ptr = to_user_pointer(&obj[n]); + execbuf.buffer_count = 1; + if (__gem_execbuf(fd, &execbuf)) + continue; + } igt_debug("obj[%d] handle=%d, address=%llx\n", n, obj[n].handle, (long long)obj[n].offset); From patchwork Wed Oct 23 09:07:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11206067 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4B3E2112B for ; Wed, 23 Oct 2019 09:08:27 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 33C7B20663 for ; Wed, 23 Oct 2019 09:08:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 33C7B20663 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0C9866E9FB; Wed, 23 Oct 2019 09:08:26 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by gabe.freedesktop.org (Postfix) with ESMTPS id A40586E9FC; Wed, 23 Oct 2019 09:08:24 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2019 02:08:24 -0700 X-IronPort-AV: E=Sophos;i="5.68,220,1569308400"; d="scan'208";a="188189832" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.17]) by orsmga007-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2019 02:08:21 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Wed, 23 Oct 2019 11:07:52 +0200 Message-Id: <20191023090752.23566-2-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191023090752.23566-1-janusz.krzysztofik@linux.intel.com> References: <20191023090752.23566-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH i-g-t 2/2] tests/gem_exec_reloc: Calculate softpin offsets from batch size X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Janusz Krzysztofik , intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Janusz Krzysztofik The basic-range subtest assumes 4kB minimum batch size. On future backends with possibly bigger minimum batch sizes this subtest will fail as buffer objects may overlap. To avoid object overlapping, offsets need to be calculated with actual minimum batch size in mind. Replace hardcoded constants corresponding to the assumed 4kB minimum batch size with values calculated from a variable supposed to represent actual batch size. For now, the variable is still initialized with the 4kB value, suitable for backends currently supported by IGT. Signed-off-by: Janusz Krzysztofik Cc: Katarzyna Dec Cc: Stuart Summers --- tests/i915/gem_exec_reloc.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/tests/i915/gem_exec_reloc.c b/tests/i915/gem_exec_reloc.c index 8f88826e..8d2f10ac 100644 --- a/tests/i915/gem_exec_reloc.c +++ b/tests/i915/gem_exec_reloc.c @@ -518,16 +518,21 @@ static void basic_range(int fd, unsigned flags) struct drm_i915_gem_execbuffer2 execbuf; uint64_t address_mask = has_64b_reloc(fd) ? ~(uint64_t)0 : ~(uint32_t)0; uint64_t gtt_size = gem_aperture_size(fd); + /* FIXME: switch to a suitable library function when available */ + uint64_t batch_size = 4096; const uint32_t bbe = MI_BATCH_BUFFER_END; igt_spin_t *spin = NULL; - int count, n; + int batch_order, count, n; igt_require(gem_has_softpin(fd)); - for (count = 12; gtt_size >> (count + 1); count++) + for (batch_order = 0; batch_size >> (batch_order + 1); batch_order++) ; - count -= 12; + for (count = batch_order; gtt_size >> (count + 1); count++) + ; + + count -= batch_order; memset(obj, 0, sizeof(obj)); memset(reloc, 0, sizeof(reloc)); @@ -535,8 +540,8 @@ static void basic_range(int fd, unsigned flags) n = 0; for (int i = 0; i <= count; i++) { - obj[n].handle = gem_create(fd, 4096); - obj[n].offset = (1ull << (i + 12)) - 4096; + obj[n].handle = gem_create(fd, batch_size); + obj[n].offset = (1ull << (i + batch_order)) - batch_size; obj[n].offset = gen8_canonical_address(obj[n].offset); obj[n].flags = EXEC_OBJECT_PINNED | EXEC_OBJECT_SUPPORTS_48B_ADDRESS; if (!gem_uses_ppgtt(fd)) { @@ -556,8 +561,8 @@ static void basic_range(int fd, unsigned flags) n++; } for (int i = 1; i < count; i++) { - obj[n].handle = gem_create(fd, 4096); - obj[n].offset = 1ull << (i + 12); + obj[n].handle = gem_create(fd, batch_size); + obj[n].offset = 1ull << (i + batch_order); obj[n].offset = gen8_canonical_address(obj[n].offset); obj[n].flags = EXEC_OBJECT_PINNED | EXEC_OBJECT_SUPPORTS_48B_ADDRESS; if (!gem_uses_ppgtt(fd)) { @@ -578,7 +583,7 @@ static void basic_range(int fd, unsigned flags) } igt_require(n); - obj[n].handle = gem_create(fd, 4096); + obj[n].handle = gem_create(fd, batch_size); obj[n].relocs_ptr = to_user_pointer(reloc); obj[n].relocation_count = n; gem_write(fd, obj[n].handle, 0, &bbe, sizeof(bbe));