lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Fri, 28 Sep 2012 17:29:59 +0200
From:	Davide Ciminaghi <ciminaghi@...dd.com>
To:	Alan Cox <alan@...rguk.ukuu.org.uk>
Cc:	Mark Brown <broonie@...nsource.wolfsonmicro.com>,
	sameo@...ux.intel.com, rubini@...dd.com, giancarlo.asnaghi@...com,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/8] sta2x11-mfd : add apb-soc regs driver and factor out common code

On Thu, Sep 27, 2012 at 03:13:14PM +0100, Alan Cox wrote:
> > as far as I know, nested locks are fine provided that you always take them in
> > the same order and release them in the opposite order (lock A, lock B,
> > unlock B, unlock A). So my conclusion is that nested spinlocks require
> > potential regmap users of sta2x11 registers to take the sta2x11-mfd spinlock
> > first. The pattern would be (sctl registers for instance):
> 
> The release order does not matter. Taking AB and releasing AB or BA is
> fine. Taking AB and dropping B and retaking B is fine. Taking AB and
> somewhere else taking BA is not. There are performance reasons in some
> cases why taking AB releasing A is best with locks, but thats generally
> with sleepable locks.
>
thanks, I'd never really thought about the release pattern actually.
In this particular case, though, B is inside the regmap code and is taken and
released when a regmap call happens, so I think AB necessarily implies BA.
For instance:

lock(A);
regmap_read(...); /* Lock/unlock B */
unlock(A);
 
Thanks
Davide
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ