direct-io.hg

changeset 14084:91427cadfa48

hvm: unset_mm_mapping() for vga acceleration region should recalculate
maxmem setting before freeing memory!
Signed-off-by: Keir Fraser <keir@xensource.com>
author kfraser@localhost.localdomain
date Fri Feb 23 16:16:36 2007 +0000 (2007-02-23)
parents 2c3a13993b0d
children e21834bc78f2
files tools/ioemu/vl.c
line diff
     1.1 --- a/tools/ioemu/vl.c	Fri Feb 23 14:44:07 2007 +0000
     1.2 +++ b/tools/ioemu/vl.c	Fri Feb 23 16:16:36 2007 +0000
     1.3 @@ -5768,17 +5768,17 @@ int unset_mm_mapping(int xc_handle, uint
     1.4      int err = 0;
     1.5      xc_dominfo_t info;
     1.6  
     1.7 +    xc_domain_getinfo(xc_handle, domid, 1, &info);
     1.8 +    if ((info.nr_pages - nr_pages) <= 0) {
     1.9 +        fprintf(stderr, "unset_mm_mapping: error nr_pages\n");
    1.10 +        err = -1;
    1.11 +    }
    1.12 +
    1.13      err = xc_domain_memory_decrease_reservation(xc_handle, domid,
    1.14                                                  nr_pages, 0, extent_start);
    1.15      if (err)
    1.16          fprintf(stderr, "Failed to decrease physmap\n");
    1.17  
    1.18 -    xc_domain_getinfo(xc_handle, domid, 1, &info);
    1.19 -
    1.20 -    if ((info.nr_pages - nr_pages) <= 0) {
    1.21 -        fprintf(stderr, "unset_mm_mapping: error nr_pages\n");
    1.22 -        err = -1;
    1.23 -    }
    1.24  
    1.25      if (xc_domain_setmaxmem(xc_handle, domid, (info.nr_pages - nr_pages) *
    1.26                              PAGE_SIZE/1024) != 0) {