Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4454306pxa; Mon, 10 Aug 2020 09:25:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxhwrcpGifuah++TqKc9hx6vaj2Mg7sjFmJXhEEhkGqTUvK4+BMFieiXTxv0nYEQm15hCk3 X-Received: by 2002:a17:906:cc4a:: with SMTP id mm10mr21707926ejb.451.1597076704912; Mon, 10 Aug 2020 09:25:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597076704; cv=none; d=google.com; s=arc-20160816; b=wQ36kViTr3hF25ZIxYFTmrWgl4rymRQsMQCNywjmf9djVm7/GjuAmjq+VgQHnpj819 4EGzxYM9fM3mreI8DZLm0UbdwawxGQboOVuzMFS7Kz7AHUB5PJs4A+vWuMzZJF097go5 KPaZWJKh63YLx1p7kP3zE5Lq7KIAznQuMYtZV4g40+p9Vof+b/BmXPMIUBi/69JK8rqo YHdvSJH/NpfjXjmu6zLDH9xOUNGvPi3o/Vw1LrkBEuVzPodxu62fyfJDxq+6NZ9bMx2b AEO4VRi6meijAqjHUaHjScAwF0wO9jFC5xo+CgbgMl278acjL2F7MBkd97X9E9RkbyVM FthQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/4ygF9SxZiPU5k12pYv/E3cH5shKUSRB3cAD100q7zQ=; b=bNXVn3yCa87megO9i+XjyP9qPpkS4gtBftWFS+6j3A5DPWZj9jb4I+r5JYsT8zhrjj c9gBJ9pbCVJ6X07c738SXT5/eJWW6bHuzSSVfp2gYHLB8UuH9C10plXnBYO0Qmw0693V u83r7GchoMmhjr+PMIBpqYGZOSGaZaHu8c+7Toha/pr8SEinn4zF90nFfvxQnM4177Da q6XHHb19eXDY4JgCjI+IaJ9IQm7QDAETi5uOZreFM1uR7gDqUjwqru64s5CU+vPjRAHs PcKXgCGl420QSI5u9qm0piwpPNVW83uUDRaBWNpwZIFCPeDW2ESEmCf4lv967yNT8pQF ZXXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=HLvO0zwn; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o5si10818653ejx.202.2020.08.10.09.24.42; Mon, 10 Aug 2020 09:25:04 -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=@kernel.org header.s=default header.b=HLvO0zwn; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727972AbgHJQXh (ORCPT + 99 others); Mon, 10 Aug 2020 12:23:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:55064 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726338AbgHJQXg (ORCPT ); Mon, 10 Aug 2020 12:23:36 -0400 Received: from localhost (fw-tnat.cambridge.arm.com [217.140.96.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A174E2083B; Mon, 10 Aug 2020 16:23:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1597076616; bh=ZKceNH2ULa9iPquC7TZxDyNWDhEer5e3FG/Ncr9/4Lg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=HLvO0zwndQbDbK9b7T4caLTKRbqThzUSbvcNFSecZvNwXXiJtzeB3Sg/TKpPp+C9i 9zeqwg0cEdhupkx7QC1+n5qpetjaSkg4TpI8JhujyDgNd0yTgDl3tt4edSJuRgWXi9 z7Kg25n2K73ncgNmp4X+aQsLMzJm5AWDjAO6HYaM= Date: Mon, 10 Aug 2020 17:23:10 +0100 From: Mark Brown To: =?utf-8?B?TWljaGHFgiBNaXJvc8WCYXc=?= Cc: Dmitry Osipenko , Liam Girdwood , linux-kernel@vger.kernel.org Subject: Re: [PATCH] regulator: simplify locking Message-ID: <20200810162310.GE6438@sirena.org.uk> References: <40871bc7-2d6c-10d4-53b3-0aded21edf3b@gmail.com> <20200809223030.GB5522@qmqm.qmqm.pl> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="9l24NVCWtSuIVIod" Content-Disposition: inline In-Reply-To: <20200809223030.GB5522@qmqm.qmqm.pl> X-Cookie: Walk softly and carry a megawatt laser. User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --9l24NVCWtSuIVIod Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Aug 10, 2020 at 12:30:30AM +0200, Micha=C5=82 Miros=C5=82aw wrote: > On Mon, Aug 10, 2020 at 12:40:04AM +0300, Dmitry Osipenko wrote: > > 10.08.2020 00:16, Micha=C5=82 Miros=C5=82aw =D0=BF=D0=B8=D1=88=D0=B5=D1= =82: > > > - mutex_lock(®ulator_nesting_mutex); > > > + if (ww_ctx || !mutex_trylock_recursive(&rdev->mutex.base)) > > Have you seen comment to the mutex_trylock_recursive()? > > https://elixir.bootlin.com/linux/v5.8/source/include/linux/mutex.h#L205 > > * This function should not be used, _ever_. It is purely for hysterica= l GEM > > * raisins, and once those are gone this will be removed. > I think that reimplementing the function just to not use it is not the > right solution. The whole locking protocol is problematic and this patch > just uncovers one side of it. OTOH if this is just making the issue more obvious rather than fixing it then it's much harder to justify adding a new usage of a function people are trying to remove. The coupled regulator stuff is definitely a mess as far as locking is concerned, it really interferes with the model we had handling regulators separately as much as possible since we're no longer just walking back up the tree. ww does seem like the way forwards. --9l24NVCWtSuIVIod Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAl8xdG0ACgkQJNaLcl1U h9BWoQf+JbDPp8Tfh2/5nFAzZWTICCoW0YcHtderHiFcH3N+rRdKk3rWi9CdRdsO +kuAnfInlBb3RmwDRLNc3Fa3EiRgFjN2uOErdL/VpThkf9U2rHheuR7IxmzWUn8k alJ4rvIbTgRrvRce4FBAz8O/mldWPFh1bAl+WU7CTc8pZzQh4V9o9khJriZDQ0vi eIcr6K0/Kds2RGHZe3uODo9QRp73q9OBcGaaGk1+6Mf6CDqIRlW72VjpIGYJbr+J JYymVcmusiMUpKKCRhMwWFzwoA5lTD2A2f1rNI29AljyBCQ7eSu6PkLqUtQJvRXE NrOJHgMY7fwAWXn9r2e6CVsNTWh/DA== =2G3K -----END PGP SIGNATURE----- --9l24NVCWtSuIVIod--