From patchwork Thu Jun 27 11:38:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Lankhorst X-Patchwork-Id: 2791911 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 D17239F3A0 for ; Thu, 27 Jun 2013 11:43:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A8E922028A for ; Thu, 27 Jun 2013 11:43:40 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B3FE72027C for ; Thu, 27 Jun 2013 11:43:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B08BBE63BD for ; Thu, 27 Jun 2013 04:43:39 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wg0-f45.google.com (mail-wg0-f45.google.com [74.125.82.45]) by gabe.freedesktop.org (Postfix) with ESMTP id B836DE6298 for ; Thu, 27 Jun 2013 04:39:05 -0700 (PDT) Received: by mail-wg0-f45.google.com with SMTP id j13so485199wgh.24 for ; Thu, 27 Jun 2013 04:39:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=ssEXvYYAlZJ7xqxCKQrMHvlREP2cYjlz0Wyy7O4vu3c=; b=lN1obM7C/4VZSVK3CUu9PY3Mi0zqUgxW/YZAMzBzxzj4aKZuelSr3eceN3TsParQVo pbHdLWLUx5VY83pD+HSgkQq9enSGgap+WzdPVbJ11nu+WlTwTtMMtBI2Q569NX/Byqpi fMTqdmp8yvlQ6m1uwPXgx37rXUScLxGfZhBf59nQ79E0F/yHCv+Gv1oVQfkB656L3InR SQ6F++nb2rzEpKMNRaE27dLn4Zhe+TIqVMrD24LL1v4jKri1jKpxoW+V4701fkTnZV7O leF6tD2iIdBFUZq4dBsRlSWdeF7SnhEvLiXC475EWwCIFjo/Y4rD35EeY/DvNxHp/a+T ok/w== X-Received: by 10.180.80.6 with SMTP id n6mr5971869wix.59.1372333144922; Thu, 27 Jun 2013 04:39:04 -0700 (PDT) Received: from localhost (5ED49945.cm-7-5c.dynamic.ziggo.nl. [94.212.153.69]) by mx.google.com with ESMTPSA id b20sm3042201wiw.4.2013.06.27.04.39.03 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 27 Jun 2013 04:39:04 -0700 (PDT) Received: by localhost (sSMTP sendmail emulation); Thu, 27 Jun 2013 13:39:02 +0200 From: Maarten Lankhorst To: Dave Airlie Subject: [PATCH 5/9] drm/nouveau: complain loudly if buffer is pinned during destruction Date: Thu, 27 Jun 2013 13:38:22 +0200 Message-Id: <1372333106-28910-5-git-send-email-maarten.lankhorst@canonical.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1372333106-28910-1-git-send-email-maarten.lankhorst@canonical.com> References: <1372333106-28910-1-git-send-email-maarten.lankhorst@canonical.com> Cc: dri-devel@lists.freedesktop.org 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 X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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); }