From: Sasha Levin <levinsasha928@gmail.com>
To: penberg@kernel.org
Cc: avi@redhat.com, kvm@vger.kernel.org, mingo@elte.hu,
asias.hejun@gmail.com, gorcunov@gmail.com,
prasadjoshi124@gmail.com, Sasha Levin <levinsasha928@gmail.com>
Subject: [PATCH 3/4] kvm tools: Add a brlock
Date: Sun, 29 May 2011 20:32:27 +0300 [thread overview]
Message-ID: <1306690348-23260-3-git-send-email-levinsasha928@gmail.com> (raw)
In-Reply-To: <1306690348-23260-1-git-send-email-levinsasha928@gmail.com>
brlock is a lock which is very cheap for reads, but very expensive
for writes.
This lock will be used when updates are very rare and reads are
common.
This lock is currently implemented by stopping the guest while
performing the updates. We assume that the only threads which
read from the locked data are VCPU threads, and the only writer
isn't a VCPU thread.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
---
tools/kvm/include/kvm/brlock.h | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
create mode 100644 tools/kvm/include/kvm/brlock.h
diff --git a/tools/kvm/include/kvm/brlock.h b/tools/kvm/include/kvm/brlock.h
new file mode 100644
index 0000000..f192071
--- /dev/null
+++ 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()
+
+#define br_write_lock() kvm__pause()
+#define br_write_unlock() kvm__continue()
+#endif
--
1.7.5.rc3
next prev parent reply other threads:[~2011-05-29 17:33 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-29 17:32 [PATCH 1/4] kvm tools: Use correct value for user signal base Sasha Levin
2011-05-29 17:32 ` [PATCH 2/4] kvm tools: Allow pausing guests Sasha Levin
2011-05-29 17:56 ` Sasha Levin
2011-05-29 17:32 ` Sasha Levin [this message]
2011-05-29 18:47 ` [PATCH 3/4] kvm tools: Add a brlock Ingo Molnar
2011-05-29 19:30 ` Sasha Levin
2011-05-29 19:38 ` Ingo Molnar
2011-05-29 17:32 ` [PATCH 4/4] kvm tools: Use brlock in MMIO and IOPORT Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1306690348-23260-3-git-send-email-levinsasha928@gmail.com \
--to=levinsasha928@gmail.com \
--cc=asias.hejun@gmail.com \
--cc=avi@redhat.com \
--cc=gorcunov@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=penberg@kernel.org \
--cc=prasadjoshi124@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox