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] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 2 Mar 2007 14:04:33 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Heiko Carstens <heiko.carstens@...ibm.com>
Cc:	Andrew Morton <akpm@...ux-foundation.org>,
	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


* Heiko Carstens <heiko.carstens@...ibm.com> wrote:

> -	spin_lock(&new_base->lock);
> -	spin_lock(&old_base->lock);
> +	/*
> +	 * If we take a lock from a different cpu, make sure we have always
> +	 * the same locking order. That is the lock that belongs to the cpu
> +	 * with the lowest number is taken first.
> +	 */
> +	lock1 = smp_processor_id() < cpu ? &new_base->lock : &old_base->lock;
> +	lock2 = smp_processor_id() < cpu ? &old_base->lock : &new_base->lock;
> +	spin_lock(lock1);
> +	spin_lock(lock2);

looks good to me. Wouldnt this be cleaner via double_lock_timer() - 
similar to how double_rq_lock() works in kernel/sched.c - instead of 
open-coding it?

	Ingo
-
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