From patchwork Tue Apr 9 11:37:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Lankhorst X-Patchwork-Id: 2414701 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 205583FD8C for ; Tue, 9 Apr 2013 11:42:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 15B30E60D3 for ; Tue, 9 Apr 2013 04:42:46 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wi0-f182.google.com (mail-wi0-f182.google.com [209.85.212.182]) by gabe.freedesktop.org (Postfix) with ESMTP id 963D1E60D3 for ; Tue, 9 Apr 2013 04:38:11 -0700 (PDT) Received: by mail-wi0-f182.google.com with SMTP id hi18so3549900wib.3 for ; Tue, 09 Apr 2013 04:38:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=iypekwhufdTM/5KBQk+4U4WtIscaLGbdO13r/eXnZzA=; b=jeApDTsQfOpJDVR1aZ8LK1a1uF+hRdWwxJm3Dtg1ZiyPei/Yzuwu9osIXfH0QrcsU5 wzZbaK/SuGbRe13SICX6jT/yIOvgHyVJI2aR7cxfmP/vmZ/SB5huZNbG+fqcF8Zqg6Ug +XArJf+gWKC01xgbm+3UT1m6g1kMiL45QRuGZG/lRlCrR/OSyehcP5ocVRMigJmHxbut BzFLYcm1Opmi8na0eOBUXyZJ5yfjqYyKBjQ3ABfZ9V7t8KY1TL5YhLhRnUablQOJt1YI 2JGrWSKuK+hat7ozrYwPOACWmGSnU5eF+lfdmmjqqj9Mj1xPnQ4qB4J+CKiv9fWDoXeb em7g== X-Received: by 10.194.176.228 with SMTP id cl4mr17618772wjc.10.1365507490775; Tue, 09 Apr 2013 04:38:10 -0700 (PDT) Received: from localhost (5ED48CEF.cm-7-5c.dynamic.ziggo.nl. [94.212.140.239]) by mx.google.com with ESMTPS id ed6sm28219056wib.9.2013.04.09.04.38.08 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 09 Apr 2013 04:38:10 -0700 (PDT) Received: by localhost (sSMTP sendmail emulation); Tue, 09 Apr 2013 13:38:08 +0200 From: Maarten Lankhorst To: dri-devel@lists.freedesktop.org Subject: [PATCH 7/7] drm/nouveau: complain loudly if buffer is pinned during destruction Date: Tue, 9 Apr 2013 13:37:46 +0200 Message-Id: <1365507466-11586-7-git-send-email-maarten.lankhorst@canonical.com> X-Mailer: git-send-email 1.8.2 In-Reply-To: <1365507466-11586-1-git-send-email-maarten.lankhorst@canonical.com> References: <1365507466-11586-1-git-send-email-maarten.lankhorst@canonical.com> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Shouldn't happen, and we invert the struct_mutex with reservation here, potentially leading to deadlocks. Once reservations become lockdep annotated, lockdep will go splat on this. Signed-off-by: Maarten Lankhorst --- drivers/gpu/drm/nouveau/nouveau_gem.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/nouveau/nouveau_gem.c b/drivers/gpu/drm/nouveau/nouveau_gem.c index b4b4d0c..7054706 100644 --- a/drivers/gpu/drm/nouveau/nouveau_gem.c +++ b/drivers/gpu/drm/nouveau/nouveau_gem.c @@ -50,7 +50,8 @@ nouveau_gem_object_del(struct drm_gem_object *gem) return; nvbo->gem = NULL; - if (unlikely(nvbo->pin_refcnt)) { + /* Lockdep hates you for doing reserve with gem object lock held */ + if (WARN_ON_ONCE(nvbo->pin_refcnt)) { nvbo->pin_refcnt = 1; nouveau_bo_unpin(nvbo); }