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: <20090115122611.GJ22850@elte.hu>
Date:	Thu, 15 Jan 2009 13:26:11 +0100
From:	Ingo Molnar <mingo@...e.hu>
To:	Tejun Heo <tj@...nel.org>
Cc:	"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, akpm@...ux-foundation.org,
	steiner@....com, hugh@...itas.com
Subject: Re: [patch] add optimized generic percpu accessors


* Tejun Heo <tj@...nel.org> wrote:

> Hello,
> 
> Ingo Molnar wrote:
> > The new ops are a pretty nice and clean solution i think.
> > 
> > Firstly, accessing the current CPU is the only safe shortcut anyway (there 
> > is where we can do %fs/%gs / rip-relative addressing modes), and the 
> > generic per_cpu() APIs dont really provide that guarantee for us. We might 
> > be able to hook into __get_cpu_var() but those both require to be an 
> > lvalue and are also relatively rarely used.
> > 
> > So introducing the new, rather straightforward APIs and using them 
> > wherever they matter for performance is good. Your patchset already shaved 
> > off an instruction from ordinary per_cpu() accesses, so it's all moving 
> > rather close to the most-optimal situation already.
> 
> Yeah, I don't think we can do much better than those ops.  I have two
> issues tho.
> 
> 1. percpu_and() is missing.  I added it for completeness's sake.

Sure - it would be commonly used as well. Perhaps we dont need 
percpu_xor() at all? (or and and ops already give a complete algebra)

> 2. The generic percpu_op() should be local to the cpu, so it should
>    expand to...
> 
>    do { get_cpu_var(var) OP (val); put_cpu_var(var) } while (0)
> 
>    as the original x86_OP_percpu() did.  Right?
> 
> Thanks.

hm, that removes much of its appeal - a preempt off+on sequence is quite 
bloaty. Most percpu usage sites are already within critical sections.

I think they are more analogous to per_cpu(var, cpu), which does not 
disable preemption either. There's no 'get/put' in them, which signals 
that they dont auto-disable preemption.

	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