direct-io.hg

changeset 11233:af704c33a9a4

merge
author Ian Campbell <ian.campbell@xensource.com>
date Tue Aug 22 18:51:02 2006 +0100 (2006-08-22)
parents 6aeec897da36 0ea9a824c16c
children 0bb18319b8a0
files
line diff
     1.1 --- a/tools/libxc/xc_hvm_build.c	Tue Aug 22 18:50:22 2006 +0100
     1.2 +++ b/tools/libxc/xc_hvm_build.c	Tue Aug 22 18:51:02 2006 +0100
     1.3 @@ -442,13 +442,12 @@ static int xc_hvm_build_internal(int xc_
     1.4      }
     1.5  
     1.6      /* HVM domains must be put into shadow2 mode at the start of day */
     1.7 -    if ( xc_shadow_control(xc_handle, domid, DOM0_SHADOW2_CONTROL_OP_ENABLE,
     1.8 +    if ( xc_shadow_control(xc_handle, domid, DOM0_SHADOW_CONTROL_OP_ENABLE,
     1.9                             NULL, 0, NULL, 
    1.10 -                           DOM0_SHADOW2_CONTROL_FLAG_ENABLE 
    1.11 -                           | DOM0_SHADOW2_CONTROL_FLAG_REFCOUNT
    1.12 -                           | DOM0_SHADOW2_CONTROL_FLAG_TRANSLATE
    1.13 -                           | DOM0_SHADOW2_CONTROL_FLAG_EXTERNAL, 
    1.14 -                           NULL) ) 
    1.15 +                           DOM0_SHADOW_ENABLE_REFCOUNT  |
    1.16 +                           DOM0_SHADOW_ENABLE_TRANSLATE |
    1.17 +                           DOM0_SHADOW_ENABLE_EXTERNAL, 
    1.18 +                           NULL) )
    1.19      {
    1.20          PERROR("Could not enable shadow paging for domain.\n");
    1.21          goto error_out;
     2.1 --- a/tools/libxc/xc_linux_save.c	Tue Aug 22 18:50:22 2006 +0100
     2.2 +++ b/tools/libxc/xc_linux_save.c	Tue Aug 22 18:51:02 2006 +0100
     2.3 @@ -346,11 +346,9 @@ static int analysis_phase(int xc_handle,
     2.4              xc_shadow_control(xc_handle, domid, DOM0_SHADOW_CONTROL_OP_PEEK,
     2.5                                NULL, 0, NULL, 0, &stats);
     2.6  
     2.7 -            DPRINTF("now= %lld faults= %" PRId32 " dirty= %" PRId32
     2.8 -                    " dirty_net= %" PRId32 " dirty_block= %" PRId32"\n",
     2.9 +            DPRINTF("now= %lld faults= %"PRId32" dirty= %"PRId32"\n",
    2.10                      ((now-start)+500)/1000,
    2.11 -                    stats.fault_count, stats.dirty_count,
    2.12 -                    stats.dirty_net_count, stats.dirty_block_count);
    2.13 +                    stats.fault_count, stats.dirty_count);
    2.14          }
    2.15      }
    2.16  
     3.1 --- a/tools/python/xen/lowlevel/xc/xc.c	Tue Aug 22 18:50:22 2006 +0100
     3.2 +++ b/tools/python/xen/lowlevel/xc/xc.c	Tue Aug 22 18:51:02 2006 +0100
     3.3 @@ -709,11 +709,11 @@ static PyObject *pyxc_shadow_mem_control
     3.4          return NULL;
     3.5      
     3.6      if ( mbarg < 0 ) 
     3.7 -        op = DOM0_SHADOW2_CONTROL_OP_GET_ALLOCATION;
     3.8 +        op = DOM0_SHADOW_CONTROL_OP_GET_ALLOCATION;
     3.9      else 
    3.10      {
    3.11          mb = mbarg;
    3.12 -        op = DOM0_SHADOW2_CONTROL_OP_SET_ALLOCATION;
    3.13 +        op = DOM0_SHADOW_CONTROL_OP_SET_ALLOCATION;
    3.14      }
    3.15      if ( xc_shadow_control(xc->xc_handle, dom, op, NULL, 0, &mb, 0, NULL) < 0 )
    3.16          return PyErr_SetFromErrno(xc_error);
     4.1 --- a/xen/arch/ia64/xen/domain.c	Tue Aug 22 18:50:22 2006 +0100
     4.2 +++ b/xen/arch/ia64/xen/domain.c	Tue Aug 22 18:51:02 2006 +0100
     4.3 @@ -653,11 +653,6 @@ int shadow_mode_control(struct domain *d
     4.4  		}
     4.5  		break;
     4.6  
     4.7 -	case DOM0_SHADOW_CONTROL_OP_FLUSH:
     4.8 -		atomic64_set(&d->arch.shadow_fault_count, 0);
     4.9 -		atomic64_set(&d->arch.shadow_dirty_count, 0);
    4.10 -		break;
    4.11 -   
    4.12  	case DOM0_SHADOW_CONTROL_OP_CLEAN:
    4.13  	  {
    4.14  		int nbr_longs;
     5.1 --- a/xen/arch/x86/shadow2-common.c	Tue Aug 22 18:50:22 2006 +0100
     5.2 +++ b/xen/arch/x86/shadow2-common.c	Tue Aug 22 18:51:02 2006 +0100
     5.3 @@ -2481,14 +2481,15 @@ static int shadow2_enable(struct domain 
     5.4      unsigned int old_pages;
     5.5      int rv = 0;
     5.6  
     5.7 +    mode |= SHM2_enable;
     5.8 +
     5.9      domain_pause(d);
    5.10      shadow2_lock(d);
    5.11  
    5.12      /* Sanity check the arguments */
    5.13 -    if ( d == current->domain 
    5.14 -         || shadow2_mode_enabled(d)
    5.15 -         || !(mode & SHM2_enable)
    5.16 -         || ((mode & SHM2_external) && !(mode & SHM2_translate)) )
    5.17 +    if ( (d == current->domain) ||
    5.18 +         shadow2_mode_enabled(d) ||
    5.19 +         ((mode & SHM2_external) && !(mode & SHM2_translate)) )
    5.20      {
    5.21          rv = -EINVAL;
    5.22          goto out;
    5.23 @@ -2957,11 +2958,7 @@ static int shadow2_log_dirty_op(struct d
    5.24      domain_pause(d);
    5.25      shadow2_lock(d);
    5.26  
    5.27 -    if ( sc->op == DOM0_SHADOW_CONTROL_OP_CLEAN
    5.28 -         || sc->op == DOM0_SHADOW_CONTROL_OP_FLUSH ) 
    5.29 -        clean = 1;
    5.30 -    else 
    5.31 -        ASSERT(sc->op == DOM0_SHADOW_CONTROL_OP_PEEK); 
    5.32 +    clean = (sc->op == DOM0_SHADOW_CONTROL_OP_CLEAN);
    5.33  
    5.34      SHADOW2_DEBUG(LOGDIRTY, "log-dirty %s: dom %u faults=%u dirty=%u\n", 
    5.35                    (clean) ? "clean" : "peek",
    5.36 @@ -3111,25 +3108,27 @@ int shadow2_control_op(struct domain *d,
    5.37  
    5.38      case DOM0_SHADOW_CONTROL_OP_ENABLE_TEST:
    5.39          return shadow2_test_enable(d);
    5.40 -        
    5.41 +
    5.42      case DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY:
    5.43          return shadow2_log_dirty_enable(d);
    5.44 -        
    5.45 -    case DOM0_SHADOW_CONTROL_OP_FLUSH:
    5.46 +
    5.47 +    case DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE:
    5.48 +        return shadow2_enable(d, SHM2_refcounts|SHM2_translate);
    5.49 +
    5.50      case DOM0_SHADOW_CONTROL_OP_CLEAN:
    5.51      case DOM0_SHADOW_CONTROL_OP_PEEK:
    5.52          return shadow2_log_dirty_op(d, sc);
    5.53  
    5.54 -
    5.55 -
    5.56 -    case DOM0_SHADOW2_CONTROL_OP_ENABLE:
    5.57 -        return shadow2_enable(d, sc->mode << SHM2_shift);        
    5.58 -
    5.59 -    case DOM0_SHADOW2_CONTROL_OP_GET_ALLOCATION:
    5.60 +    case DOM0_SHADOW_CONTROL_OP_ENABLE:
    5.61 +        if ( sc->mode & DOM0_SHADOW_ENABLE_LOG_DIRTY )
    5.62 +            return shadow2_log_dirty_enable(d);
    5.63 +        return shadow2_enable(d, sc->mode << SHM2_shift);
    5.64 +
    5.65 +    case DOM0_SHADOW_CONTROL_OP_GET_ALLOCATION:
    5.66          sc->mb = shadow2_get_allocation(d);
    5.67          return 0;
    5.68 -        
    5.69 -    case DOM0_SHADOW2_CONTROL_OP_SET_ALLOCATION:
    5.70 +
    5.71 +    case DOM0_SHADOW_CONTROL_OP_SET_ALLOCATION:
    5.72          rc = shadow2_set_allocation(d, sc->mb, &preempted);
    5.73          if ( preempted )
    5.74              /* Not finished.  Set up to re-run the call. */
    5.75 @@ -3139,8 +3138,7 @@ int shadow2_control_op(struct domain *d,
    5.76              /* Finished.  Return the new allocation */
    5.77              sc->mb = shadow2_get_allocation(d);
    5.78          return rc;
    5.79 -        
    5.80 -        
    5.81 +
    5.82      default:
    5.83          SHADOW2_ERROR("Bad shadow op %u\n", sc->op);
    5.84          return -EINVAL;
     6.1 --- a/xen/common/dom0_ops.c	Tue Aug 22 18:50:22 2006 +0100
     6.2 +++ b/xen/common/dom0_ops.c	Tue Aug 22 18:51:02 2006 +0100
     6.3 @@ -141,7 +141,8 @@ long do_dom0_op(XEN_GUEST_HANDLE(dom0_op
     6.4      if ( copy_from_guest(op, u_dom0_op, 1) )
     6.5          return -EFAULT;
     6.6  
     6.7 -    if ( op->interface_version != DOM0_INTERFACE_VERSION )
     6.8 +    if ( (op->interface_version != DOM0_TOOLS_INTERFACE_VERSION) &&
     6.9 +         (op->interface_version != DOM0_KERNEL_INTERFACE_VERSION) )
    6.10          return -EACCES;
    6.11  
    6.12      if ( acm_pre_dom0_op(op, &ssid) )
     7.1 --- a/xen/include/asm-x86/shadow2.h	Tue Aug 22 18:50:22 2006 +0100
     7.2 +++ b/xen/include/asm-x86/shadow2.h	Tue Aug 22 18:51:02 2006 +0100
     7.3 @@ -32,16 +32,16 @@
     7.4  
     7.5  #define SHM2_shift 10
     7.6  /* We're in one of the shadow modes */
     7.7 -#define SHM2_enable    (DOM0_SHADOW2_CONTROL_FLAG_ENABLE << SHM2_shift)
     7.8 +#define SHM2_enable    (1U << SHM2_shift)
     7.9  /* Refcounts based on shadow tables instead of guest tables */
    7.10 -#define SHM2_refcounts (DOM0_SHADOW2_CONTROL_FLAG_REFCOUNT << SHM2_shift)
    7.11 +#define SHM2_refcounts (DOM0_SHADOW_ENABLE_REFCOUNT << SHM2_shift)
    7.12  /* Enable log dirty mode */
    7.13 -#define SHM2_log_dirty (DOM0_SHADOW2_CONTROL_FLAG_LOG_DIRTY << SHM2_shift)
    7.14 +#define SHM2_log_dirty (DOM0_SHADOW_ENABLE_LOG_DIRTY << SHM2_shift)
    7.15  /* Xen does p2m translation, not guest */
    7.16 -#define SHM2_translate (DOM0_SHADOW2_CONTROL_FLAG_TRANSLATE << SHM2_shift)
    7.17 +#define SHM2_translate (DOM0_SHADOW_ENABLE_TRANSLATE << SHM2_shift)
    7.18  /* Xen does not steal address space from the domain for its own booking;
    7.19   * requires VT or similar mechanisms */
    7.20 -#define SHM2_external  (DOM0_SHADOW2_CONTROL_FLAG_EXTERNAL << SHM2_shift)
    7.21 +#define SHM2_external  (DOM0_SHADOW_ENABLE_EXTERNAL << SHM2_shift)
    7.22  
    7.23  #define shadow2_mode_enabled(_d)   ((_d)->arch.shadow2.mode)
    7.24  #define shadow2_mode_refcounts(_d) ((_d)->arch.shadow2.mode & SHM2_refcounts)
     8.1 --- a/xen/include/public/dom0_ops.h	Tue Aug 22 18:50:22 2006 +0100
     8.2 +++ b/xen/include/public/dom0_ops.h	Tue Aug 22 18:51:02 2006 +0100
     8.3 @@ -18,8 +18,19 @@
     8.4   * Make sure you increment the interface version whenever you modify this file!
     8.5   * This makes sure that old versions of dom0 tools will stop working in a
     8.6   * well-defined way (rather than crashing the machine, for instance).
     8.7 + * 
     8.8 + * Separate kernel from tools as the kernel uses a small subset of the dom0
     8.9 + * operations and so it is unnecessary to break backward compatibility so
    8.10 + * often.
    8.11   */
    8.12 -#define DOM0_INTERFACE_VERSION   0x03000001
    8.13 +#define DOM0_TOOLS_INTERFACE_VERSION  0x13000001
    8.14 +#define DOM0_KERNEL_INTERFACE_VERSION 0x03000001
    8.15 +
    8.16 +#ifdef __XEN_TOOLS__
    8.17 +#define DOM0_INTERFACE_VERSION DOM0_TOOLS_INTERFACE_VERSION
    8.18 +#else
    8.19 +#define DOM0_INTERFACE_VERSION DOM0_KERNEL_INTERFACE_VERSION
    8.20 +#endif
    8.21  
    8.22  /************************************************************************/
    8.23  
    8.24 @@ -253,32 +264,54 @@ DEFINE_XEN_GUEST_HANDLE(dom0_sched_id_t)
    8.25   */
    8.26  #define DOM0_SHADOW_CONTROL  25
    8.27  
    8.28 +/* Disable shadow mode. */
    8.29  #define DOM0_SHADOW_CONTROL_OP_OFF         0
    8.30 -#define DOM0_SHADOW_CONTROL_OP_ENABLE_TEST 1
    8.31 -#define DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY 2
    8.32 -#define DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE 3
    8.33 +
    8.34 +/* Enable shadow mode (mode contains ORed DOM0_SHADOW_ENABLE_* flags). */
    8.35 +#define DOM0_SHADOW_CONTROL_OP_ENABLE      32
    8.36  
    8.37 -#define DOM0_SHADOW_CONTROL_OP_FLUSH       10     /* table ops */
    8.38 +/* Log-dirty bitmap operations. */
    8.39 + /* Return the bitmap and clean internal copy for next round. */
    8.40  #define DOM0_SHADOW_CONTROL_OP_CLEAN       11
    8.41 + /* Return the bitmap but do not modify internal copy. */
    8.42  #define DOM0_SHADOW_CONTROL_OP_PEEK        12
    8.43  
    8.44 -/* Shadow2 operations */
    8.45 -#define DOM0_SHADOW2_CONTROL_OP_GET_ALLOCATION   30
    8.46 -#define DOM0_SHADOW2_CONTROL_OP_SET_ALLOCATION   31
    8.47 -#define DOM0_SHADOW2_CONTROL_OP_ENABLE           32
    8.48 +/* Memory allocation accessors. */
    8.49 +#define DOM0_SHADOW_CONTROL_OP_GET_ALLOCATION   30
    8.50 +#define DOM0_SHADOW_CONTROL_OP_SET_ALLOCATION   31
    8.51 +
    8.52 +/* Legacy enable operations. */
    8.53 + /* Equiv. to ENABLE with no mode flags. */
    8.54 +#define DOM0_SHADOW_CONTROL_OP_ENABLE_TEST       1
    8.55 + /* Equiv. to ENABLE with mode flag ENABLE_LOG_DIRTY. */
    8.56 +#define DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY   2
    8.57 + /* Equiv. to ENABLE with mode flags ENABLE_REFCOUNT and ENABLE_TRANSLATE. */
    8.58 +#define DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE  3
    8.59  
    8.60 -/* Mode flags for Shadow2 enable op */
    8.61 -#define DOM0_SHADOW2_CONTROL_FLAG_ENABLE    (1 << 0)
    8.62 -#define DOM0_SHADOW2_CONTROL_FLAG_REFCOUNT  (1 << 1)
    8.63 -#define DOM0_SHADOW2_CONTROL_FLAG_LOG_DIRTY (1 << 2)
    8.64 -#define DOM0_SHADOW2_CONTROL_FLAG_TRANSLATE (1 << 3)
    8.65 -#define DOM0_SHADOW2_CONTROL_FLAG_EXTERNAL  (1 << 4)
    8.66 +/* Mode flags for DOM0_SHADOW_CONTROL_OP_ENABLE. */
    8.67 + /*
    8.68 +  * Shadow pagetables are refcounted: guest does not use explicit mmu
    8.69 +  * operations nor write-protect its pagetables.
    8.70 +  */
    8.71 +#define DOM0_SHADOW_ENABLE_REFCOUNT  (1 << 1)
    8.72 + /*
    8.73 +  * Log pages in a bitmap as they are dirtied.
    8.74 +  * Used for live relocation to determine which pages must be re-sent.
    8.75 +  */
    8.76 +#define DOM0_SHADOW_ENABLE_LOG_DIRTY (1 << 2)
    8.77 + /*
    8.78 +  * Automatically translate GPFNs into MFNs.
    8.79 +  */
    8.80 +#define DOM0_SHADOW_ENABLE_TRANSLATE (1 << 3)
    8.81 + /*
    8.82 +  * Xen does not steal virtual address space from the guest.
    8.83 +  * Requires HVM support.
    8.84 +  */
    8.85 +#define DOM0_SHADOW_ENABLE_EXTERNAL  (1 << 4)
    8.86  
    8.87  struct dom0_shadow_control_stats {
    8.88      uint32_t fault_count;
    8.89      uint32_t dirty_count;
    8.90 -    uint32_t dirty_net_count;
    8.91 -    uint32_t dirty_block_count;
    8.92  };
    8.93  typedef struct dom0_shadow_control_stats dom0_shadow_control_stats_t;
    8.94  DEFINE_XEN_GUEST_HANDLE(dom0_shadow_control_stats_t);
    8.95 @@ -286,13 +319,17 @@ DEFINE_XEN_GUEST_HANDLE(dom0_shadow_cont
    8.96  struct dom0_shadow_control {
    8.97      /* IN variables. */
    8.98      domid_t        domain;
    8.99 -    uint32_t       op;
   8.100 +    uint32_t       op;       /* DOM0_SHADOW_CONTROL_OP_* */
   8.101 +
   8.102 +    /* OP_ENABLE */
   8.103 +    uint32_t       mode;     /* DOM0_SHADOW_ENABLE_* */
   8.104 +
   8.105 +    /* OP_GET_ALLOCATION / OP_SET_ALLOCATION */
   8.106 +    uint32_t       mb;       /* Shadow memory allocation in MB */
   8.107 +
   8.108 +    /* OP_PEEK / OP_CLEAN */
   8.109      XEN_GUEST_HANDLE(ulong) dirty_bitmap;
   8.110 -    /* IN/OUT variables. */
   8.111 -    uint64_t       pages;    /* size of buffer, updated with actual size */
   8.112 -    uint32_t       mb;       /* Shadow2 memory allocation in MB */
   8.113 -    uint32_t       mode;     /* Shadow2 mode to enable */
   8.114 -    /* OUT variables. */
   8.115 +    uint64_t       pages;    /* Size of buffer. Updated with actual size. */
   8.116      struct dom0_shadow_control_stats stats;
   8.117  };
   8.118  typedef struct dom0_shadow_control dom0_shadow_control_t;