From: Ingo Molnar Subject: Re: [PATCH 3/4] kvm tools: Add a brlock Date: Sun, 29 May 2011 20:47:31 +0200 Message-ID: <20110529184731.GB9835@elte.hu> References: <1306690348-23260-1-git-send-email-levinsasha928@gmail.com> <1306690348-23260-3-git-send-email-levinsasha928@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: penberg@kernel.org, avi@redhat.com, kvm@vger.kernel.org, asias.hejun@gmail.com, gorcunov@gmail.com, prasadjoshi124@gmail.com To: Sasha Levin Return-path: Received: from mx3.mail.elte.hu ([157.181.1.138]:43202 "EHLO mx3.mail.elte.hu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753298Ab1E2Srn (ORCPT ); Sun, 29 May 2011 14:47:43 -0400 Content-Disposition: inline In-Reply-To: <1306690348-23260-3-git-send-email-levinsasha928@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: * Sasha Levin wrote: > +++ b/tools/kvm/include/kvm/brlock.h > @@ -0,0 +1,12 @@ > +#ifndef KVM__BRLOCK_H > +#define KVM__BRLOCK_H > + > +#include "kvm/kvm.h" > +#include "kvm/barrier.h" > + > +#define br_read_lock() mb() > +#define br_read_unlock() mb() These only need to be compiler barrier()s AFAICS, because the 'pause' op will signal back to the requestor thread - which whole operation is a barrier to begin with. > +#define br_write_lock() kvm__pause() > +#define br_write_unlock() kvm__continue() > +#endif Btw., it might make sense to add a comment to this header file, explaining what a 'big reader lock' is :-) Thanks, Ingo