Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp2100059ybg; Fri, 5 Jun 2020 05:44:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQ285xYiMWZsi/bzgO2uyTJkg81cL3WqSa8gA6apNUnqLDi96KbiAs3sUTp/FhWpcwtoQ9 X-Received: by 2002:a05:6402:1a48:: with SMTP id bf8mr9249164edb.133.1591361054333; Fri, 05 Jun 2020 05:44:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591361054; cv=none; d=google.com; s=arc-20160816; b=yTPI+/X3rx7+ADcCnNkzoZH3eO7BO7ZW1aTjoIBWQR/zDNRr7jTeKUxGwlOWW18oYF WBo9JixPlHx8FtQjWQvg6JMbGKIfI7JhJm90PTkwuVuZ9roXKzQ0VV91rjySlZVrY285 ZNXF2h/sN3PdaQr2bxSjE02GLxgAt4aFkigHte0wtWUNNTaYeh3WzvsOgRJ7itSUMt7B lbEjS9FGoF2wmU143Vbl6wUVpWCWkOWKim0xsBLCeRwbZ+0d0oJVUzeqv4WBvCuqP/d+ RYOB0Xjz4VbNg1h0kRxmiDadxlUz3K6gP0Vlk5HXlkH0UaBL/jY+8UXbx1GYK8Co5z+c 183A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=b8lHa3VSsS3EH4GstrmtufuSPQnby9wIaLbKSXX2gR4=; b=vUvTUEjQk8fMNTTUXI17GHYCgffb+/qBMZvkc0tzzn7A0AZPVjv/DYvmTYDHQuAnOS Fa0+ff50DUg/rVXr67cDX0Xo6sweAw1MP2c5aqQfcsb1axkNhMtuTOe6Iv1QW36XeJdP Nr+Om0B29Bih9nwkpLMEtSigXobK1YG8SuuS37UWaNIl5AFWQFjshY+dTdU9Qw5qplOi RoQSiZ2yZFUP90Cfg/QgtsLbLNWKEDrU968JBsMc+WOY/VIhFUVlxX3bly7nQ8nEl1Td enz1ZGomWxwwzodJHUQjst8kOxk11736JdM4DVx2sBOxThzHL2CGhpLUmQknRzaM71h3 eVhQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=Y0FSL3jo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k16si3554888ejs.546.2020.06.05.05.43.51; Fri, 05 Jun 2020 05:44:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=Y0FSL3jo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726711AbgFEMls (ORCPT + 99 others); Fri, 5 Jun 2020 08:41:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726537AbgFEMlr (ORCPT ); Fri, 5 Jun 2020 08:41:47 -0400 Received: from mail-oi1-x242.google.com (mail-oi1-x242.google.com [IPv6:2607:f8b0:4864:20::242]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8063AC08C5C4 for ; Fri, 5 Jun 2020 05:41:46 -0700 (PDT) Received: by mail-oi1-x242.google.com with SMTP id c194so8085437oig.5 for ; Fri, 05 Jun 2020 05:41:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=b8lHa3VSsS3EH4GstrmtufuSPQnby9wIaLbKSXX2gR4=; b=Y0FSL3jop1Ktvp+81IKa884hHcJEOFCxyltl1k0MHEops3eSwWVVNdvKPpCE7Zx9WU //QeTiDmbXPc/dqdkmu7fHeWYxTzH103/85ltphoFY/gEm8OQl2oqXW4w61a7KN1Jhgb CSloh85q5YYyHCGG2UV5knxi5s6dBfhtE6irk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=b8lHa3VSsS3EH4GstrmtufuSPQnby9wIaLbKSXX2gR4=; b=WNbJhFEcQOR2X0qZVcArvoDdfX8kdO2QSKdlx7vBhic1ntv3Xok9mwzc+k2/C/2H9x 7ktWMeUbXF1AOuCnXuw7S9/MGFuIX+Vire9L0l5h8OG2zC52hfCwypL0u6YMquuwMoMI 0+2js2tUxxA1ZZGY7CF0pKZkNB0EVi+gZjfzmzwfb4jJS4bpD9TTvOZ4qvdRxFXHYPcd sosKigin8GjTSuVq1j7ErwSN/N/l6KrLC0ua6TNyesJqF8yydITgGfmeRwuatpErWxp0 m6UingOsHfUhMyRxiPrpCjOc0lDSCIuvWrhrykSLNnJbSoqkzDxZGdhn80uOXaGKIRw2 wfWA== X-Gm-Message-State: AOAM530q0WBwZxhtFMXFKQeECapQfEkIV5jHAZMZ7y4NJEFwiPDXgDX5 tlrmKTLkXz36EadONomrPqOWKQn4k8ND5ilnvMICJQ== X-Received: by 2002:aca:ed42:: with SMTP id l63mr1645633oih.101.1591360905783; Fri, 05 Jun 2020 05:41:45 -0700 (PDT) MIME-Version: 1.0 References: <20200604081224.863494-1-daniel.vetter@ffwll.ch> <20200604081224.863494-14-daniel.vetter@ffwll.ch> In-Reply-To: From: Daniel Vetter Date: Fri, 5 Jun 2020 14:41:34 +0200 Message-ID: Subject: Re: [PATCH 13/18] drm/amdgpu/dc: Stop dma_resv_lock inversion in commit_tail To: Pierre-Eric Pelloux-Prayer Cc: DRI Development , linux-rdma , Intel Graphics Development , Maarten Lankhorst , LKML , amd-gfx list , Chris Wilson , "moderated list:DMA BUFFER SHARING FRAMEWORK" , Daniel Vetter , =?UTF-8?Q?Christian_K=C3=B6nig?= , "open list:DMA BUFFER SHARING FRAMEWORK" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 5, 2020 at 10:30 AM Pierre-Eric Pelloux-Prayer wrote: > > Hi Daniel, > > On 04/06/2020 10:12, Daniel Vetter wrote: > [...] > > @@ -6910,7 +6910,11 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, > > * explicitly on fences instead > > * and in general should be called for > > * blocking commit to as per framework helpers > > + * > > + * Yes, this deadlocks, since you're calling dma_resv_lock in a > > + * path that leads to a dma_fence_signal(). Don't do that. > > */ > > +#if 0 > > r = amdgpu_bo_reserve(abo, true); > > if (unlikely(r != 0)) > > DRM_ERROR("failed to reserve buffer before flip\n"); > > @@ -6920,6 +6924,12 @@ static void amdgpu_dm_commit_planes(struct drm_atomic_state *state, > > tmz_surface = amdgpu_bo_encrypted(abo); > > > > amdgpu_bo_unreserve(abo); > > +#endif > > + /* > > + * this races anyway, so READ_ONCE isn't any better or worse > > + * than the stuff above. Except the stuff above can deadlock. > > + */ > > + tiling_flags = READ_ONCE(abo->tiling_flags); > > With this change "tmz_surface" won't be initialized properly. > Adding the following line should fix it: > > tmz_surface = READ_ONCE(abo->flags) & AMDGPU_GEM_CREATE_ENCRYPTED; So to make this clear, I'm not really proposing to fix up all the drivers in detail. There's a lot more bugs in all the other drivers, I'm pretty sure. The driver fixups really are just quick hacks to illustrate the problem, and at least in some cases, maybe illustrate a possible solution. For the real fixes I think this needs driver teams working on this, and make sure it's all solid. I can help a bit with review (especially for placing the annotations, e.g. the one I put in cs_submit() annotates a bit too much), but that's it. Also I think the patch is from before tmz landed, and I just blindly rebased over it :-) -Daniel > > > Pierre-Eric > > > > > > fill_dc_plane_info_and_addr( > > dm->adev, new_plane_state, tiling_flags, > > -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch