From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37317C2BA19 for ; Tue, 14 Apr 2020 08:15:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 1DF14206E9 for ; Tue, 14 Apr 2020 08:15:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2407062AbgDNIO7 convert rfc822-to-8bit (ORCPT ); Tue, 14 Apr 2020 04:14:59 -0400 Received: from mail.fireflyinternet.com ([109.228.58.192]:60245 "EHLO fireflyinternet.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2407053AbgDNIO5 (ORCPT ); Tue, 14 Apr 2020 04:14:57 -0400 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 20891787-1500050 for multiple; Tue, 14 Apr 2020 09:13:30 +0100 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8BIT In-Reply-To: <20200407062622.6443-2-sultan@kerneltoast.com> References: <20200407062622.6443-1-sultan@kerneltoast.com> <20200407062622.6443-2-sultan@kerneltoast.com> To: Sultan Alsawaf , stable@vger.kernel.org Subject: Re: [PATCH 1/1] drm/i915: Fix ref->mutex deadlock in i915_active_wait() From: Chris Wilson Cc: Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , David Airlie , Daniel Vetter , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Sultan Alsawaf Message-ID: <158685200854.16269.9481176231557533815@build.alporthouse.com> User-Agent: alot/0.8.1 Date: Tue, 14 Apr 2020 09:13:28 +0100 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Quoting Sultan Alsawaf (2020-04-07 07:26:22) > From: Sultan Alsawaf > > The following deadlock exists in i915_active_wait() due to a double lock > on ref->mutex (call chain listed in order from top to bottom): > i915_active_wait(); > mutex_lock_interruptible(&ref->mutex); <-- ref->mutex first acquired > i915_active_request_retire(); > node_retire(); > active_retire(); > mutex_lock_nested(&ref->mutex, SINGLE_DEPTH_NESTING); <-- DEADLOCK > > Fix the deadlock by skipping the second ref->mutex lock when > active_retire() is called through i915_active_request_retire(). > > Fixes: 12c255b5dad1 ("drm/i915: Provide an i915_active.acquire callback") > Cc: # 5.4.x > Signed-off-by: Sultan Alsawaf Incorrect. You missed that it cannot retire from inside the wait due to the active reference held on the i915_active for the wait. The only point it can enter retire from inside i915_active_wait() is via the terminal __active_retire() which releases the mutex in doing so. -Chris From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4AB54C352B6 for ; Tue, 14 Apr 2020 08:13:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6BAB02072D for ; Tue, 14 Apr 2020 08:13:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6BAB02072D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=chris-wilson.co.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D572488E56; Tue, 14 Apr 2020 08:13:36 +0000 (UTC) Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0BBAA88E56; Tue, 14 Apr 2020 08:13:34 +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 20891787-1500050 for multiple; Tue, 14 Apr 2020 09:13:30 +0100 MIME-Version: 1.0 In-Reply-To: <20200407062622.6443-2-sultan@kerneltoast.com> References: <20200407062622.6443-1-sultan@kerneltoast.com> <20200407062622.6443-2-sultan@kerneltoast.com> To: Sultan Alsawaf , stable@vger.kernel.org Subject: Re: [PATCH 1/1] drm/i915: Fix ref->mutex deadlock in i915_active_wait() From: Chris Wilson Message-ID: <158685200854.16269.9481176231557533815@build.alporthouse.com> User-Agent: alot/0.8.1 Date: Tue, 14 Apr 2020 09:13:28 +0100 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Rodrigo Vivi , Sultan Alsawaf Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Quoting Sultan Alsawaf (2020-04-07 07:26:22) > From: Sultan Alsawaf > > The following deadlock exists in i915_active_wait() due to a double lock > on ref->mutex (call chain listed in order from top to bottom): > i915_active_wait(); > mutex_lock_interruptible(&ref->mutex); <-- ref->mutex first acquired > i915_active_request_retire(); > node_retire(); > active_retire(); > mutex_lock_nested(&ref->mutex, SINGLE_DEPTH_NESTING); <-- DEADLOCK > > Fix the deadlock by skipping the second ref->mutex lock when > active_retire() is called through i915_active_request_retire(). > > Fixes: 12c255b5dad1 ("drm/i915: Provide an i915_active.acquire callback") > Cc: # 5.4.x > Signed-off-by: Sultan Alsawaf Incorrect. You missed that it cannot retire from inside the wait due to the active reference held on the i915_active for the wait. The only point it can enter retire from inside i915_active_wait() is via the terminal __active_retire() which releases the mutex in doing so. -Chris _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A5CAFC2BA19 for ; Tue, 14 Apr 2020 08:13:40 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 8242B2074D for ; Tue, 14 Apr 2020 08:13:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8242B2074D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=chris-wilson.co.uk Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=intel-gfx-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 636F489CB3; Tue, 14 Apr 2020 08:13:37 +0000 (UTC) Received: from fireflyinternet.com (mail.fireflyinternet.com [109.228.58.192]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0BBAA88E56; Tue, 14 Apr 2020 08:13:34 +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 20891787-1500050 for multiple; Tue, 14 Apr 2020 09:13:30 +0100 MIME-Version: 1.0 In-Reply-To: <20200407062622.6443-2-sultan@kerneltoast.com> References: <20200407062622.6443-1-sultan@kerneltoast.com> <20200407062622.6443-2-sultan@kerneltoast.com> To: Sultan Alsawaf , stable@vger.kernel.org From: Chris Wilson Message-ID: <158685200854.16269.9481176231557533815@build.alporthouse.com> User-Agent: alot/0.8.1 Date: Tue, 14 Apr 2020 09:13:28 +0100 Subject: Re: [Intel-gfx] [PATCH 1/1] drm/i915: Fix ref->mutex deadlock in i915_active_wait() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, Sultan Alsawaf Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Quoting Sultan Alsawaf (2020-04-07 07:26:22) > From: Sultan Alsawaf > > The following deadlock exists in i915_active_wait() due to a double lock > on ref->mutex (call chain listed in order from top to bottom): > i915_active_wait(); > mutex_lock_interruptible(&ref->mutex); <-- ref->mutex first acquired > i915_active_request_retire(); > node_retire(); > active_retire(); > mutex_lock_nested(&ref->mutex, SINGLE_DEPTH_NESTING); <-- DEADLOCK > > Fix the deadlock by skipping the second ref->mutex lock when > active_retire() is called through i915_active_request_retire(). > > Fixes: 12c255b5dad1 ("drm/i915: Provide an i915_active.acquire callback") > Cc: # 5.4.x > Signed-off-by: Sultan Alsawaf Incorrect. You missed that it cannot retire from inside the wait due to the active reference held on the i915_active for the wait. The only point it can enter retire from inside i915_active_wait() is via the terminal __active_retire() which releases the mutex in doing so. -Chris _______________________________________________ Intel-gfx mailing list Intel-gfx@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/intel-gfx