Re: [Qemu-devel] [PATCH 1/4] ramblock-notifier: new

2017-01-10 Thread Fam Zheng
On Wed, 01/11 06:48, Stefan Weil wrote:
> On 01/11/17 06:38, Stefan Weil wrote:
> > Hi,
> > 
> > this fails for me when building with XEN support.
> > I noticed the failure when testing the latest HAXM patches.
> > See compiler output below.
> > 
> > Regards
> > Stefan
> 
> The patch compiles with this modification:
> 
> 
> diff --git a/xen-mapcache.c b/xen-mapcache.c
> index dc9b321491..31debdfb2c 100644
> --- a/xen-mapcache.c
> +++ b/xen-mapcache.c
> @@ -163,7 +163,7 @@ static void xen_remap_bucket(MapCacheEntry *entry,
>  err = g_malloc0(nb_pfn * sizeof (int));
> 
>  if (entry->vaddr_base != NULL) {
> -ram_block_removed(entry->vaddr_base, entry->size);
> +ram_block_notify_remove(entry->vaddr_base, entry->size);
>  if (munmap(entry->vaddr_base, entry->size) != 0) {
>  perror("unmap fails");
>  exit(-1);
> @@ -189,7 +189,7 @@ static void xen_remap_bucket(MapCacheEntry *entry,
>  entry->valid_mapping = (unsigned long *) g_malloc0(sizeof(unsigned
> long) *
>  BITS_TO_LONGS(size >> XC_PAGE_SHIFT));
> 
> -ram_block_added(entry->vaddr_base, entry->size);
> +ram_block_notify_add(entry->vaddr_base, entry->size);
>  bitmap_zero(entry->valid_mapping, nb_pfn);
>  for (i = 0; i < nb_pfn; i++) {
>  if (!err[i]) {
> @@ -399,7 +399,7 @@ static void
> xen_invalidate_map_cache_entry_unlocked(uint8_t *buffer)
>  }
> 
>  pentry->next = entry->next;
> -ram_block_removed(entry->vaddr_base, entry->size);
> +ram_block_notify_remove(entry->vaddr_base, entry->size);
>  if (munmap(entry->vaddr_base, entry->size) != 0) {
>  perror("unmap fails");
>  exit(-1);
> 

Yes, this matches what Paolo pointed out in his reply. I'll fix that in the next
revision.

Fam



Re: [Qemu-devel] [PATCH 1/4] ramblock-notifier: new

2017-01-10 Thread Stefan Weil

On 01/11/17 06:38, Stefan Weil wrote:

Hi,

this fails for me when building with XEN support.
I noticed the failure when testing the latest HAXM patches.
See compiler output below.

Regards
Stefan


The patch compiles with this modification:


diff --git a/xen-mapcache.c b/xen-mapcache.c
index dc9b321491..31debdfb2c 100644
--- a/xen-mapcache.c
+++ b/xen-mapcache.c
@@ -163,7 +163,7 @@ static void xen_remap_bucket(MapCacheEntry *entry,
 err = g_malloc0(nb_pfn * sizeof (int));

 if (entry->vaddr_base != NULL) {
-ram_block_removed(entry->vaddr_base, entry->size);
+ram_block_notify_remove(entry->vaddr_base, entry->size);
 if (munmap(entry->vaddr_base, entry->size) != 0) {
 perror("unmap fails");
 exit(-1);
@@ -189,7 +189,7 @@ static void xen_remap_bucket(MapCacheEntry *entry,
 entry->valid_mapping = (unsigned long *) g_malloc0(sizeof(unsigned 
long) *

 BITS_TO_LONGS(size >> XC_PAGE_SHIFT));

-ram_block_added(entry->vaddr_base, entry->size);
+ram_block_notify_add(entry->vaddr_base, entry->size);
 bitmap_zero(entry->valid_mapping, nb_pfn);
 for (i = 0; i < nb_pfn; i++) {
 if (!err[i]) {
@@ -399,7 +399,7 @@ static void 
xen_invalidate_map_cache_entry_unlocked(uint8_t *buffer)

 }

 pentry->next = entry->next;
-ram_block_removed(entry->vaddr_base, entry->size);
+ram_block_notify_remove(entry->vaddr_base, entry->size);
 if (munmap(entry->vaddr_base, entry->size) != 0) {
 perror("unmap fails");
 exit(-1);




Re: [Qemu-devel] [PATCH 1/4] ramblock-notifier: new

2017-01-10 Thread Stefan Weil

Hi,

this fails for me when building with XEN support.
I noticed the failure when testing the latest HAXM patches.
See compiler output below.

Regards
Stefan


On 12/20/16 17:31, Fam Zheng wrote:

From: Paolo Bonzini 

This adds a notify interface of ram block additions and removals.

Signed-off-by: Paolo Bonzini 
Signed-off-by: Fam Zheng 
---

[...]

diff --git a/xen-mapcache.c b/xen-mapcache.c
index 8f3a592..dc9b321 100644
--- a/xen-mapcache.c
+++ b/xen-mapcache.c
@@ -163,6 +163,7 @@ static void xen_remap_bucket(MapCacheEntry *entry,
 err = g_malloc0(nb_pfn * sizeof (int));

 if (entry->vaddr_base != NULL) {
+ram_block_removed(entry->vaddr_base, entry->size);
 if (munmap(entry->vaddr_base, entry->size) != 0) {
 perror("unmap fails");
 exit(-1);
@@ -188,6 +189,7 @@ static void xen_remap_bucket(MapCacheEntry *entry,
 entry->valid_mapping = (unsigned long *) g_malloc0(sizeof(unsigned long) *
 BITS_TO_LONGS(size >> XC_PAGE_SHIFT));

+ram_block_added(entry->vaddr_base, entry->size);
 bitmap_zero(entry->valid_mapping, nb_pfn);
 for (i = 0; i < nb_pfn; i++) {
 if (!err[i]) {
@@ -397,6 +399,7 @@ static void xen_invalidate_map_cache_entry_unlocked(uint8_t 
*buffer)
 }

 pentry->next = entry->next;
+ram_block_removed(entry->vaddr_base, entry->size);
 if (munmap(entry->vaddr_base, entry->size) != 0) {
 perror("unmap fails");
 exit(-1);



  CC  x86_64-softmmu/xen-mapcache.o
/qemu/xen-mapcache.c: In function 'xen_remap_bucket':
/qemu/xen-mapcache.c:166:9: error: implicit declaration of function 
'ram_block_removed' [-Werror=implicit-function-declaration]

 ram_block_removed(entry->vaddr_base, entry->size);
 ^
/qemu/xen-mapcache.c:166:9: error: nested extern declaration of 
'ram_block_removed' [-Werror=nested-externs]
/qemu/xen-mapcache.c:192:5: error: implicit declaration of function 
'ram_block_added' [-Werror=implicit-function-declaration]

 ram_block_added(entry->vaddr_base, entry->size);
 ^~~
/qemu/xen-mapcache.c:192:5: error: nested extern declaration of 
'ram_block_added' [-Werror=nested-externs]

cc1: all warnings being treated as errors
/qemu/rules.mak:64: recipe for target 'xen-mapcache.o' failed
make[1]: *** [xen-mapcache.o] Error 1
Makefile:203: recipe for target 'subdir-x86_64-softmmu' failed
make: *** [subdir-x86_64-softmmu] Error 2




Re: [Qemu-devel] [PATCH 1/4] ramblock-notifier: new

2016-12-22 Thread Paolo Bonzini

> diff --git a/xen-mapcache.c b/xen-mapcache.c
> index 8f3a592..dc9b321 100644
> --- a/xen-mapcache.c
> +++ b/xen-mapcache.c
> @@ -163,6 +163,7 @@ static void xen_remap_bucket(MapCacheEntry *entry,
>  err = g_malloc0(nb_pfn * sizeof (int));
>  
>  if (entry->vaddr_base != NULL) {
> +ram_block_removed(entry->vaddr_base, entry->size);
>  if (munmap(entry->vaddr_base, entry->size) != 0) {
>  perror("unmap fails");
>  exit(-1);
> @@ -188,6 +189,7 @@ static void xen_remap_bucket(MapCacheEntry *entry,
>  entry->valid_mapping = (unsigned long *) g_malloc0(sizeof(unsigned long) 
> *
>  BITS_TO_LONGS(size >> XC_PAGE_SHIFT));
>  
> +ram_block_added(entry->vaddr_base, entry->size);
>  bitmap_zero(entry->valid_mapping, nb_pfn);
>  for (i = 0; i < nb_pfn; i++) {
>  if (!err[i]) {
> @@ -397,6 +399,7 @@ static void 
> xen_invalidate_map_cache_entry_unlocked(uint8_t *buffer)
>  }
>  
>  pentry->next = entry->next;
> +ram_block_removed(entry->vaddr_base, entry->size);
>  if (munmap(entry->vaddr_base, entry->size) != 0) {
>  perror("unmap fails");
>  exit(-1);
> 

My mistake here, these should be ram_block_notify_{add,remove} instead.

Paolo