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:	Thu, 15 Jan 2009 19:02:59 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	Tejun Heo <tj@...nel.org>, "H. Peter Anvin" <hpa@...or.com>,
	Brian Gerst <brgerst@...il.com>, ebiederm@...ssion.com,
	cl@...ux-foundation.org, rusty@...tcorp.com.au, travis@....com,
	linux-kernel@...r.kernel.org, steiner@....com, hugh@...itas.com
Subject: Re: [PATCH] percpu: add optimized generic percpu accessors


* Andrew Morton <akpm@...ux-foundation.org> wrote:

> On Thu, 15 Jan 2009 22:23:19 +0900 Tejun Heo <tj@...nel.org> wrote:
> 
> > --- a/include/asm-generic/percpu.h
> > +++ b/include/asm-generic/percpu.h
> > @@ -80,4 +80,56 @@ extern void setup_per_cpu_areas(void);
> >  #define DECLARE_PER_CPU(type, name) extern PER_CPU_ATTRIBUTES \
> >  					__typeof__(type) per_cpu_var(name)
> >  
> > +/*
> > + * Optional methods for optimized non-lvalue per-cpu variable access.
> > + *
> > + * @var can be a percpu variable or a field of it and its size should
> > + * equal char, int or long.  percpu_read() evaluates to a lvalue and
> > + * all others to void.
> > + *
> > + * These operations are guaranteed to be atomic w.r.t. preemption.
> > + * The generic versions use plain get/put_cpu_var().  Archs are
> > + * encouraged to implement single-instruction alternatives which don't
> > + * require preemption protection.
> > + */
> > +#ifndef percpu_read
> > +# define percpu_read(var)						\
> > +  ({									\
> > +	typeof(per_cpu_var(var)) __tmp_var__;				\
> > +	__tmp_var__ = get_cpu_var(var);					\
> > +	put_cpu_var(var);						\
> > +	__tmp_var__;							\
> > +  })
> > +#endif
> 
> I wonder if the preempt_disable()/preempt_enable() in here actually
> does anything useful on any architecture.

Provides "this is IRQ safe" and "this is preempt safe" semantics.

	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