From patchwork Thu Dec 15 17:10:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Nicolai_H=C3=A4hnle?= X-Patchwork-Id: 9476561 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 4843A60571 for ; Thu, 15 Dec 2016 17:11:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 354D8287B8 for ; Thu, 15 Dec 2016 17:11:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2A437287DA; Thu, 15 Dec 2016 17:11:03 +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_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 E8345287B8 for ; Thu, 15 Dec 2016 17:11:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EE08F6EA42; Thu, 15 Dec 2016 17:10:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 022B26EA36; Thu, 15 Dec 2016 17:10:31 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id g23so7776474wme.1; Thu, 15 Dec 2016 09:10:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=oeKNEwFT/ut8vaL8jzYedOrPQZkeuesb99mhQnJBQCo=; b=KfYf7dKI3sfJ76lfz29fhmfNNODO+Vs5BazZD7J9ZRhHFc3E5OIr3mCBzv6V9iewGf HpLhY4l2JW4UDhRttMxnyBCquFQVYZJYINrxIh/Cqj/Dx5vMstOQib0WDsfGYH1a1AFC wASOVTIL9czaqfExR+YTyAhQpINJ3ykGNRh/Tw4kG593e5LxXzyATJ4XKKQZjKlW46ZS 1gBL8pkZxq52JxS/g7cIACRxmxHhPnXzpCjYhbklhsAjDJ6ghr7ndoaZ1SGtQDjFsYJ5 Z8mGWQfxJ1eyW9DpJsiTp+3l8qXYpd4dbGM2zetBzowuI1mLNKu+VfH09dbRLb/GA8Uv A+gg== 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:mime-version:content-transfer-encoding; bh=oeKNEwFT/ut8vaL8jzYedOrPQZkeuesb99mhQnJBQCo=; b=kwHlz5elHNX5iJO7X5Cceue0jdPtkR2zFkFogDOEMykUtxkvKYTZ3lNQcG/Z50cNAg Jmj/q/TDFvvobfQpPrIz+dZu5SNooUgpAOCgWpF9XR3a/iIWPXbhwU+NAiDrtvj2aksb SCddb/mUoZGS80newVaIFP405/VLEaImQC10xOHsl216PeZsEFA2A21lwStrk4I+Xp3z ygOoUycYO9gSlB19CfOrSnWBv3yUa9WIZ2OlQuLM7cliuSLZ3G8NNmjVlunKH4Jk6/fy gTPmPeU/+z50+/wdUCP3lRlwbQ9sl3uuGMe/d9LhI62f2WYITyci2PopSgwvf9Ve4EcO p99w== X-Gm-Message-State: AIkVDXJNZcDn7Uy9VsrPmECdAaz4vkaikfB76vsd7hnFKAgBNr3bFbNy2c5qzjlPXgpniQ== X-Received: by 10.28.147.81 with SMTP id v78mr2552570wmd.60.1481821829188; Thu, 15 Dec 2016 09:10:29 -0800 (PST) Received: from auriga.fritz.box ([2001:a61:1106:8e01:10c0:f59e:de43:5485]) by smtp.gmail.com with ESMTPSA id d85sm13323015wmd.17.2016.12.15.09.10.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Dec 2016 09:10:28 -0800 (PST) From: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= To: amd-gfx@lists.freedesktop.org Subject: [PATCH 5/5] drm/amd/amdgpu: add check that shadow page tables are GPU-accessible Date: Thu, 15 Dec 2016 18:10:15 +0100 Message-Id: <1481821815-9971-6-git-send-email-nhaehnle@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1481821815-9971-1-git-send-email-nhaehnle@gmail.com> References: <1481821815-9971-1-git-send-email-nhaehnle@gmail.com> MIME-Version: 1.0 Cc: =?UTF-8?q?Nicolai=20H=C3=A4hnle?= , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 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" X-Virus-Scanned: ClamAV using ClamSMTP From: Nicolai Hähnle Skip amdgpu_gem_va_update_vm otherwise. Also clean up the check for the non-shadow page tables using the new helper function. This fixes a crash with the stack trace: amdgpu_gem_va_update_vm -> amdgpu_vm_update_page_directory -> amdgpu_ttm_bind -> amdgpu_gtt_mgr_alloc Signed-off-by: Nicolai Hähnle --- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c index 4e1eb05..d91c80b 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c @@ -464,26 +464,29 @@ int amdgpu_gem_metadata_ioctl(struct drm_device *dev, void *data, unreserve: amdgpu_bo_unreserve(robj); out: drm_gem_object_unreference_unlocked(gobj); return r; } static int amdgpu_gem_va_check(void *param, struct amdgpu_bo *bo) { - unsigned domain = amdgpu_mem_type_to_domain(bo->tbo.mem.mem_type); - /* if anything is swapped out don't swap it in here, just abort and wait for the next CS */ + if (!amdgpu_bo_gpu_accessible(bo)) + return -ERESTARTSYS; + + if (bo->shadow && !amdgpu_bo_gpu_accessible(bo)) + return -ERESTARTSYS; - return domain == AMDGPU_GEM_DOMAIN_CPU ? -ERESTARTSYS : 0; + return 0; } /** * amdgpu_gem_va_update_vm -update the bo_va in its VM * * @adev: amdgpu_device pointer * @bo_va: bo_va to update * * Update the bo_va directly after setting it's address. Errors are not * vital here, so they are not reported back to userspace.