From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 416BDC433F5 for ; Thu, 7 Oct 2021 13:26:55 +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 D940660ED6 for ; Thu, 7 Oct 2021 13:26:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D940660ED6 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=lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 61EDF6F49D; Thu, 7 Oct 2021 13:26:52 +0000 (UTC) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by gabe.freedesktop.org (Postfix) with ESMTPS id A036E6F49B for ; Thu, 7 Oct 2021 13:26:50 +0000 (UTC) X-IronPort-AV: E=McAfee;i="6200,9189,10129"; a="206367344" X-IronPort-AV: E=Sophos;i="5.85,354,1624345200"; d="scan'208";a="206367344" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2021 06:26:50 -0700 X-IronPort-AV: E=Sophos;i="5.85,354,1624345200"; d="scan'208";a="440264990" Received: from ibanaga-mobl.ger.corp.intel.com (HELO thellstr-mobl1.intel.com) ([10.249.254.250]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Oct 2021 06:26:49 -0700 From: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= To: dri-devel@lists.freedesktop.org Cc: =?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , =?UTF-8?q?Christian=20K=C3=B6nig?= Subject: [RFC PATCH 1/2] drm/amdgpu: Move dma_resv waiting outside the notifier lock Date: Thu, 7 Oct 2021 15:26:29 +0200 Message-Id: <20211007132630.495184-2-thomas.hellstrom@linux.intel.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211007132630.495184-1-thomas.hellstrom@linux.intel.com> References: <20211007132630.495184-1-thomas.hellstrom@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" While the range notifier is executing, we have the write-side mmu interval seqlock, and mmu_interval_read_retry() is always returning true, which means that if amdgpu_cs_submit grabs the notifier lock during the fence wait, it will retry anyway when checking the userptr validity and block when retrying in mmu_interval_read_begin(). (See the extensive comments in mmu_interval_read_begin()) Hence we can release the notifier lock before the fence wait and avoid a device-wide command submission block during invalidation. Cc: Christian König Signed-off-by: Thomas Hellström --- drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c index 4b153daf283d..d3d340a6129c 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c @@ -75,9 +75,10 @@ static bool amdgpu_mn_invalidate_gfx(struct mmu_interval_notifier *mni, mmu_interval_set_seq(mni, cur_seq); + mutex_unlock(&adev->notifier_lock); + r = dma_resv_wait_timeout(bo->tbo.base.resv, true, false, MAX_SCHEDULE_TIMEOUT); - mutex_unlock(&adev->notifier_lock); if (r <= 0) DRM_ERROR("(%ld) failed to wait for user bo\n", r); return true; -- 2.31.1