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: <20120513104502.GD23273@redhat.com>
Date:	Sun, 13 May 2012 13:45:03 +0300
From:	"Michael S. Tsirkin" <mst@...hat.com>
To:	Avi Kivity <avi@...hat.com>
Cc:	Christoph Lameter <cl@...ux.com>, "H. Peter Anvin" <hpa@...or.com>,
	Rob Landley <rob@...dley.net>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
	Arnd Bergmann <arnd@...db.de>,
	Andrew Morton <akpm@...ux-foundation.org>,
	David Howells <dhowells@...hat.com>,
	Akinobu Mita <akinobu.mita@...il.com>,
	Alexey Dobriyan <adobriyan@...il.com>,
	Herbert Xu <herbert@...dor.hengli.com.au>,
	Stephen Rothwell <sfr@...b.auug.org.au>,
	linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-arch@...r.kernel.org, Gleb Natapov <gleb@...hat.com>,
	Paolo Bonzini <pbonzini@...hat.com>, kvm@...r.kernel.org,
	Marcelo Tosatti <mtosatti@...hat.com>,
	Linus Torvalds <torvalds@...ux-foundation.org>
Subject: Re: [PATCHv2] bitops: add _local bitops

On Sun, May 13, 2012 at 01:13:21PM +0300, Avi Kivity wrote:
> On 05/10/2012 10:04 PM, Christoph Lameter wrote:
> > On Wed, 9 May 2012, Michael S. Tsirkin wrote:
> >
> > > kvm needs to update some hypervisor variables atomically
> > > in a sense that the operation can't be interrupted
> > > in the middle. However the hypervisor always runs
> > > on the same CPU so it does not need any memory
> > > barrier or lock prefix.
> > >
> > > Add _local bitops for this purpose: define them
> > > as non-atomics for x86 and (for now) atomics for
> > > everyone else.
> >
> > Have you tried to use the this_cpu_ops for that purpose? They create the
> > per cpu atomic instructions that you want without a lock prefix and can
> > also relocate the per cpu pointer to the correct processor via a
> > segment register prefix.
> >
> > There are no bit operations provided right now but those can either be
> > improvised using this_cpu_cmpxchg or added.
> 
> this_cpu_xchg() should be sufficient, since only bit zero has any
> meaning in our use case (so xchg with zero is equivalent to
> test_and_clear_bit).

Yes it should work. No idea how it'd perform:
arch/x86/include/asm/percpu.h implies it's expensive.  My latest version
simply documents what __test_and_clear does anyway.
Which was indicated is acceptable ...
Did you change your mind?

> 
> -- 
> error compiling committee.c: too many arguments to function
--
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