From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alex Williamson Subject: Re: [PATCH] Create XEN_DOMCTL_set_opt_feature Date: Wed, 28 Nov 2007 11:39:32 -0700 Message-ID: <1196275172.7687.33.camel@lappy> References: Mime-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: xen-devel , xen-ia64-devel List-Id: xen-devel@lists.xenproject.org On Wed, 2007-11-28 at 17:39 +0000, Keir Fraser wrote: > On 28/11/07 17:31, "Alex Williamson" wrote: > > > This patch goes along with the guest_os_type domain config patch. > > Once we know what the guest OS is in the builder code, we need a > > mechanism to set optimization features for that guest. This is done via > > a new XEN_DOMCTL as shown in the patch below. This only has ia64 > > specific contents at the moment, but could be expanded for x86. I > > expect the contents of the structure will mostly be architecture > > specific. Thanks, > > If you use this in the builder, why do you need a hvm param at all? In any > case I don't like the encoding of OS strings into hvm_param integers. Either > the concept of 'OS type' should not be visible to Xen, or a proper > enumeration should be defined, or if you want a string then the builder > should stick it in memory for your virtual boot firmware to pick up. Hi Keir, You're right, thanks for bringing it to my attention that storing it in an hvm_param is simply unnecessary. If we add the guest_os_type config option as per the new patch below, and still add the XEN_DOMCTL_set_opt_feature call, everything else can be done in architecture code. I'll make a pyxc binding to an xc_ia64_set_os_type that gets passed self.guest_os_type and makes use of set_opt_feature. This avoids munging the string into an integer entirely and keeps guest_os_type out of Xen. Does this look more reasonable? Please also apply this and the original XEN_DOMCTL_set_opt_feature patch if so. Thanks, Alex Signed-off-by: Alex Williamson --- diff -r c555a5f97982 tools/python/xen/xend/XendConfig.py --- a/tools/python/xen/xend/XendConfig.py Wed Nov 28 13:36:56 2007 +0000 +++ b/tools/python/xen/xend/XendConfig.py Wed Nov 28 09:48:59 2007 -0700 @@ -129,7 +129,8 @@ XENAPI_PLATFORM_CFG = [ 'acpi', 'apic', 'nographic', 'pae', 'rtc_timeoffset', 'serial', 'sdl', 'soundhw','stdvga', 'usb', 'usbdevice', 'vnc', 'vncconsole', 'vncdisplay', 'vnclisten', 'timer_mode', - 'vncpasswd', 'vncunused', 'xauthority', 'pci', 'vhpt'] + 'vncpasswd', 'vncunused', 'xauthority', 'pci', 'vhpt', + 'guest_os_type' ] # Xen API console 'other_config' keys. XENAPI_CONSOLE_OTHER_CFG = ['vncunused', 'vncdisplay', 'vnclisten', diff -r c555a5f97982 tools/python/xen/xend/image.py --- a/tools/python/xen/xend/image.py Wed Nov 28 13:36:56 2007 +0000 +++ b/tools/python/xen/xend/image.py Wed Nov 28 11:22:38 2007 -0700 @@ -426,6 +426,7 @@ class HVMImageHandler(ImageHandler): self.apic = int(vmConfig['platform'].get('apic', 0)) self.acpi = int(vmConfig['platform'].get('acpi', 0)) + self.guest_os_type = vmConfig['platform'].get('guest_os_type') # Return a list of cmd line args to the device models based on the # xm config file diff -r c555a5f97982 tools/python/xen/xm/create.py --- a/tools/python/xen/xm/create.py Wed Nov 28 13:36:56 2007 +0000 +++ b/tools/python/xen/xm/create.py Wed Nov 28 09:48:59 2007 -0700 @@ -453,6 +453,10 @@ gopts.var('usbdevice', val='NAME', gopts.var('usbdevice', val='NAME', fn=set_value, default='', use="Name of USB device to add?") + +gopts.var('guest_os_type', val='NAME', + fn=set_value, default='default', + use="Guest OS type running in HVM") gopts.var('stdvga', val='no|yes', fn=set_bool, default=0, @@ -733,7 +737,9 @@ def configure_hvm(config_image, vals): 'localtime', 'serial', 'stdvga', 'isa', 'nographic', 'soundhw', 'vnc', 'vncdisplay', 'vncunused', 'vncconsole', 'vnclisten', 'sdl', 'display', 'xauthority', 'rtc_timeoffset', 'monitor', - 'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci' ] + 'acpi', 'apic', 'usb', 'usbdevice', 'keymap', 'pci', + 'guest_os_type'] + for a in args: if a in vals.__dict__ and vals.__dict__[a] is not None: config_image.append([a, vals.__dict__[a]])