From patchwork Wed May 1 08:52:44 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maarten Lankhorst X-Patchwork-Id: 2507281 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork2.kernel.org (Postfix) with ESMTP id E4723DF230 for ; Wed, 1 May 2013 09:01:01 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0DABDE622C for ; Wed, 1 May 2013 02:01:02 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-we0-f179.google.com (mail-we0-f179.google.com [74.125.82.179]) by gabe.freedesktop.org (Postfix) with ESMTP id 26355E6164 for ; Wed, 1 May 2013 01:53:06 -0700 (PDT) Received: by mail-we0-f179.google.com with SMTP id u7so1106497wey.10 for ; Wed, 01 May 2013 01:53:06 -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=iBoCDqn2K08lSaQ40/B/7nRJspzEW/i3rKEZn/Wdtvk=; b=l8onG9uX82opXDBgyIFJg9pzIt6yKl+vToEMrPsgSA1qEYko5Mmoq1877QW+vl9bqa h03tMGRVIS5WG2ArM/VysXHWfZVURnHI4t6bpxRf1v6ZDC1dQCd5lT0JubGffygQduRq 4gJEV/vG9+NJ16AQLatrlJqjIVXUT4QoufGHEBOpo9VSGDKwDgUrCO/c9Z4tB3VZB51W zZVScu30bMC5TUvbX21Wht09Lx/nGmQzvt6SPh2Jrquvnf2+uIY76Osi7fci+uLkF+vw YI4ATq+1PS/APEwDH4g9WxROFRD2qAil+ajwiib8OIavTBj8J0CWA3V4e+h1rY7FEhGM 7siw== X-Received: by 10.194.7.68 with SMTP id h4mr1779489wja.49.1367398386296; Wed, 01 May 2013 01:53:06 -0700 (PDT) Received: from localhost (5ED49945.cm-7-5c.dynamic.ziggo.nl. [94.212.153.69]) by mx.google.com with ESMTPSA id fa6sm2438726wic.9.2013.05.01.01.53.04 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 01 May 2013 01:53:05 -0700 (PDT) Received: by localhost (sSMTP sendmail emulation); Wed, 01 May 2013 10:53:03 +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: Wed, 1 May 2013 10:52:44 +0200 Message-Id: <1367398364-28997-7-git-send-email-maarten.lankhorst@canonical.com> X-Mailer: git-send-email 1.8.2.2 In-Reply-To: <1367398364-28997-1-git-send-email-maarten.lankhorst@canonical.com> References: <1367398364-28997-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); }