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=-5.5 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, 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 904BEC433DB for ; Wed, 3 Feb 2021 22:08:38 +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 4C1FA64D87 for ; Wed, 3 Feb 2021 22:08:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C1FA64D87 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com 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 A5F796EC05; Wed, 3 Feb 2021 22:08:37 +0000 (UTC) Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by gabe.freedesktop.org (Postfix) with ESMTPS id 94B0A6EC05; Wed, 3 Feb 2021 22:08:36 +0000 (UTC) Received: by mail-wr1-x429.google.com with SMTP id p15so1059358wrq.8; Wed, 03 Feb 2021 14:08:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ZJlDPDMrWIWcvU77LN9zrfIUHEDl26zI6D0g0M5VBNs=; b=KKOWlEja+/AN4ZDOQfMlGTaDqB/3f4EgGuQYgDHFonB391/crY8+r3unb4wW/tD3TT oHEnUmRHPmgfjU3GCIo7iH9fF/EGfw9ZHRGdTKmMsm8eFDvI5ynmtSVUs+mXqfW+EjRb AOzJC43ibtL00Gu7F1cyuRuUkh/tH/SNRjql146pFtizqpeIv5nPTa4PPj1SjaOZibyu t7VFDmkMEJ2GUOxm2PcgsHnlWCPHMjLxuhb3C28/VYbWXMOz8NTeRGILcfO6yc1oUOSC wv3pgZ+AXppO+vtMEztRDR2ZUdTSFtwujf2krr6GjgnflNR5jTE82rsMmBAXWJD0umND qZIg== 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=ZJlDPDMrWIWcvU77LN9zrfIUHEDl26zI6D0g0M5VBNs=; b=QFRh5Q3C6Pk/+3b/gokbff6B0FihUnKDZlQmEJP4og6yjznErt0ZG4bvmZn4VNmOkj EcKdwa/Qcap5Ic9smZhVUlXy/A2/rXemxZzl7Ga9/7Xja/1ZdlraGYM7xbrSJkIHSnQD cJi67ZF0aU2pjVKD//xSJptpfvANA3802PNVMo9hVFtlrlbaq3zTtLM7tiiwc6FmOqPy M9rp5lYXihqAI2xlItVBZETqL7pE3iF67Kyoqb/FDMGed4Xx5q7oCVvzreh8mMvLx0eC Oc3NsHD3X9th4x+2Gw48FYMN2TpliHfoLRht6pLXRngR9JSCMrS3TCB+2b9vK5e19pQS JPXw== X-Gm-Message-State: AOAM533xACZ11krIMfud6DZOgoCBt3Tn2HaA0GzYQxSIt6cBuU7pagcf 634jJzIg9i6QdaFWtEAMggXhFZzxWGoxNj4hpnQ= X-Google-Smtp-Source: ABdhPJzPuTDC2UxOsfIOLS/x+mXyaWz64C5FDMl4EEVGmPuEJH3/QBYrpUjTZy1XmvRfFdOQ3sgCQ9/RIPzy4POu7w0= X-Received: by 2002:adf:f8c8:: with SMTP id f8mr5884454wrq.132.1612390115324; Wed, 03 Feb 2021 14:08:35 -0800 (PST) MIME-Version: 1.0 References: <20210125234901.2730699-1-swboyd@chromium.org> <161238950899.76967.16385691346035591773@swboyd.mtv.corp.google.com> In-Reply-To: <161238950899.76967.16385691346035591773@swboyd.mtv.corp.google.com> From: Rob Clark Date: Wed, 3 Feb 2021 14:11:09 -0800 Message-ID: Subject: Re: [PATCH] drm/msm/kms: Make a lock_class_key for each crtc mutex To: Stephen Boyd 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: Krishna Manikandan , freedreno , Linux Kernel Mailing List , dri-devel , linux-arm-msm Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Wed, Feb 3, 2021 at 1:58 PM Stephen Boyd wrote: > > Quoting Rob Clark (2021-02-03 09:29:09) > > On Wed, Feb 3, 2021 at 2:10 AM Daniel Vetter wrote: > > > > > > On Tue, Feb 02, 2021 at 08:51:25AM -0800, Rob Clark wrote: > > > > On Tue, Feb 2, 2021 at 7:46 AM Daniel Vetter wrote: > > > > > > > > > > On Mon, Jan 25, 2021 at 03:49:01PM -0800, Stephen Boyd wrote: > > > > > > This is because lockdep thinks all the locks taken in lock_crtcs() are > > > > > > the same lock, when they actually aren't. That's because we call > > > > > > mutex_init() in msm_kms_init() and that assigns on static key for every > > > > > > lock initialized in this loop. Let's allocate a dynamic number of > > > > > > lock_class_keys and assign them to each lock so that lockdep can figure > > > > > > out an AA deadlock isn't possible here. > > > > > > > > > > > > Fixes: b3d91800d9ac ("drm/msm: Fix race condition in msm driver with async layer updates") > > > > > > Cc: Krishna Manikandan > > > > > > Signed-off-by: Stephen Boyd > > > > > > > > > > This smells like throwing more bad after initial bad code ... > > > > > > > > > > First a rant: https://blog.ffwll.ch/2020/08/lockdep-false-positives.html > > > > > > Some technical on the patch itself: I think you want > > > mutex_lock_nested(crtc->lock, drm_crtc_index(crtc)), not your own locking > > > classes hand-rolled. It's defacto the same, but much more obviously > > > correct since self-documenting. > > > > hmm, yeah, that is a bit cleaner.. but this patch is already on > > msm-next, maybe I'll add a patch on top to change it > > How many CRTCs are there? The subclass number tops out at 8, per > MAX_LOCKDEP_SUBCLASSES so if we have more than that many bits possible > then it will fail. conveniently MAX_CRTCS is 8.. realistically I don't *think* you'd ever see more than 2 or 3 BR, -R _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel