From patchwork Thu Mar 29 13:05:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tvrtko Ursulin X-Patchwork-Id: 10315415 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 1F34460353 for ; Thu, 29 Mar 2018 13:05:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 16D362A33D for ; Thu, 29 Mar 2018 13:05:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0B5892A346; Thu, 29 Mar 2018 13:05:47 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 B47A92A33D for ; Thu, 29 Mar 2018 13:05:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B27D56E2D8; Thu, 29 Mar 2018 13:05:45 +0000 (UTC) X-Original-To: Intel-gfx@lists.freedesktop.org Delivered-To: Intel-gfx@lists.freedesktop.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4BF636E2B3 for ; Thu, 29 Mar 2018 13:05:41 +0000 (UTC) Received: by mail-wr0-x241.google.com with SMTP id s18so5332792wrg.9 for ; Thu, 29 Mar 2018 06:05:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin-net.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3QOvQl6vY6zuLo/3Cg+TM2je5AUbiqP4ZHM5dCDzcO4=; b=ovCR/0vj1UnACpDkoqOT0PRt2v2YbiQS6zImSDcUdh4Wh7sK+Vz5W6JKZCmaH6lxRA xULw3+05a72t87IU4BrCt6E57VF2Unt1Rlz1YFtFrTOoyADUrvuN2+r3LtU/CwD0OSyu EuFieOSpvFFhoHVQj1ABHbgU8cxnWp5SUEliEII8qz+zHxbYn7lGPIsdBdVfoK3OEAsd kCp422Y4fvy5sM2gxAa9QvWNJy44BhXIsLc9jPbxBh7P2dCrv829j8aRm0AxYkY6kbhP 43QASg8RY+aBP6vZKfZ7tE/EEyEiAcBJM34zychWNxl+V45lJsJVBEs2QJfpR4dGQo7R thvA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3QOvQl6vY6zuLo/3Cg+TM2je5AUbiqP4ZHM5dCDzcO4=; b=r0Q5M0FjU7ikMMGOR5SD52qRdvMNP/VUzd9HY/itl8ZEpXYQmOt8HfHYXIhXzISkDP xWh4cCyub60DMQmXhDGPboHQuv0MEywrCNbnE4Swt2asnTosr9oVXZENXumB6rQtqa3a +jPuLch+DxmkLhKSSBtrTy+7kbr9fbsNV0/3XjQ4mpk3xE9gT9FGw/5SZkQUqB7JlY+k 2NzLNmJmJyDsCsDVoYJQQUmeCT3dIcsD4mHAFcFFb/mbHLn1uR+TOpQUKtwRTles09Y4 1hoxMS41ceA3Gc4Jxo0DE/rycQOcieHcpXDKSCT1VAF3BKQ/VqmHvR9fYtauyM3epPos kDvA== X-Gm-Message-State: AElRT7HF7Hb5XwCtEDSCyVoh+ANvgO8KEYJkRSwpv310mSgdP+sNIZUw 4mZMVP4KFbPiluj4xnr1gvBPfQ== X-Google-Smtp-Source: AIpwx49T7wmCN+2GOLLc9EHRHIc4t6K/ayxR7va0LUUiFbDvkm+1a05zw63RbjBarr+fqMVO9sXC4A== X-Received: by 10.223.226.15 with SMTP id j15mr6207475wri.235.1522328739765; Thu, 29 Mar 2018 06:05:39 -0700 (PDT) Received: from localhost.localdomain ([95.146.144.186]) by smtp.gmail.com with ESMTPSA id q21sm4504190wra.24.2018.03.29.06.05.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Mar 2018 06:05:39 -0700 (PDT) From: Tvrtko Ursulin X-Google-Original-From: Tvrtko Ursulin To: igt-dev@lists.freedesktop.org Date: Thu, 29 Mar 2018 14:05:28 +0100 Message-Id: <20180329130528.8302-2-tvrtko.ursulin@linux.intel.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180329130528.8302-1-tvrtko.ursulin@linux.intel.com> References: <20180329130528.8302-1-tvrtko.ursulin@linux.intel.com> Subject: [Intel-gfx] [PATCH i-g-t 2/2] tests/gem_eio: Add context destroyer test 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 MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Tvrtko Ursulin Context destroyer is supposed to trigger wedging or resets at incovenient times and then re-use the context so either the context or driver tracking might get confused and break. Signed-off-by: Tvrtko Ursulin --- tests/gem_eio.c | 62 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/tests/gem_eio.c b/tests/gem_eio.c index b7c5047f0816..f3a452b2265c 100644 --- a/tests/gem_eio.c +++ b/tests/gem_eio.c @@ -591,6 +591,62 @@ static void test_inflight_internal(int fd, unsigned int wait) close(fd); } +static void test_context_destroyer(int fd, unsigned int flags) +{ + uint32_t ctx0 = gem_context_create(fd); + + igt_until_timeout(10) { + struct drm_i915_gem_execbuffer2 execbuf = { }; + struct drm_i915_gem_exec_object2 obj = { }; + uint32_t bbe = MI_BATCH_BUFFER_END; + igt_spin_t *hang; + unsigned int i; + uint32_t ctx; + + gem_quiescent_gpu(fd); + + igt_require(i915_reset_control(flags & TEST_WEDGE ? + false : true)); + + ctx = context_create_safe(fd); + + hang = spin_sync(fd, ctx0, 0); + + obj.handle = gem_create(fd, 4096); + gem_write(fd, obj.handle, 0, &bbe, sizeof(bbe)); + + execbuf.buffers_ptr = to_user_pointer(&obj); + execbuf.buffer_count = 1; + execbuf.rsvd1 = ctx0; + + for (i = 0; i < 10; i++) + gem_execbuf(fd, &execbuf); + + igt_assert_eq(__check_wait(fd, obj.handle, 100e3), 0); + + igt_assert(i915_reset_control(true)); + trigger_reset(fd); + + gem_quiescent_gpu(fd); + + execbuf.rsvd1 = ctx; + for (i = 0; i < 5; i++) + gem_execbuf(fd, &execbuf); + + execbuf.rsvd1 = ctx0; + for (i = 0; i < 5; i++) + gem_execbuf(fd, &execbuf); + + gem_sync(fd, obj.handle); + igt_spin_batch_free(fd, hang); + gem_context_destroy(fd, ctx); + gem_close(fd, obj.handle); + + } + + gem_context_destroy(fd, ctx0); +} + static int fd = -1; static void @@ -635,6 +691,12 @@ igt_main igt_subtest("in-flight-suspend") test_inflight_suspend(fd); + igt_subtest("context-destroyer") + test_context_destroyer(fd, 0); + + igt_subtest("context-destroyer-wedge") + test_context_destroyer(fd, TEST_WEDGE); + igt_subtest_group { const struct { unsigned int wait;