From patchwork Thu Oct 23 09:32:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Christian_K=C3=B6nig?= X-Patchwork-Id: 5138781 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id EF09B9F349 for ; Thu, 23 Oct 2014 09:32:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2847C2025B for ; Thu, 23 Oct 2014 09:32:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 3D9212025A for ; Thu, 23 Oct 2014 09:32:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CF2E26E381; Thu, 23 Oct 2014 02:32:47 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from pegasos-out.vodafone.de (pegasos-out.vodafone.de [80.84.1.38]) by gabe.freedesktop.org (Postfix) with ESMTP id 40AD96E381 for ; Thu, 23 Oct 2014 02:32:47 -0700 (PDT) Received: from localhost (localhost.localdomain [127.0.0.1]) by pegasos-out.vodafone.de (Rohrpostix1 Daemon) with ESMTP id 917A626075D; Thu, 23 Oct 2014 11:32:45 +0200 (CEST) X-Virus-Scanned: amavisd-new at vodafone.de X-Spam-Score: -0.043 X-Spam-Level: X-Spam-Status: No, score=-5.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Authentication-Results: rohrpostix1.prod.vfnet.de (amavisd-new); dkim=pass header.i=@vodafone.de Received: from pegasos-out.vodafone.de ([127.0.0.1]) by localhost (rohrpostix1.prod.vfnet.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id QCIAkg41s+bB; Thu, 23 Oct 2014 11:32:44 +0200 (CEST) Received: from smtp-01.vodafone.de (smtp-01.vodafone.de [10.215.254.34]) by pegasos-out.vodafone.de (Rohrpostix1 Daemon) with ESMTP id 33F86261412; Thu, 23 Oct 2014 11:32:44 +0200 (CEST) X-DKIM: OpenDKIM Filter v2.6.8 pegasos-out.vodafone.de 33F86261412 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vodafone.de; s=mail; t=1414056764; bh=V5L5PahU06LmhmzGt8GtGO6H0nOX8fl6FUh5uDbuub4=; h=From:To:Cc:Subject:Date; b=ie5mPE8djubunnYS0N2TiW3Yvv998oKR/xQgQhcj4u7rP6/CNRVb0xaDhKc/7EiYx Vp+im4JSvfx2A/HXYD3m/yhzQoKed/m+WaFIFrcNlRp+aGCYrqBhtDDiaN6/PnOW1i RnBSRzelKJQvHdNfbsS97/LHSvVM8Q4fYNPSFvOA= X-Virus-Scanned: amavisd-new at vodafone.de Received: from smtp-01.vodafone.de ([127.0.0.1]) by localhost (xsmail-dmz3.prod.vfnet.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id T3I2fsVpr4YI; Thu, 23 Oct 2014 11:32:38 +0200 (CEST) From: =?UTF-8?q?Christian=20K=C3=B6nig?= To: alexdeucher@gmail.com Subject: [PATCH] drm/radeon: fix vm lock in radeon_gem_va_update_vm Date: Thu, 23 Oct 2014 11:32:38 +0200 Message-Id: <1414056758-2267-1-git-send-email-deathsimple@vodafone.de> X-Mailer: git-send-email 1.9.1 MIME-Version: 1.0 Cc: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 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-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Christian König Without the lock we might corrupt the BO lists. Might be squashed into "update the VM after setting BO address" for upstreaming. Signed-off-by: Christian König --- drivers/gpu/drm/radeon/radeon_gem.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/radeon_gem.c b/drivers/gpu/drm/radeon/radeon_gem.c index 0002575..49d56b5 100644 --- a/drivers/gpu/drm/radeon/radeon_gem.c +++ b/drivers/gpu/drm/radeon/radeon_gem.c @@ -559,12 +559,16 @@ static void radeon_gem_va_update_vm(struct radeon_device *rdev, goto error_unreserve; } + mutex_lock(&bo_va->vm->mutex); r = radeon_vm_clear_freed(rdev, bo_va->vm); if (r) - goto error_unreserve; + goto error_unlock; r = radeon_vm_bo_update(rdev, bo_va, &bo_va->bo->tbo.mem); +error_unlock: + mutex_unlock(&bo_va->vm->mutex); + error_unreserve: ttm_eu_backoff_reservation(&ticket, &list);