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]
Message-ID: <1311771677.24752.495.camel@twins>
Date:	Wed, 27 Jul 2011 15:01:17 +0200
From:	Peter Zijlstra <peterz@...radead.org>
To:	Christoph Lameter <cl@...ux.com>
Cc:	Tejun Heo <tj@...nel.org>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	"Paul E. McKenney" <paulmck@...ibm.com>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	Ingo Molnar <mingo@...e.hu>
Subject: Re: per-cpu operation madness vs validation

On Wed, 2011-07-27 at 14:11 +0200, Peter Zijlstra wrote:

> Hence my suggestion to do something like:
> 
> struct foo {
> 	percpu_lock_t lock;
> 	int a;
> 	int b;
> }
> 
> DEFINE_PER_CPU(struct foo, foo);
> 
> percpu_lock(&foo.lock);
> __this_cpu_inc(foo.a);
> __this_cpu_inc(foo.b);
> percpu_unlock(&foo.lock);
> 
> That would get us (aside from a shitload of work to make it so):
> 
>  - clear boundaries of where the data structure atomicy lie
>  - validation, for if the above piece of code was also ran from IRQ
>    context we could get lockdep complaining about IRQ unsafe locks used
>    from IRQ context.
> 
> Now for !-rt percpu_lock will not emit more than
> preempt_disable/local_bh_disable/local_irq_disable, depending on what
> variant is used, and the data type percpu_lock_t would be empty (except
> when enabling lockdep of course).
> 
> Possibly we could reduce all this percpu madness back to one form
> (__this_cpu_*) and require that when used a lock of the percpu_lock_t is
> taken.

get_cpu_var()/put_cpu_var() were supposed to provide such delineation as
well, but you've been actively destroying things like that with the
recent per-cpu work.

Also, I think we can mostly deprecate preempt_disable, local_bh_disable
and local_irq_disable when we have percpu_lock_t, or is local_lock_t a
better name?
--
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