ia64/xen-unstable

changeset 1407:c44c3a19fe95

bitkeeper revision 1.911.1.2 (40abd812eI8191scOuEXdi7E2VKxGQ)

When flushing network buffers, don't put the pages back in the psuedo-physical
map, so we don't have to send junk pages.
Add shadow_control_op_peek
author iap10@tetris.cl.cam.ac.uk
date Wed May 19 21:56:34 2004 +0000 (2004-05-19)
parents 019a7ac5e60f
children 1ad6b2dcc1f8
files tools/examples/xc_dom_control.py tools/xc/lib/xc_linux_save.c xen/common/shadow.c xen/include/hypervisor-ifs/dom0_ops.h xenolinux-2.4.26-sparse/arch/xen/drivers/network/network.c
line diff
     1.1 --- a/tools/examples/xc_dom_control.py	Wed May 19 21:46:26 2004 +0000
     1.2 +++ b/tools/examples/xc_dom_control.py	Wed May 19 21:56:34 2004 +0000
     1.3 @@ -136,11 +136,13 @@ elif cmd == 'suspend':
     1.4          pid = int(fd.readline())
     1.5          os.kill(pid, signal.SIGTERM)
     1.6  
     1.7 +    """
     1.8      xc.domain_stop( dom=dom )
     1.9 -    
    1.10 +    XXX
    1.11      while not xc.domain_getinfo( first_dom=dom, max_doms=1 )[0]['stopped']:
    1.12  	print "Sleep..."
    1.13  	time.sleep(0.001);
    1.14 +    """
    1.15  
    1.16      rc = xc.linux_save( dom=dom, state_file=file, progress=1)
    1.17      if rc == 0 : xc.domain_destroy( dom=dom, force=1 )
     2.1 --- a/tools/xc/lib/xc_linux_save.c	Wed May 19 21:46:26 2004 +0000
     2.2 +++ b/tools/xc/lib/xc_linux_save.c	Wed May 19 21:56:34 2004 +0000
     2.3 @@ -140,8 +140,9 @@ int xc_linux_save(int xc_handle,
     2.4      /* bitmap of pages left to send */
     2.5      unsigned long *to_send, *to_fix;
     2.6  
     2.7 -//live=0;
     2.8 -
     2.9 +    int needed_to_fix = 0;
    2.10 +    int total_sent    = 0;
    2.11 +    
    2.12      if ( mlock(&ctxt, sizeof(ctxt) ) )
    2.13      {
    2.14          PERROR("Unable to mlock ctxt");
    2.15 @@ -422,6 +423,7 @@ int xc_linux_save(int xc_handle,
    2.16  
    2.17  		if ( last_iter && test_bit(n, to_fix ) && !test_bit(n, to_send ))
    2.18  		{
    2.19 +		    needed_to_fix++;
    2.20  		    DPRINTF("Fix! iter %d, pfn %lx. mfn %lx\n",
    2.21  			       iter,n,pfn_type[batch]);
    2.22  		}
    2.23 @@ -567,9 +569,18 @@ int xc_linux_save(int xc_handle,
    2.24  	munmap(region_base, batch*PAGE_SIZE);
    2.25  
    2.26      skip: 
    2.27 -	
    2.28 +
    2.29 +	total_sent += sent_this_iter;
    2.30 +
    2.31  	verbose_printf("\b\b\b\b100%% (%d pages)\n", sent_this_iter );
    2.32  	
    2.33 +	if ( last_iter )
    2.34 +	{
    2.35 +	    verbose_printf("Total pages sent= %d (%.2fx)\n", 
    2.36 +			   total_sent, ((float)total_sent)/nr_pfns );
    2.37 +	    verbose_printf("(of which %d were fixups)\n", needed_to_fix  );
    2.38 +	}       
    2.39 +
    2.40  	if ( debug && last_iter )
    2.41  	{
    2.42  	    int minusone = -1;
     3.1 --- a/xen/common/shadow.c	Wed May 19 21:46:26 2004 +0000
     3.2 +++ b/xen/common/shadow.c	Wed May 19 21:56:34 2004 +0000
     3.3 @@ -350,6 +350,38 @@ static int shadow_mode_table_op( struct 
     3.4  
     3.5  		break;
     3.6      }
     3.7 +
     3.8 +    case DOM0_SHADOW_CONTROL_OP_PEEK:
     3.9 +    {
    3.10 +		int i;
    3.11 +	
    3.12 +		if( p->tot_pages > sc->pages || 
    3.13 +			!sc->dirty_bitmap || !p->mm.shadow_dirty_bitmap )
    3.14 +		{
    3.15 +			rc = -EINVAL;
    3.16 +			goto out;
    3.17 +		}
    3.18 +	
    3.19 +		sc->pages = p->tot_pages;
    3.20 +	
    3.21 +#define chunk (8*1024) // do this in 1KB chunks for L1 cache
    3.22 +	
    3.23 +		for(i=0;i<p->tot_pages;i+=chunk)
    3.24 +		{
    3.25 +			int bytes = ((  ((p->tot_pages-i) > (chunk))?
    3.26 +							(chunk):(p->tot_pages-i) ) + 7) / 8;
    3.27 +	    
    3.28 +			copy_to_user( sc->dirty_bitmap + (i/(8*sizeof(unsigned long))),
    3.29 +						  p->mm.shadow_dirty_bitmap +(i/(8*sizeof(unsigned long))),
    3.30 +						  bytes );	    
    3.31 +		}
    3.32 +
    3.33 +		break;
    3.34 +    }
    3.35 +
    3.36 +	default:
    3.37 +		BUG();
    3.38 +
    3.39      }
    3.40  
    3.41  
    3.42 @@ -386,7 +418,7 @@ int shadow_mode_control( struct task_str
    3.43          if(p->mm.shadow_mode) shadow_mode_disable(p);
    3.44          shadow_mode_enable(p, SHM_logdirty);
    3.45      } 
    3.46 -    else if ( p->mm.shadow_mode && cmd >= DOM0_SHADOW_CONTROL_OP_FLUSH && cmd<=DOM0_SHADOW_CONTROL_OP_CLEAN )
    3.47 +    else if ( p->mm.shadow_mode && cmd >= DOM0_SHADOW_CONTROL_OP_FLUSH && cmd<=DOM0_SHADOW_CONTROL_OP_PEEK )
    3.48      {
    3.49          rc = shadow_mode_table_op(p, sc);
    3.50      }
     4.1 --- a/xen/include/hypervisor-ifs/dom0_ops.h	Wed May 19 21:46:26 2004 +0000
     4.2 +++ b/xen/include/hypervisor-ifs/dom0_ops.h	Wed May 19 21:56:34 2004 +0000
     4.3 @@ -238,6 +238,7 @@ typedef struct dom0_sched_id_st
     4.4  #define DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY 2
     4.5  #define DOM0_SHADOW_CONTROL_OP_FLUSH       10
     4.6  #define DOM0_SHADOW_CONTROL_OP_CLEAN       11
     4.7 +#define DOM0_SHADOW_CONTROL_OP_PEEK        12
     4.8  typedef struct dom0_shadow_control_st
     4.9  {
    4.10      /* IN variables. */
     5.1 --- a/xenolinux-2.4.26-sparse/arch/xen/drivers/network/network.c	Wed May 19 21:46:26 2004 +0000
     5.2 +++ b/xenolinux-2.4.26-sparse/arch/xen/drivers/network/network.c	Wed May 19 21:56:34 2004 +0000
     5.3 @@ -381,6 +381,10 @@ xc_linux_save  */
     5.4  	        /* With live migrate, we even get these...  Disable for now. */
     5.5                  // printk(KERN_ALERT "bad buffer on RX ring!(%d)\n", rx->status);
     5.6              }
     5.7 +	    else
     5.8 +		phys_to_machine_mapping[virt_to_phys(skb->head) >> PAGE_SHIFT] =
     5.9 +		    0x80000004; // disown this page -- it was a flush
    5.10 +
    5.11              dev_kfree_skb_any(skb);
    5.12              continue;
    5.13          }