direct-io.hg

changeset 11420:45746c770018

Merge.
author ssmith@weybridge.uk.xensource.com
date Tue Sep 05 14:28:19 2006 +0100 (2006-09-05)
parents 3f568dd6bda6 65a41e3206ac
children 323a89a3c01c
files
line diff
     1.1 --- a/docs/src/user.tex	Tue Sep 05 14:27:05 2006 +0100
     1.2 +++ b/docs/src/user.tex	Tue Sep 05 14:28:19 2006 +0100
     1.3 @@ -1661,7 +1661,7 @@ As the virtual machine writes to its `di
     1.4  filled in and consume more space up to the original 2GB.
     1.5  
     1.6  {\em{Note:}} Users that have worked with file-backed VBDs on Xen in previous
     1.7 -versions will be interested to know that this support is not provided through
     1.8 +versions will be interested to know that this support is now provided through
     1.9  the blktap driver instead of the loopback driver.  This change results in
    1.10  file-based block devices that are higher-performance, more scalable, and which
    1.11  provide better safety properties for VBD data.  All that is required to update
     2.1 --- a/tools/examples/vtpm-common.sh	Tue Sep 05 14:27:05 2006 +0100
     2.2 +++ b/tools/examples/vtpm-common.sh	Tue Sep 05 14:28:19 2006 +0100
     2.3 @@ -48,6 +48,9 @@ else
     2.4  	function vtpm_migrate() {
     2.5  		echo "Error: vTPM migration accross machines not implemented."
     2.6  	}
     2.7 +	function vtpm_migrate_local() {
     2.8 +		echo "Error: local vTPM migration not supported"
     2.9 +	}
    2.10  	function vtpm_migrate_recover() {
    2.11  		true
    2.12  	}
    2.13 @@ -353,6 +356,8 @@ function vtpm_migration_step() {
    2.14  	local res=$(vtpm_isLocalAddress $1)
    2.15  	if [ "$res" == "0" ]; then
    2.16  		vtpm_migrate $1 $2 $3
    2.17 +	else
    2.18 +		vtpm_migrate_local
    2.19  	fi
    2.20  }
    2.21  
     3.1 --- a/tools/examples/vtpm-impl	Tue Sep 05 14:27:05 2006 +0100
     3.2 +++ b/tools/examples/vtpm-impl	Tue Sep 05 14:28:19 2006 +0100
     3.3 @@ -184,3 +184,6 @@ function vtpm_migrate_recover() {
     3.4   echo "Error: Recovery not supported yet" 
     3.5  }
     3.6  
     3.7 +function vtpm_migrate_local() {
     3.8 + echo "Error: local vTPM migration not supported"
     3.9 +}
     4.1 --- a/tools/python/xen/xend/XendDomainInfo.py	Tue Sep 05 14:27:05 2006 +0100
     4.2 +++ b/tools/python/xen/xend/XendDomainInfo.py	Tue Sep 05 14:28:19 2006 +0100
     4.3 @@ -1285,28 +1285,37 @@ class XendDomainInfo:
     4.4                  for v in range(0, self.info['max_vcpu_id']+1):
     4.5                      xc.vcpu_setaffinity(self.domid, v, self.info['cpus'])
     4.6  
     4.7 +            # Use architecture- and image-specific calculations to determine
     4.8 +            # the various headrooms necessary, given the raw configured
     4.9 +            # values.
    4.10 +            # reservation, maxmem, memory, and shadow are all in KiB.
    4.11 +            reservation = self.image.getRequiredInitialReservation(
    4.12 +                self.info['memory'] * 1024)
    4.13 +            maxmem = self.image.getRequiredAvailableMemory(
    4.14 +                self.info['maxmem'] * 1024)
    4.15 +            memory = self.image.getRequiredAvailableMemory(
    4.16 +                self.info['memory'] * 1024)
    4.17 +            shadow = self.image.getRequiredShadowMemory(
    4.18 +                self.info['shadow_memory'] * 1024,
    4.19 +                self.info['maxmem'] * 1024)
    4.20 +
    4.21 +            # Round shadow up to a multiple of a MiB, as shadow_mem_control
    4.22 +            # takes MiB and we must not round down and end up under-providing.
    4.23 +            shadow = ((shadow + 1023) / 1024) * 1024
    4.24 +
    4.25              # set memory limit
    4.26 -            maxmem = self.image.getRequiredMemory(self.info['maxmem'] * 1024)
    4.27              xc.domain_setmaxmem(self.domid, maxmem)
    4.28  
    4.29 -            mem_kb = self.image.getRequiredMemory(self.info['memory'] * 1024)
    4.30 -
    4.31 -            # get the domain's shadow memory requirement
    4.32 -            shadow_kb = self.image.getRequiredShadowMemory(mem_kb)
    4.33 -            shadow_kb_req = self.info['shadow_memory'] * 1024
    4.34 -            if shadow_kb_req > shadow_kb:
    4.35 -                shadow_kb = shadow_kb_req
    4.36 -            shadow_mb = (shadow_kb + 1023) / 1024
    4.37 -
    4.38              # Make sure there's enough RAM available for the domain
    4.39 -            balloon.free(mem_kb + shadow_mb * 1024)
    4.40 +            balloon.free(memory + shadow)
    4.41  
    4.42              # Set up the shadow memory
    4.43 -            shadow_cur = xc.shadow_mem_control(self.domid, shadow_mb)
    4.44 +            shadow_cur = xc.shadow_mem_control(self.domid, shadow / 1024)
    4.45              self.info['shadow_memory'] = shadow_cur
    4.46  
    4.47 -            # initial memory allocation
    4.48 -            xc.domain_memory_increase_reservation(self.domid, mem_kb, 0, 0)
    4.49 +            # initial memory reservation
    4.50 +            xc.domain_memory_increase_reservation(self.domid, reservation, 0,
    4.51 +                                                  0)
    4.52  
    4.53              self.createChannels()
    4.54  
     5.1 --- a/tools/python/xen/xend/image.py	Tue Sep 05 14:27:05 2006 +0100
     5.2 +++ b/tools/python/xen/xend/image.py	Tue Sep 05 14:28:19 2006 +0100
     5.3 @@ -143,12 +143,27 @@ class ImageHandler:
     5.4              raise VmError('Building domain failed: ostype=%s dom=%d err=%s'
     5.5                            % (self.ostype, self.vm.getDomid(), str(result)))
     5.6  
     5.7 -    def getRequiredMemory(self, mem_kb):
     5.8 +    def getRequiredAvailableMemory(self, mem_kb):
     5.9 +        """@param mem_kb The configured maxmem or memory, in KiB.
    5.10 +        @return The corresponding required amount of memory for the domain,
    5.11 +        also in KiB.  This is normally the given mem_kb, but architecture- or
    5.12 +        image-specific code may override this to add headroom where
    5.13 +        necessary."""
    5.14          return mem_kb
    5.15  
    5.16 -    def getRequiredShadowMemory(self, mem_kb):
    5.17 -        """@return The minimum shadow memory required, in KiB, for a domain 
    5.18 -        with mem_kb KiB of RAM."""
    5.19 +    def getRequiredInitialReservation(self, mem_kb):
    5.20 +        """@param mem_kb The configured memory, in KiB.
    5.21 +        @return The corresponding required amount of memory to be free, also
    5.22 +        in KiB. This is normally the same as getRequiredAvailableMemory, but
    5.23 +        architecture- or image-specific code may override this to
    5.24 +        add headroom where necessary."""
    5.25 +        return self.getRequiredAvailableMemory(mem_kb)
    5.26 +
    5.27 +    def getRequiredShadowMemory(self, shadow_mem_kb, maxmem_kb):
    5.28 +        """@param shadow_mem_kb The configured shadow memory, in KiB.
    5.29 +        @param maxmem_kb The configured maxmem, in KiB.
    5.30 +        @return The corresponding required amount of shadow memory, also in
    5.31 +        KiB."""
    5.32          # PV domains don't need any shadow memory
    5.33          return 0
    5.34  
    5.35 @@ -418,7 +433,7 @@ class IA64_HVM_ImageHandler(HVMImageHand
    5.36  
    5.37      ostype = "hvm"
    5.38  
    5.39 -    def getRequiredMemory(self, mem_kb):
    5.40 +    def getRequiredAvailableMemory(self, mem_kb):
    5.41          page_kb = 16
    5.42          # ROM size for guest firmware, ioreq page and xenstore page
    5.43          extra_pages = 1024 + 2
    5.44 @@ -432,19 +447,29 @@ class X86_HVM_ImageHandler(HVMImageHandl
    5.45  
    5.46      ostype = "hvm"
    5.47  
    5.48 -    def getRequiredMemory(self, mem_kb):
    5.49 +    def getRequiredAvailableMemory(self, mem_kb):
    5.50          page_kb = 4
    5.51          # This was derived emperically:
    5.52 -        #   2.4 MB overhead per 1024 MB RAM + 8 MB constant
    5.53 +        #   2.4 MB overhead per 1024 MB RAM
    5.54          #   + 4 to avoid low-memory condition
    5.55 -        extra_mb = (2.4/1024) * (mem_kb/1024.0) + 12;
    5.56 +        extra_mb = (2.4/1024) * (mem_kb/1024.0) + 4;
    5.57          extra_pages = int( math.ceil( extra_mb*1024 / page_kb ))
    5.58          return mem_kb + extra_pages * page_kb
    5.59  
    5.60 -    def getRequiredShadowMemory(self, mem_kb):
    5.61 +    def getRequiredInitialReservation(self, mem_kb):
    5.62 +        # Add 8 MiB overhead for QEMU's video RAM.
    5.63 +        return self.getRequiredAvailableMemory(mem_kb) + 8192
    5.64 +
    5.65 +    def getRequiredShadowMemory(self, shadow_mem_kb, maxmem_kb):
    5.66 +        # The given value is the configured value -- we need to include the
    5.67 +        # overhead due to getRequiredMemory.
    5.68 +        maxmem_kb = self.getRequiredMemory(maxmem_kb)
    5.69 +
    5.70          # 1MB per vcpu plus 4Kib/Mib of RAM.  This is higher than 
    5.71          # the minimum that Xen would allocate if no value were given.
    5.72 -        return 1024 * self.vm.getVCpuCount() + mem_kb / 256
    5.73 +        return max(1024 * self.vm.getVCpuCount() + maxmem_kb / 256,
    5.74 +                   shadow_mem_kb)
    5.75 +
    5.76  
    5.77  _handlers = {
    5.78      "powerpc": {