[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 40/43] tcg: add memory barriers in page_find_alloc ac
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PULL 40/43] tcg: add memory barriers in page_find_alloc accesses |
Date: |
Wed, 9 Sep 2015 15:50:10 +0200 |
page_find is reading the radix tree outside all locks, so it has to
use the RCU primitives. It does not need RCU critical sections
because the PageDescs are never removed, so there is never a need
to wait for the end of code sections that use a PageDesc.
Signed-off-by: Paolo Bonzini <address@hidden>
---
translate-all.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/translate-all.c b/translate-all.c
index 37bb56c..5329982 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -431,26 +431,26 @@ static PageDesc *page_find_alloc(tb_page_addr_t index,
int alloc)
/* Level 2..N-1. */
for (i = V_L1_SHIFT / V_L2_BITS - 1; i > 0; i--) {
- void **p = *lp;
+ void **p = atomic_rcu_read(lp);
if (p == NULL) {
if (!alloc) {
return NULL;
}
p = g_new0(void *, V_L2_SIZE);
- *lp = p;
+ atomic_rcu_set(lp, p);
}
lp = p + ((index >> (i * V_L2_BITS)) & (V_L2_SIZE - 1));
}
- pd = *lp;
+ pd = atomic_rcu_read(lp);
if (pd == NULL) {
if (!alloc) {
return NULL;
}
pd = g_new0(PageDesc, V_L2_SIZE);
- *lp = pd;
+ atomic_rcu_set(lp, pd);
}
return pd + (index & (V_L2_SIZE - 1));
--
2.4.3
- [Qemu-devel] [PULL 30/43] checkpatch: remove tests that are not relevant outside the kernel, (continued)
- [Qemu-devel] [PULL 30/43] checkpatch: remove tests that are not relevant outside the kernel, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 31/43] vhost-scsi: fix wrong vhost-scsi firmware path, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 32/43] configure: factor out adding disas configure, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 34/43] configure: Add support for jemalloc, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 35/43] scripts/dump-guest-memory.py: fix after RAMBlock change, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 33/43] add macro file for coccinelle, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 37/43] cpus: remove tcg_halt_cond and tcg_cpu_thread globals, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 36/43] cpus: protect work list with work_mutex, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 41/43] tcg: comment on which functions have to be called with mmap_lock held, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 39/43] remove unused spinlock., Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 40/43] tcg: add memory barriers in page_find_alloc accesses,
Paolo Bonzini <=
- [Qemu-devel] [PULL 42/43] exec: make mmap_lock/mmap_unlock globally available, Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 38/43] replace spinlock by QemuMutex., Paolo Bonzini, 2015/09/09
- [Qemu-devel] [PULL 43/43] cpu-exec: fix lock hierarchy for user-mode emulation, Paolo Bonzini, 2015/09/09
- Re: [Qemu-devel] [PULL 00/43] First batch of misc changes for 2.5 (2015-09-09), Peter Maydell, 2015/09/09