From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Cc: Gonglei <arei.gonglei@huawei.com>
Subject: [Qemu-devel] [PULL 15/19] exec: store RAMBlock pointer into memory region
Date: Wed, 24 Feb 2016 14:27:37 +0100 [thread overview]
Message-ID: <1456320461-26756-16-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1456320461-26756-1-git-send-email-pbonzini@redhat.com>
From: Gonglei <arei.gonglei@huawei.com>
Each RAM memory region has a unique corresponding RAMBlock.
In the current realization, the memory region only stored
the ram_addr which means the offset of RAM address space,
We need to qurey the global ram.list to find the ram block
by ram_addr if we want to get the ram block, which is very
expensive.
Now, we store the RAMBlock pointer into memory region
structure. So, if we know the mr, we can easily get the
RAMBlock.
Signed-off-by: Gonglei <arei.gonglei@huawei.com>
Message-Id: <1456130097-4208-2-git-send-email-arei.gonglei@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
exec.c | 2 ++
include/exec/memory.h | 2 ++
memory.c | 1 +
3 files changed, 5 insertions(+)
diff --git a/exec.c b/exec.c
index 1f24500..4c0114a 100644
--- a/exec.c
+++ b/exec.c
@@ -1717,6 +1717,8 @@ ram_addr_t qemu_ram_alloc_internal(ram_addr_t size, ram_addr_t max_size,
error_propagate(errp, local_err);
return -1;
}
+
+ mr->ram_block = new_block;
return addr;
}
diff --git a/include/exec/memory.h b/include/exec/memory.h
index c92734a..4025729 100644
--- a/include/exec/memory.h
+++ b/include/exec/memory.h
@@ -156,6 +156,7 @@ struct MemoryRegionIOMMUOps {
typedef struct CoalescedMemoryRange CoalescedMemoryRange;
typedef struct MemoryRegionIoeventfd MemoryRegionIoeventfd;
+typedef struct RAMBlock RAMBlock;
struct MemoryRegion {
Object parent_obj;
@@ -172,6 +173,7 @@ struct MemoryRegion {
bool global_locking;
uint8_t dirty_log_mask;
ram_addr_t ram_addr;
+ RAMBlock *ram_block;
Object *owner;
const MemoryRegionIOMMUOps *iommu_ops;
diff --git a/memory.c b/memory.c
index 09041ed..b4451dd 100644
--- a/memory.c
+++ b/memory.c
@@ -912,6 +912,7 @@ void memory_region_init(MemoryRegion *mr,
}
mr->name = g_strdup(name);
mr->owner = owner;
+ mr->ram_block = NULL;
if (name) {
char *escaped_name = memory_region_escape_name(name);
--
2.5.0
next prev parent reply other threads:[~2016-02-24 13:28 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-24 13:27 [Qemu-devel] [PULL 00/19] Misc changes for 2016-02-24 Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 01/19] qemu-options.hx: Improve documentation of chardev multiplexing mode Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 02/19] scripts/kvm/kvm_stat: Fix missing right parantheses and ".format(...)" Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 03/19] dump-guest-memory: cleanup: removing dump_{error|cleanup}() Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 04/19] dump-guest-memory: add "detach" flag for QMP/HMP interfaces Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 05/19] dump-guest-memory: using static DumpState, add DumpStatus Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 06/19] dump-guest-memory: add dump_in_progress() helper function Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 07/19] dump-guest-memory: introduce dump_process() " Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 08/19] dump-guest-memory: disable dump when in INMIGRATE state Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 09/19] dump-guest-memory: add "detach" support Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 10/19] DumpState: adding total_size and written_size fields Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 11/19] Dump: add qmp command "query-dump" Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 12/19] Dump: add hmp command "info dump" Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 13/19] dump-guest-memory: add qmp event DUMP_COMPLETED Paolo Bonzini
2016-02-24 15:54 ` Eric Blake
2016-02-24 13:27 ` [Qemu-devel] [PULL 14/19] log: Redirect stderr to logfile if deamonized Paolo Bonzini
2016-02-29 8:57 ` Ján Tomko
2016-02-29 9:07 ` Paolo Bonzini
2016-02-29 10:04 ` Ján Tomko
2016-02-29 10:17 ` Paolo Bonzini
2016-02-29 11:05 ` Ján Tomko
2016-02-29 11:17 ` Paolo Bonzini
2016-02-24 13:27 ` Paolo Bonzini [this message]
2016-02-24 13:27 ` [Qemu-devel] [PULL 16/19] memory: optimize qemu_get_ram_ptr and qemu_ram_ptr_length Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 17/19] memory: Remove unreachable return statement Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 18/19] chardev: Properly initialize ChardevCommon components Paolo Bonzini
2016-02-24 13:27 ` [Qemu-devel] [PULL 19/19] target-i386: fix confusion in xcr0 bit position vs. mask Paolo Bonzini
2016-02-25 10:45 ` [Qemu-devel] [PULL 00/19] Misc changes for 2016-02-24 Peter Maydell
2016-02-25 11:10 ` Gonglei (Arei)
-- strict thread matches above, loose matches on Subject: below --
2016-02-25 15:14 [Qemu-devel] [PULL v2 " Paolo Bonzini
2016-02-25 15:14 ` [Qemu-devel] [PULL 15/19] exec: store RAMBlock pointer into memory region Paolo Bonzini
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=1456320461-26756-16-git-send-email-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=arei.gonglei@huawei.com \
--cc=qemu-devel@nongnu.org \
/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;
as well as URLs for NNTP newsgroup(s).