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:	Sun, 4 Mar 2007 17:24:43 -0600
From:	Matt Mackall <mpm@...enic.com>
To:	Heiko Carstens <heiko.carstens@...ibm.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	Ingo Molnar <mingo@...e.hu>,
	Thomas Gleixner <tglx@...utronix.de>,
	Martin Schwidefsky <schwidefsky@...ibm.com>,
	john stultz <johnstul@...ibm.com>,
	Roman Zippel <zippel@...ux-m68k.org>,
	Christian Borntraeger <cborntra@...ibm.com>,
	linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [patch] timer/hrtimer: take per cpu locks in sane order

On Fri, Mar 02, 2007 at 11:47:52PM +0100, Heiko Carstens wrote:
>  /*
> + * Locks two spinlocks l1 and l2.
> + * l1_first indicates if spinlock l1 should be taken first.
> + */
> +static inline void double_spin_lock(spinlock_t *l1, spinlock_t *l2,
> +				    bool l1_first)
> +	__acquires(l1)
> +	__acquires(l2)
> +{
> +	if (l1_first) {
> +		spin_lock(l1);
> +		spin_lock(l2);
> +	} else {
> +		spin_lock(l2);
> +		spin_lock(l1);
> +	}
> +}

Two observations:

- We probably don't want people using this for locks that aren't
  explicitly in the same level of the hierarchy. The name should
  somehow indicate that. Something like spin_lock_siblings()?

- And once we know that, we can internally impose a natural stable
  ordering on them based on their addresses, eliminating the third
  argument and the need to duplicate the ordering calculation.

-- 
Mathematics is the supreme nostalgia of our time.
-
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