From patchwork Wed Oct 23 15:29:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11207041 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 F1E9813BD for ; Wed, 23 Oct 2019 15:29:33 +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 DA2C120650 for ; Wed, 23 Oct 2019 15:29:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA2C120650 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 4320E6EB0B; Wed, 23 Oct 2019 15:29:33 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8D86C6EB0B; Wed, 23 Oct 2019 15:29:32 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2019 08:29:31 -0700 X-IronPort-AV: E=Sophos;i="5.68,221,1569308400"; d="scan'208";a="202027903" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.17]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2019 08:29:29 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Wed, 23 Oct 2019 17:29:15 +0200 Message-Id: <20191023152917.647-1-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH v2 1/3] tests/gem_exec_reloc: Don't filter out addresses on full 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 full (non-aliasing) 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 full 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..f7fc0ea7 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_full_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_full_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 15:29:16 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11207043 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 495CA13BD for ; Wed, 23 Oct 2019 15:29:38 +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 319AA20679 for ; Wed, 23 Oct 2019 15:29:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 319AA20679 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 9641C6EB10; Wed, 23 Oct 2019 15:29:37 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id C90A76EB0D; Wed, 23 Oct 2019 15:29:34 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2019 08:29:34 -0700 X-IronPort-AV: E=Sophos;i="5.68,221,1569308400"; d="scan'208";a="202027931" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.17]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2019 08:29:31 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Wed, 23 Oct 2019 17:29:16 +0200 Message-Id: <20191023152917.647-2-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191023152917.647-1-janusz.krzysztofik@linux.intel.com> References: <20191023152917.647-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH v2 2/3] 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 on softpin. To avoid object overlapping, softpin offsets need to be calculated with actual minimum batch size in mind. Replace hardcoded constants corresponding to the assumed 4kB value with variables supposed to reflect actual batch size. For now, the variables are still initialized with values specific to the 4kB minimum batch size, which are suitable for backends currently supported by IGT. Signed-off-by: Janusz Krzysztofik Cc: Katarzyna Dec Cc: Stuart Summers --- tests/i915/gem_exec_reloc.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/i915/gem_exec_reloc.c b/tests/i915/gem_exec_reloc.c index f7fc0ea7..61401ea7 100644 --- a/tests/i915/gem_exec_reloc.c +++ b/tests/i915/gem_exec_reloc.c @@ -520,14 +520,16 @@ static void basic_range(int fd, unsigned flags) uint64_t gtt_size = gem_aperture_size(fd); const uint32_t bbe = MI_BATCH_BUFFER_END; igt_spin_t *spin = NULL; + int batch_order = 12; + uint64_t batch_size = 1ull << batch_order; /* 4096 */ int count, n; igt_require(gem_has_softpin(fd)); - for (count = 12; gtt_size >> (count + 1); count++) + for (count = batch_order; gtt_size >> (count + 1); count++) ; - count -= 12; + count -= batch_order; memset(obj, 0, sizeof(obj)); memset(reloc, 0, sizeof(reloc)); @@ -536,7 +538,7 @@ 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].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_full_ppgtt(fd)) { @@ -557,7 +559,7 @@ static void basic_range(int fd, unsigned flags) } for (int i = 1; i < count; i++) { obj[n].handle = gem_create(fd, 4096); - obj[n].offset = 1ull << (i + 12); + 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_full_ppgtt(fd)) { From patchwork Wed Oct 23 15:29:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11207045 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 0A5951515 for ; Wed, 23 Oct 2019 15:29:42 +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 E672920650 for ; Wed, 23 Oct 2019 15:29:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E672920650 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 7DE446EB0E; Wed, 23 Oct 2019 15:29:41 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8308E6EB0E; Wed, 23 Oct 2019 15:29:37 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2019 08:29:37 -0700 X-IronPort-AV: E=Sophos;i="5.68,221,1569308400"; d="scan'208";a="202027951" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.17]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2019 08:29:34 -0700 From: Janusz Krzysztofik To: igt-dev@lists.freedesktop.org Date: Wed, 23 Oct 2019 17:29:17 +0200 Message-Id: <20191023152917.647-3-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20191023152917.647-1-janusz.krzysztofik@linux.intel.com> References: <20191023152917.647-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH v2 3/3] tests/gem_exec_reloc: Detect minimum 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: intel-gfx@lists.freedesktop.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The basic-range subtest have been already taught to calculate softpin offsets from minimum batch size, however it still uses a hardcoded value of 4kB. On future backends with possibly bigger minimum batch sizes this subtest will fail as buffer objects may overlap. Detect minimum batch size instead of using a hardcoded value. To avoid conflicts with addresses occupied by other users, do that only when running on full PPGTT. Platforms without full PPGTT are not expected to support backends with minimum batch sizes greater than 4kB. Signed-off-by: Janusz Krzysztofik --- tests/i915/gem_exec_reloc.c | 41 +++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) diff --git a/tests/i915/gem_exec_reloc.c b/tests/i915/gem_exec_reloc.c index 61401ea7..b71fe0be 100644 --- a/tests/i915/gem_exec_reloc.c +++ b/tests/i915/gem_exec_reloc.c @@ -511,6 +511,42 @@ static uint64_t gen8_canonical_address(uint64_t address) return sign_extend(address, 47); } +static int local_gem_minimum_batch_order(int fd) +{ + struct drm_i915_gem_exec_object2 obj; + struct drm_i915_gem_execbuffer2 execbuf; + uint64_t gtt_size = gem_aperture_size(fd); + const uint32_t bbe = MI_BATCH_BUFFER_END; + int batch_order = 12; + uint64_t batch_size = 1ull << batch_order; /* 4096 */ + + if (!gem_uses_full_ppgtt(fd) || !gem_has_softpin(fd)) + return batch_order; + + memset(&obj, 0, sizeof(obj)); + memset(&execbuf, 0, sizeof(execbuf)); + + obj.handle = gem_create(fd, 4096); + obj.flags = EXEC_OBJECT_PINNED | EXEC_OBJECT_SUPPORTS_48B_ADDRESS; + while (batch_size < gtt_size) { + obj.offset = gtt_size - batch_size; + obj.offset = gen8_canonical_address(obj.offset); + gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe)); + execbuf.buffers_ptr = to_user_pointer(&obj); + execbuf.buffer_count = 1; + if (!__gem_execbuf(fd, &execbuf)) { + igt_debug("batch_order=%d, batch_size=%llx\n", + batch_order, (long long)batch_size); + break; + } + batch_size <<= 1; + batch_order++; + } + gem_close(fd, obj.handle); + igt_require(batch_size < gtt_size); + return batch_order; +} + static void basic_range(int fd, unsigned flags) { struct drm_i915_gem_relocation_entry reloc[128]; @@ -520,8 +556,8 @@ static void basic_range(int fd, unsigned flags) uint64_t gtt_size = gem_aperture_size(fd); const uint32_t bbe = MI_BATCH_BUFFER_END; igt_spin_t *spin = NULL; - int batch_order = 12; - uint64_t batch_size = 1ull << batch_order; /* 4096 */ + int batch_order = local_gem_minimum_batch_order(fd); + uint64_t batch_size = 1ull << batch_order; int count, n; igt_require(gem_has_softpin(fd)); @@ -530,6 +566,7 @@ static void basic_range(int fd, unsigned flags) ; count -= batch_order; + igt_require(count); memset(obj, 0, sizeof(obj)); memset(reloc, 0, sizeof(reloc));