From: Glauber Costa <glommer@redhat.com>
To: kvm@vger.kernel.org
Cc: jes@sgi.com, avi@qumranet.com, aliguori@us.ibm.com
Subject: [PATCH 7/9] add debuging facilities to memory registration at libkvm
Date: Fri, 12 Sep 2008 12:10:48 -0300 [thread overview]
Message-ID: <1221232250-9653-8-git-send-email-glommer@redhat.com> (raw)
In-Reply-To: <1221232250-9653-1-git-send-email-glommer@redhat.com>
Signed-off-by: Glauber Costa <glommer@redhat.com>
---
libkvm/libkvm.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
index 5df201e..8764982 100644
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -52,6 +52,8 @@
#include "kvm-s390.h"
#endif
+//#define DEBUG_MEMREG
+
int kvm_abi = EXPECTED_KVM_API_VERSION;
int kvm_page_size;
@@ -186,7 +188,7 @@ int kvm_register_mmio_slot(kvm_context_t kvm, uint64_t phys_addr, unsigned int s
goto out;
#ifdef DEBUG_MEMREG
- printf("Registering mmio region %llx (%lx)\n", phys_addr, size);
+ fprintf(stderr, "Registering mmio region %llx (%lx)\n", phys_addr, size);
#endif
mmio_slots[slot].phys_addr = phys_addr;
mmio_slots[slot].len = size;
@@ -509,6 +511,11 @@ int kvm_register_phys_mem(kvm_context_t kvm,
int r;
memory.slot = get_free_slot(kvm);
+#ifdef DEBUG_MEMREG
+ fprintf(stderr, "%s, memory: gpa: %llx, size: %llx, uaddr: %llx, slot: %x, flags: %lx\n",
+ __func__, memory.guest_phys_addr, memory.memory_size,
+ memory.userspace_addr, memory.slot, memory.flags);
+#endif
r = ioctl(kvm->vm_fd, KVM_SET_USER_MEMORY_REGION, &memory);
if (r == -1) {
fprintf(stderr, "create_userspace_phys_mem: %s\n", strerror(errno));
@@ -567,7 +574,7 @@ void kvm_unregister_memory_area(kvm_context_t kvm, uint64_t phys_addr, unsigned
if (slot != -1) {
#ifdef DEBUG_MEMREG
- printf("Unregistering memory region %llx (%lx)\n", phys_addr, size);
+ fprintf(stderr, "Unregistering memory region %llx (%lx)\n", phys_addr, size);
#endif
kvm_destroy_phys_mem(kvm, phys_addr, size);
return;
@@ -576,7 +583,7 @@ void kvm_unregister_memory_area(kvm_context_t kvm, uint64_t phys_addr, unsigned
slot = get_container_mmio_slot(kvm, phys_addr, size);
if (slot != -1) {
#ifdef DEBUG_MEMREG
- printf("Unregistering mmio region %llx (%lx)\n", phys_addr, size);
+ fprintf(stderr, "Unregistering mmio region %llx (%lx)\n", phys_addr, size);
#endif
kvm_unregister_coalesced_mmio(kvm, phys_addr, size);
mmio_slots[slot].len = 0;
@@ -1072,6 +1079,9 @@ int kvm_unregister_coalesced_mmio(kvm_context_t kvm, uint64_t addr, uint32_t siz
perror("kvm_unregister_coalesced_mmio_zone");
return -errno;
}
+#ifdef DEBUG_MEMREG
+ fprintf(stderr, "Unregistered coalesced mmio region for %llx (%lx)\n", addr, size);
+#endif
return 0;
}
#endif
--
1.5.5.1
next prev parent reply other threads:[~2008-09-12 15:24 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-12 15:10 [PATCH 0/9] Simplify memory registration Glauber Costa
2008-09-12 15:10 ` [PATCH 1/9] Don't separate registrations with IO_MEM_ROM set Glauber Costa
2008-09-12 15:47 ` Jan Kiszka
2008-09-12 16:04 ` Glauber Costa
2008-09-12 16:26 ` Jan Kiszka
2008-09-12 18:47 ` Glauber Costa
2008-09-13 6:26 ` Jan Kiszka
2008-09-15 12:44 ` Glauber Costa
2008-09-15 13:08 ` Jan Kiszka
2008-09-15 13:15 ` Glauber Costa
2008-09-19 23:12 ` Avi Kivity
2008-09-12 15:10 ` [PATCH 2/9] do not use mem_hole anymore Glauber Costa
2008-09-12 15:10 ` [PATCH 3/9] allow intersecting region to be on the boundary Glauber Costa
2008-09-12 15:10 ` [PATCH 4/9] substitute is_allocated_mem with more general is_containing_region Glauber Costa
2008-09-12 15:10 ` [PATCH 5/9] move kvm_cpu_register_memory_area into qemu's Glauber Costa
2008-09-12 15:10 ` [PATCH 6/9] cleanup kvm memory registration Glauber Costa
2008-09-12 15:10 ` Glauber Costa [this message]
2008-09-12 15:10 ` [PATCH 8/9] coalesce mmio regions without an explicit call Glauber Costa
2008-09-12 15:10 ` [PATCH 9/9] remove explicit calls to kvm_qemu_register_coalesced_mmio Glauber Costa
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=1221232250-9653-8-git-send-email-glommer@redhat.com \
--to=glommer@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=avi@qumranet.com \
--cc=jes@sgi.com \
--cc=kvm@vger.kernel.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