Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, HK_RANDOM_FROM,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5A86BC433E0 for ; Fri, 12 Jun 2020 15:04:21 +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 3847220838 for ; Fri, 12 Jun 2020 15:04:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3847220838 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 F0D9F6E124; Fri, 12 Jun 2020 15:04:19 +0000 (UTC) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8BB3A6E12E for ; Fri, 12 Jun 2020 15:04:19 +0000 (UTC) IronPort-SDR: xpV4D7W4cRhYiaO0JnhdpjIWKgk65Dt7lRolUHQ80uXR7/m2Xp6ChjAimWTYtdYsgiFmIplBEI hil6r6G1sDPw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2020 08:04:19 -0700 IronPort-SDR: MyjwuGDKg6HVJZrwQcZoLhvSTtFVxxkVcKRrFiic1utBkfXhO3Lm6k7VmXQLCYMZsW0BNy/cGU dE2ZVhzxUuQQ== X-IronPort-AV: E=Sophos;i="5.73,503,1583222400"; d="scan'208";a="350545863" Received: from yravenna-mobl1.ger.corp.intel.com (HELO [10.214.202.53]) ([10.214.202.53]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2020 08:04:17 -0700 To: Chris Wilson , Intel-gfx@lists.freedesktop.org References: <20200612144451.9081-1-tvrtko.ursulin@linux.intel.com> <159197375511.30615.9988513440576782142@build.alporthouse.com> From: Tvrtko Ursulin Organization: Intel Corporation UK Plc Message-ID: <01688915-2e53-5fc2-54df-b8a1411fcc99@linux.intel.com> Date: Fri, 12 Jun 2020 16:04:15 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <159197375511.30615.9988513440576782142@build.alporthouse.com> Content-Language: en-US Subject: Re: [Intel-gfx] [PATCH] drm/i915/selftests: Move test flush to outside vm->mutex X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On 12/06/2020 15:55, Chris Wilson wrote: > Quoting Tvrtko Ursulin (2020-06-12 15:44:51) >> From: Tvrtko Ursulin >> >> As per our locking rules it is not allowed to wait on requests while >> holding locks. In this case we were trying to idle the GPU while holding >> the vm->mutex. > > Synchronous eviction would like to have a word. > >> Signed-off-by: Tvrtko Ursulin >> --- >> drivers/gpu/drm/i915/selftests/i915_gem_evict.c | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c >> index 028baae9631f..67f4497c8224 100644 >> --- a/drivers/gpu/drm/i915/selftests/i915_gem_evict.c >> +++ b/drivers/gpu/drm/i915/selftests/i915_gem_evict.c >> @@ -498,8 +498,6 @@ static int igt_evict_contexts(void *arg) >> >> mutex_lock(&ggtt->vm.mutex); >> out_locked: >> - if (igt_flush_test(i915)) >> - err = -EIO; >> while (reserved) { >> struct reserved *next = reserved->next; >> >> @@ -513,6 +511,9 @@ static int igt_evict_contexts(void *arg) >> mutex_unlock(&ggtt->vm.mutex); >> intel_runtime_pm_put(&i915->runtime_pm, wakeref); >> >> + if (igt_flush_test(i915)) >> + err = -EIO; > > The patch is ok, since the manual drm_mm_node reservations are not used > by the GTT, but the reason is a bit specious. We have a comment in i915_request_wait which says: /* * We must never wait on the GPU while holding a lock as we * may need to perform a GPU reset. So while we don't need to * serialise wait/reset with an explicit lock, we do want * lockdep to detect potential dependency cycles. */ And then there was a lockdep splat here https://intel-gfx-ci.01.org/tree/drm-tip/Trybot_6595/fi-skl-6700k2/igt@i915_selftest@live@evict.html, which although uses some extra lockdep annotation patches, seemed to connect the two: <4> [258.014638] Chain exists of: >->reset.mutex --> fs_reclaim --> &vm->mutex <4> [258.014640] Possible unsafe locking scenario: <4> [258.014641] CPU0 CPU1 <4> [258.014641] ---- ---- <4> [258.014642] lock(&vm->mutex); <4> [258.014642] lock(fs_reclaim); <4> [258.014643] lock(&vm->mutex); <4> [258.014644] lock(>->reset.mutex); <4> [258.014645] *** DEADLOCK *** <4> [258.014646] 2 locks held by i915_selftest/5153: Why despite the comment in request wait it does not otherwise see this I don't know. Regards, Tvrtko _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx