Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1202872pxb; Thu, 4 Feb 2021 07:23:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJwRr44Qj8pGqI7dkSv/MpNtOaKrfCFEO0HE0ZoHFK8Peeg/fNIUGRnKjnIwgticzBgqSR4I X-Received: by 2002:a17:906:8292:: with SMTP id h18mr8312502ejx.342.1612452233701; Thu, 04 Feb 2021 07:23:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612452233; cv=none; d=google.com; s=arc-20160816; b=rw5RzQHUIrIUqTIS8YWJR0A5AG5Ye97RjXPTAwNVidE3evZhZvVApnpOC6rGM61JvB v2/fzrtOQrKwBejhGS3xD+I/Ux8hOCpPtIl4/UqF55e2oEtECzBOfTmaJx4mba3asPW5 KQ3EYrkw/5NcIaCErw7Y0uTATWTraiEm9huDAyH0pXlwosm+8QiV4i7zt0y/doYf3h5r azSCYFLw0qOIKN44UDnirh92maplCm7TWvzzeUlGXZmqcXgj3ADcP6+P+VaYnYqpD7Vq lGiLycDpXi/xxQVNY4OgxshFAltgwB7Hk+iBze1vgZwbEsF4Yn6EtpXvLWqzWHyAyxzn 3wDQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=lpfJPe/1tU+7DzTf4KYc1pV9RSxza5H3pS4oizaxjuc=; b=Qjm8xYC1XC+k0+5OQB6xe7Mp3D9OOpFNV9XYS3ZNVfRxHdfoteFva4u07lB8gMfBsp BWFl5+l6OjdIeFPF6Ju4QoVndelerInhYX4rgCUbn/TEYaq7bkDiljfg5uqlbEadcu3g /dU33QiRceeQT9LCLGkNXvy5kjdvkJzL2qOchI+J+1kWuK38nIUXVJcZPrkGwGtn1a4e RfSv8fdH9yr4LmjCYHM2o/Onndq6jyHnezoCeC/ge9OHX5GQ/yA3F55AmTMQ8xVowYh/ wIJNiNbM3i181dVYO6v87EtomTEPlg84EeQDO63spQxR2X3xkdfklhD8uFoUmxhWoB11 NWXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=HcCeGBGJ; 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 i4si3317325ejg.48.2021.02.04.07.23.28; Thu, 04 Feb 2021 07:23:53 -0800 (PST) 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=HcCeGBGJ; 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 S237214AbhBDPTe (ORCPT + 99 others); Thu, 4 Feb 2021 10:19:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36418 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237236AbhBDPSk (ORCPT ); Thu, 4 Feb 2021 10:18:40 -0500 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 95EDEC061786 for ; Thu, 4 Feb 2021 07:18:00 -0800 (PST) Received: by mail-wr1-x430.google.com with SMTP id a1so3955075wrq.6 for ; Thu, 04 Feb 2021 07:18:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=lpfJPe/1tU+7DzTf4KYc1pV9RSxza5H3pS4oizaxjuc=; b=HcCeGBGJsMKx9yLKPrbfI+qpmPRZoIkJQeDpi0L9B/qg48Sp9HqgwH4gNJpK0bECyq zk+eFwNrB0sB4xpAcFmrm++/3Fk1dfCl0mOyOPMG4vdT1nynBruqqtQCIzsMGQP14+aN fpa6ojnGDSvQaNthY/dZXaE3//+3Ry3GIwJpE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=lpfJPe/1tU+7DzTf4KYc1pV9RSxza5H3pS4oizaxjuc=; b=ijgviGkeyDM5O/w+KUFNI8y2o7Bdjbog1/dH9+BT4AbqTWDZ7PELhtRqQGNeci/9g1 CrC2vkh97bf8gwtapn+Csg+8LV+7OdpWokYUGntKF8FuRMtsGyIEMnR3xzSG1aw3Qa19 eAizRG/OZrSCjUItLY5nA9psAtfbC2j4IAWawcNGF3WtxqJVI4BmEiAmZOHZ65ft8El6 iOJwfN/fE3dsO9o8apijVQeEHXCZtH1BeAcJ2/VO9/AGghXRovgYBFfky/NV20MWMGH6 TPb+YZMMcIOdf/FC6lZ0xFsMAHqTvjRiln/obsV1l12fCYJUzMNUuT5p2UJm08wdsKme M5Tg== X-Gm-Message-State: AOAM530ZA/PaLS0f2h8yDX7ysoJysR2WMU9vuztC9myKMqizHi/IS4/H gtT8mnSQR/XOabz4nZdJYwMJPA== X-Received: by 2002:adf:dd45:: with SMTP id u5mr9836389wrm.392.1612451879310; Thu, 04 Feb 2021 07:17:59 -0800 (PST) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id w15sm8097023wrp.15.2021.02.04.07.17.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Feb 2021 07:17:58 -0800 (PST) Date: Thu, 4 Feb 2021 16:17:56 +0100 From: Daniel Vetter To: Rob Clark Cc: Stephen Boyd , Krishna Manikandan , freedreno , Linux Kernel Mailing List , dri-devel , linux-arm-msm Subject: Re: [PATCH] drm/msm/kms: Make a lock_class_key for each crtc mutex Message-ID: Mail-Followup-To: Rob Clark , Stephen Boyd , Krishna Manikandan , freedreno , Linux Kernel Mailing List , dri-devel , linux-arm-msm References: <20210125234901.2730699-1-swboyd@chromium.org> <161238950899.76967.16385691346035591773@swboyd.mtv.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Operating-System: Linux phenom 5.7.0-1-amd64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 03, 2021 at 02:11:09PM -0800, Rob Clark wrote: > 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. Hm good point, tbh the mutex_lock_nested annotations isn't super awesome either, it would be kinda neat if we could put that annotation into mutex_lock_init fairly statically (and at that point we could allos resize the array fairly easily I think at runtime). The nice thing with the nesting index is just that it makes it a bit more obvious that there's a static nesting going on and why it's ok. -Daniel > 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 -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch