Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752191AbbFYNV6 (ORCPT ); Thu, 25 Jun 2015 09:21:58 -0400 Received: from mga11.intel.com ([192.55.52.93]:35558 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751603AbbFYNVp (ORCPT ); Thu, 25 Jun 2015 09:21:45 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.13,677,1427785200"; d="scan'208";a="594599185" Message-ID: <558C0067.2000401@linux.intel.com> Date: Thu, 25 Jun 2015 06:21:43 -0700 From: Arjan van de Ven User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Nicolas Boichat , Mark Brown CC: Mauro Carvalho Chehab , Antti Palosaari , Ingo Molnar , Lars-Peter Clausen , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Bard Liao , Oder Chiou , Liam Girdwood , Jaroslav Kysela , Takashi Iwai , alsa-devel@alsa-project.org, Anatol Pomozov Subject: Re: [RFC PATCH 1/2] regmap: add configurable lock class key for lockdep References: <1435224904-35517-1-git-send-email-drinkcat@chromium.org> In-Reply-To: <1435224904-35517-1-git-send-email-drinkcat@chromium.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1468 Lines: 30 On 6/25/2015 2:35 AM, Nicolas Boichat wrote: > From: Antti Palosaari > > Lockdep validator complains about recursive locking and deadlock > when two different regmap instances are called in a nested order. > That happens anytime a regmap read/write call needs to access > another regmap. > > This is because, for performance reason, lockdep groups all locks > initialized by the same mutex_init() in the same lock class. > Therefore all regmap mutexes are in the same lock class, leading > to lockdep "nested locking" warnings if a regmap accesses another > regmap. However, depending on the specifics of the driver, this > can be perfectly safe (e.g. if there is a clear hierarchy between > a "master" regmap that uses another "slave" regmap). In these > cases, the warning is false and should be silenced. > > As a solution, add configuration option to pass custom lock class > key for lockdep validator, to be used in the regmap that needs to > access another regmap. This removes the need for uglier workarounds > in drivers, just to silence this warning (e.g. add custom mutex > lock/unlock functions). wouldn't it be better to use the mutex_lock_nested() and co to explicitly express your hierarchy? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/