From: Igor Mammedov <imammedo@redhat.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, mst@redhat.com
Subject: [Qemu-devel] [RFC v2 1/6] memory: get rid of memory_region_destructor_ram_from_ptr()
Date: Mon, 8 Jun 2015 17:19:12 +0200 [thread overview]
Message-ID: <1433776757-61958-2-git-send-email-imammedo@redhat.com> (raw)
In-Reply-To: <1433776757-61958-1-git-send-email-imammedo@redhat.com>
memory_region_destructor_ram_from_ptr() uses qemu_ram_free_from_ptr()
to free RAMBlock without freeing host RAM but generic
memory_region_destructor_ram() -> qemu_ram_free() does the same so
reuse memory_region_destructor_ram() instead.
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
---
exec.c | 19 -------------------
include/exec/ram_addr.h | 1 -
memory.c | 7 +------
3 files changed, 1 insertion(+), 26 deletions(-)
diff --git a/exec.c b/exec.c
index e19ab22..d895a86 100644
--- a/exec.c
+++ b/exec.c
@@ -1555,25 +1555,6 @@ ram_addr_t qemu_ram_alloc_resizeable(ram_addr_t size, ram_addr_t maxsz,
return qemu_ram_alloc_internal(size, maxsz, resized, NULL, true, mr, errp);
}
-void qemu_ram_free_from_ptr(ram_addr_t addr)
-{
- RAMBlock *block;
-
- qemu_mutex_lock_ramlist();
- QLIST_FOREACH_RCU(block, &ram_list.blocks, next) {
- if (addr == block->offset) {
- QLIST_REMOVE_RCU(block, next);
- ram_list.mru_block = NULL;
- /* Write list before version */
- smp_wmb();
- ram_list.version++;
- g_free_rcu(block, rcu);
- break;
- }
- }
- qemu_mutex_unlock_ramlist();
-}
-
static void reclaim_ramblock(RAMBlock *block)
{
if (block->flags & RAM_PREALLOC) {
diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
index ff558a4..56d2c17 100644
--- a/include/exec/ram_addr.h
+++ b/include/exec/ram_addr.h
@@ -37,7 +37,6 @@ int qemu_get_ram_fd(ram_addr_t addr);
void *qemu_get_ram_block_host_ptr(ram_addr_t addr);
void *qemu_get_ram_ptr(ram_addr_t addr);
void qemu_ram_free(ram_addr_t addr);
-void qemu_ram_free_from_ptr(ram_addr_t addr);
int qemu_ram_resize(ram_addr_t base, ram_addr_t newsize, Error **errp);
diff --git a/memory.c b/memory.c
index 03c536b..929123f 100644
--- a/memory.c
+++ b/memory.c
@@ -869,11 +869,6 @@ static void memory_region_destructor_alias(MemoryRegion *mr)
memory_region_unref(mr->alias);
}
-static void memory_region_destructor_ram_from_ptr(MemoryRegion *mr)
-{
- qemu_ram_free_from_ptr(mr->ram_addr);
-}
-
static void memory_region_destructor_rom_device(MemoryRegion *mr)
{
qemu_ram_free(mr->ram_addr & TARGET_PAGE_MASK);
@@ -1252,7 +1247,7 @@ void memory_region_init_ram_ptr(MemoryRegion *mr,
memory_region_init(mr, owner, name, size);
mr->ram = true;
mr->terminates = true;
- mr->destructor = memory_region_destructor_ram_from_ptr;
+ mr->destructor = memory_region_destructor_ram;
/* qemu_ram_alloc_from_ptr cannot fail with ptr != NULL. */
assert(ptr != NULL);
--
1.8.3.1
next prev parent reply other threads:[~2015-06-08 15:19 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-08 15:19 [Qemu-devel] [RFC v2 0/6] Fix QEMU crash during memory hotplug with vhost=on Igor Mammedov
2015-06-08 15:19 ` Igor Mammedov [this message]
2015-06-08 15:23 ` [Qemu-devel] [RFC v2 1/6] memory: get rid of memory_region_destructor_ram_from_ptr() Paolo Bonzini
2015-06-08 16:08 ` Igor Mammedov
2015-06-08 16:09 ` Paolo Bonzini
2015-06-08 16:26 ` Igor Mammedov
2015-06-08 15:19 ` [Qemu-devel] [RFC v2 2/6] memory: introduce MemoryRegion container with reserved HVA range Igor Mammedov
2015-06-08 15:19 ` [Qemu-devel] [RFC v2 3/6] memory: support unmapping of MemoryRegion mapped into HVA parent Igor Mammedov
2015-06-08 15:26 ` Paolo Bonzini
2015-06-08 15:32 ` Paolo Bonzini
2015-06-08 16:13 ` Igor Mammedov
2015-06-08 16:25 ` Michael S. Tsirkin
2015-06-08 17:06 ` Paolo Bonzini
2015-06-09 10:08 ` Igor Mammedov
2015-06-17 8:14 ` Paolo Bonzini
2015-06-17 15:04 ` Igor Mammedov
2015-06-17 15:10 ` Michael S. Tsirkin
2015-06-17 16:15 ` Paolo Bonzini
2015-06-17 16:30 ` Michael S. Tsirkin
2015-06-08 15:19 ` [Qemu-devel] [RFC v2 4/6] hostmem: return recreated MemoryRegion if current can't be reused Igor Mammedov
2015-06-08 15:30 ` Paolo Bonzini
2015-06-08 16:25 ` Igor Mammedov
2015-06-08 16:28 ` Paolo Bonzini
2015-06-08 15:19 ` [Qemu-devel] [RFC v2 5/6] pc: reserve hotpluggable memory range with memory_region_init_hva_range() Igor Mammedov
2015-06-08 15:19 ` [Qemu-devel] [RFC v2 6/6] pc: fix QEMU crashing when more than ~50 memory hotplugged Igor Mammedov
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=1433776757-61958-2-git-send-email-imammedo@redhat.com \
--to=imammedo@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.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).