ia64/xen-unstable

changeset 19121:988aee72f73d

stubdom: add videoram to stubdom initial memory reservation

This patch adds a videoram parameter (4MB is the default) to pv guests
too: if the pv guest is actually a stubdomain then the videoram size
is added to the initial required available memory.
This way there is no risk that a stubdom fails to populate the
videoram because the RAM freed for the videoram by dom0 has already
been used to create the stubdom.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Thu Jan 29 16:41:48 2009 +0000 (2009-01-29)
parents e1352667df95
children 916ca93a8658
files stubdom/stubdom-dm tools/python/xen/xend/image.py tools/python/xen/xm/create.py
line diff
     1.1 --- a/stubdom/stubdom-dm	Thu Jan 29 16:40:48 2009 +0000
     1.2 +++ b/stubdom/stubdom-dm	Thu Jan 29 16:41:48 2009 +0000
     1.3 @@ -15,6 +15,7 @@ domname=
     1.4  vncviewer=0
     1.5  vncpid=
     1.6  extra=
     1.7 +videoram=4
     1.8  while [ "$#" -gt 0 ];
     1.9  do
    1.10      if [ "$#" -ge 2 ];
    1.11 @@ -38,6 +39,10 @@ do
    1.12                  extra="$extra -loadvm $2";
    1.13                  shift
    1.14                  ;;
    1.15 +	    -videoram)
    1.16 +	        videoram="$2"
    1.17 +		shift
    1.18 +		;;
    1.19  	esac
    1.20      fi
    1.21      case "$1" in
    1.22 @@ -72,7 +77,7 @@ do
    1.23  	sleep 1
    1.24  done
    1.25  
    1.26 -creation="xm create -c $domname-dm target=$domid memory=32 extra=\"$extra\""
    1.27 +creation="xm create -c $domname-dm target=$domid memory=32 videoram=$videoram extra=\"$extra\""
    1.28  
    1.29  (while true ; do sleep 60 ; done) | /bin/sh -c "$creation" &
    1.30  #xterm -geometry +0+0 -e /bin/sh -c "$creation ; echo ; echo press ENTER to shut down ; read" &
     2.1 --- a/tools/python/xen/xend/image.py	Thu Jan 29 16:40:48 2009 +0000
     2.2 +++ b/tools/python/xen/xend/image.py	Thu Jan 29 16:41:48 2009 +0000
     2.3 @@ -633,6 +633,8 @@ class LinuxImageHandler(ImageHandler):
     2.4  
     2.5      def configure(self, vmConfig):
     2.6          ImageHandler.configure(self, vmConfig)
     2.7 +        self.vramsize = int(vmConfig['platform'].get('videoram',4)) * 1024
     2.8 +        self.is_stubdom = (self.kernel.find('stubdom') >= 0)
     2.9  
    2.10      def buildDomain(self):
    2.11          store_evtchn = self.vm.getStorePort()
    2.12 @@ -664,6 +666,17 @@ class LinuxImageHandler(ImageHandler):
    2.13                                flags          = self.flags,
    2.14                                vhpt           = self.vhpt)
    2.15  
    2.16 +    def getRequiredAvailableMemory(self, mem_kb):
    2.17 +        if self.is_stubdom :
    2.18 +            mem_kb += self.vramsize
    2.19 +        return mem_kb
    2.20 +
    2.21 +    def getRequiredInitialReservation(self):
    2.22 +        return self.vm.getMemoryTarget()
    2.23 +
    2.24 +    def getRequiredMaximumReservation(self):
    2.25 +        return self.vm.getMemoryMaximum()
    2.26 +
    2.27      def parseDeviceModelArgs(self, vmConfig):
    2.28          ret = ImageHandler.parseDeviceModelArgs(self, vmConfig)
    2.29          # Equivalent to old xenconsoled behaviour. Should make
     3.1 --- a/tools/python/xen/xm/create.py	Thu Jan 29 16:40:48 2009 +0000
     3.2 +++ b/tools/python/xen/xm/create.py	Thu Jan 29 16:41:48 2009 +0000
     3.3 @@ -635,6 +635,8 @@ def configure_image(vals):
     3.4      if vals.root:
     3.5          cmdline_root = strip('root=', vals.root)
     3.6          config_image.append(['root', cmdline_root])
     3.7 +    if vals.videoram:
     3.8 +        config_image.append(['videoram', vals.videoram])
     3.9      if vals.extra:
    3.10          config_image.append(['args', vals.extra])
    3.11  
    3.12 @@ -884,7 +886,7 @@ def configure_hvm(config_image, vals):
    3.13      """Create the config for HVM devices.
    3.14      """
    3.15      args = [ 'device_model', 'pae', 'vcpus', 'boot', 'fda', 'fdb', 'timer_mode',
    3.16 -             'localtime', 'serial', 'stdvga', 'videoram', 'isa', 'nographic', 'soundhw',
    3.17 +             'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'soundhw',
    3.18               'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'vnclisten',
    3.19               'sdl', 'display', 'xauthority', 'rtc_timeoffset', 'monitor',
    3.20               'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci', 'hpet',