ia64/xen-unstable

changeset 336:3553b18f1a0b

bitkeeper revision 1.151 (3e79e5a8nYFbe3fje-9Iz07_2N2H0g)

Merge labyrinth.cl.cam.ac.uk:/usr/groups/xeno/BK/xeno.bk
into labyrinth.cl.cam.ac.uk:/local/scratch/bd240/xeno-clone/xeno.bk
author bd240@labyrinth.cl.cam.ac.uk
date Thu Mar 20 16:00:40 2003 +0000 (2003-03-20)
parents 3f05356c923d dfa523958767
children b7fe2b3fb737
files BitKeeper/etc/logging_ok xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/balloon/balloon.c
line diff
     1.1 --- a/BitKeeper/etc/logging_ok	Thu Mar 20 14:50:09 2003 +0000
     1.2 +++ b/BitKeeper/etc/logging_ok	Thu Mar 20 16:00:40 2003 +0000
     1.3 @@ -3,6 +3,7 @@ akw27@boulderdash.cl.cam.ac.uk
     1.4  akw27@labyrinth.cl.cam.ac.uk
     1.5  akw27@plucky.localdomain
     1.6  bd240@boulderdash.cl.cam.ac.uk
     1.7 +bd240@labyrinth.cl.cam.ac.uk
     1.8  iap10@labyrinth.cl.cam.ac.uk
     1.9  kaf24@labyrinth.cl.cam.ac.uk
    1.10  kaf24@plym.cl.cam.ac.uk
     2.1 --- a/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/balloon/balloon.c	Thu Mar 20 14:50:09 2003 +0000
     2.2 +++ b/xenolinux-2.4.21-pre4-sparse/arch/xeno/drivers/balloon/balloon.c	Thu Mar 20 16:00:40 2003 +0000
     2.3 @@ -67,6 +67,7 @@ static unsigned long inflate_balloon(uns
     2.4      dom_mem_op_t dom_mem_op;
     2.5      unsigned long *parray;
     2.6      unsigned long *currp;
     2.7 +    unsigned long curraddr;
     2.8      unsigned long ret = 0;
     2.9      unsigned long vaddr;
    2.10      unsigned long i, j;
    2.11 @@ -100,8 +101,10 @@ static unsigned long inflate_balloon(uns
    2.12      currp = parray;
    2.13      for ( i = 0; i < num_pages; i++ )
    2.14      {
    2.15 -        queue_l1_entry_update(get_ppte(*currp) | PGREQ_NORMAL, 0);
    2.16 -        phys_to_machine_mapping[__pa(*currp) >> PAGE_SHIFT] = DEAD;
    2.17 +        curraddr = *currp;
    2.18 +        *currp = virt_to_machine(*currp) >> PAGE_SHIFT;
    2.19 +        queue_l1_entry_update(get_ppte(curraddr) | PGREQ_NORMAL, 0);
    2.20 +        phys_to_machine_mapping[__pa(curraddr) >> PAGE_SHIFT] = DEAD;
    2.21          currp++;
    2.22      }
    2.23  
    2.24 @@ -112,7 +115,7 @@ static unsigned long inflate_balloon(uns
    2.25      dom_mem_op.u.balloon_inflate.pages = parray;
    2.26      if ( (ret = HYPERVISOR_dom_mem_op(&dom_mem_op)) != num_pages )
    2.27      {
    2.28 -        printk("Unable to deflate balloon, error %lx\n", ret);
    2.29 +        printk("Unable to inflate balloon, error %lx\n", ret);
    2.30          goto cleanup;
    2.31      }
    2.32  
    2.33 @@ -145,10 +148,11 @@ static unsigned long process_new_pages(u
    2.34      unsigned long i;
    2.35  
    2.36      num_installed = 0;
    2.37 -    for ( i = 0; i < tot_pages; i++ )
    2.38 +    for ( i = 0; (i < tot_pages) && (num_installed < num); i++ )
    2.39      {
    2.40          if ( phys_to_machine_mapping[i] == DEAD )
    2.41          {
    2.42 +            printk(KERN_ALERT "bd240 debug: proc_new_pages: i %lx, mpt %lx, %lx\n", i, i << PAGE_SHIFT, get_ppte((unsigned long)__va(i << PAGE_SHIFT)) | PGREQ_NORMAL);
    2.43              phys_to_machine_mapping[i] = *curr;
    2.44              queue_l1_entry_update((i << PAGE_SHIFT) | PGREQ_MPT_UPDATE, i);
    2.45              queue_l1_entry_update(
    2.46 @@ -176,12 +180,14 @@ static unsigned long process_new_pages(u
    2.47      return num_installed;
    2.48  }
    2.49  
    2.50 -static unsigned long deflate_balloon(unsigned long num_pages)
    2.51 +unsigned long deflate_balloon(unsigned long num_pages)
    2.52  {
    2.53      dom_mem_op_t dom_mem_op;
    2.54      unsigned long ret;
    2.55      unsigned long * parray;
    2.56  
    2.57 +    printk(KERN_ALERT "bd240 debug: deflate balloon called for %lx pages\n", num_pages);
    2.58 +
    2.59      if ( num_pages > credit )
    2.60      {
    2.61          printk("Can not allocate more pages than previously released.\n");
    2.62 @@ -206,6 +212,7 @@ static unsigned long deflate_balloon(uns
    2.63      }
    2.64  
    2.65      ret = num_pages;
    2.66 +    credit -= num_pages;
    2.67  
    2.68   cleanup:
    2.69      kfree(parray);