From patchwork Thu Jul 13 14:04:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9838533 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 9E49D60392 for ; Thu, 13 Jul 2017 14:05:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F0262850E for ; Thu, 13 Jul 2017 14:05:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 832A6286B2; Thu, 13 Jul 2017 14:05:45 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 06F1C2850E for ; Thu, 13 Jul 2017 14:05:45 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5A9FB6E61E; Thu, 13 Jul 2017 14:05:44 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id B437A6E61E for ; Thu, 13 Jul 2017 14:05:42 +0000 (UTC) X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from localhost (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP (TLS) id 7752757-1500050 for multiple; Thu, 13 Jul 2017 15:05:00 +0100 MIME-Version: 1.0 To: Jiri Slaby , "Hans de Goede" From: Chris Wilson In-Reply-To: <2007195d-6663-867a-ecc3-03d2d348fb72@gmail.com> References: <20161109172600.GB9300@nuc-i3427.alporthouse.com> <2007195d-6663-867a-ecc3-03d2d348fb72@gmail.com> Message-ID: <149995469805.29380.5405466287939095053@mail.alporthouse.com> User-Agent: alot/0.3.6 Subject: Re: 4.9-rc1 lockdep warning suggesting a deadlock between nouveau and i915 with prime video outputs active Date: Thu, 13 Jul 2017 15:04:58 +0100 Cc: Peter Zijlstra , Ingo Molnar , Ben Skeggs , 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 Quoting Jiri Slaby (2017-07-13 14:57:31) > Stealing this thread as an opensuse user hit that too: > https://bugzilla.suse.com/show_bug.cgi?id=1045105 It's a false positive. I did once upon a time send some patches to move the lockdep warning to kref so that didn't need to call it from drm before an unlocked path. Basically you want Though now we probably want to move that might_lock() into refcount. -Chris diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c index 8dc11064253d..3118aed844f1 100644 --- a/drivers/gpu/drm/drm_gem.c +++ b/drivers/gpu/drm/drm_gem.c @@ -826,7 +826,6 @@ drm_gem_object_put_unlocked(struct drm_gem_object *obj) return; dev = obj->dev; - might_lock(&dev->struct_mutex); if (dev->driver->gem_free_object_unlocked) kref_put(&obj->refcount, drm_gem_object_free); diff --git a/include/linux/kref.h b/include/linux/kref.h index 29220724bf1c..4b1133cd5d20 100644 --- a/include/linux/kref.h +++ b/include/linux/kref.h @@ -77,6 +77,8 @@ static inline int kref_put_mutex(struct kref *kref, void (*release)(struct kref *kref), struct mutex *lock) { + might_lock(lock); + if (refcount_dec_and_mutex_lock(&kref->refcount, lock)) { release(kref); return 1;