Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760016Ab2EIPnv (ORCPT ); Wed, 9 May 2012 11:43:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38716 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757038Ab2EIPns (ORCPT ); Wed, 9 May 2012 11:43:48 -0400 Date: Wed, 9 May 2012 18:43:30 +0300 From: "Michael S. Tsirkin" To: "H. Peter Anvin" Cc: Rob Landley , Thomas Gleixner , Ingo Molnar , x86@kernel.org, Arnd Bergmann , Andrew Morton , David Howells , Akinobu Mita , Alexey Dobriyan , Herbert Xu , Stephen Rothwell , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, Gleb Natapov , Paolo Bonzini , kvm@vger.kernel.org, Avi Kivity , Marcelo Tosatti , Linus Torvalds Subject: Re: [PATCH] bitops: add _local bitops Message-ID: <20120509154330.GA20867@redhat.com> References: <20120509134528.GA18044@redhat.com> <4FAA7939.6040706@zytor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4FAA7939.6040706@zytor.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1185 Lines: 32 On Wed, May 09, 2012 at 07:03:37AM -0700, H. Peter Anvin wrote: > On 05/09/2012 06:45 AM, 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. > > > > At Peter Anvin's suggestion, add _local bitops for this purpose: > > define them as non-atomics for x86 and (for now) atomics > > for everyone else. > > > > Uses are not restricted to virtualization: they > > might be useful to communicate with an interrupt > > handler if we know that it's running on the same CPU. > > > > Signed-off-by: Michael S. Tsirkin > > I don't think you can use the x86 nonatomics as-is, because they don't > contain optimization barriers. > > -hpa Just adding a memory clobber to asm will be enough, right? -- MST -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/