mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 02:30:03 +01:00
x86: Allow TSC mode (emulate vs native) to be configured per domain.
The default is to emulate. Old saved images will be restored with legacy behaviour however (native TSC, no emulation). Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com> Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
This commit is contained in:
1 parent
bcc6585767
commit
bf2c44f8b4
21 files changed
+160
-54
No files matched your search
@@ -1459,6 +1459,20 @@ static PyObject *pyxc_domain_set_time_offset(XcObject *self, PyObject *args)
|
||||
return zero;
|
||||
}
|
||||
|
||||
static PyObject *pyxc_domain_set_tsc_native(XcObject *self, PyObject *args)
|
||||
{
|
||||
uint32_t dom, is_native;
|
||||
|
||||
if (!PyArg_ParseTuple(args, "ii", &dom, &is_native))
|
||||
return NULL;
|
||||
|
||||
if (xc_domain_set_tsc_native(self->xc_handle, dom, is_native) != 0)
|
||||
return pyxc_error_to_exception();
|
||||
|
||||
Py_INCREF(zero);
|
||||
return zero;
|
||||
}
|
||||
|
||||
static PyObject *pyxc_domain_send_trigger(XcObject *self,
|
||||
PyObject *args,
|
||||
PyObject *kwds)
|
||||
@@ -1981,6 +1995,14 @@ static PyMethodDef pyxc_methods[] = {
|
||||
" offset [int]: Time offset from UTC in seconds.\n"
|
||||
"Returns: [int] 0 on success; -1 on error.\n" },
|
||||
|
||||
{ "domain_set_tsc_native",
|
||||
(PyCFunction)pyxc_domain_set_tsc_native,
|
||||
METH_VARARGS, "\n"
|
||||
"Set a domain's TSC mode (emulate vs native)\n"
|
||||
" dom [int]: Domain whose TSC mode is being set.\n"
|
||||
" is_native [int]: 1=native, 0=emulate.\n"
|
||||
"Returns: [int] 0 on success; -1 on error.\n" },
|
||||
|
||||
{ "domain_send_trigger",
|
||||
(PyCFunction)pyxc_domain_send_trigger,
|
||||
METH_VARARGS | METH_KEYWORDS, "\n"
|
||||
|
||||
@@ -162,6 +162,7 @@ XENAPI_PLATFORM_CFG_TYPES = {
|
||||
'vncdisplay': int,
|
||||
'vnclisten': str,
|
||||
'timer_mode': int,
|
||||
'tsc_native': int,
|
||||
'vpt_align': int,
|
||||
'viridian': int,
|
||||
'vncpasswd': str,
|
||||
@@ -473,6 +474,9 @@ class XendConfig(dict):
|
||||
if not os.path.exists(self['platform']['device_model']):
|
||||
raise VmError("device model '%s' not found" % str(self['platform']['device_model']))
|
||||
|
||||
if 'tsc_native' not in self['platform']:
|
||||
self['platform']['tsc_native'] = 0
|
||||
|
||||
if self.is_hvm():
|
||||
if 'timer_mode' not in self['platform']:
|
||||
self['platform']['timer_mode'] = 1
|
||||
|
||||
@@ -2423,7 +2423,12 @@ class XendDomainInfo:
|
||||
|
||||
self._recreateDom()
|
||||
|
||||
# Set timer configration of domain
|
||||
# Set TSC mode of domain
|
||||
tsc_native = self.info["platform"].get("tsc_native")
|
||||
if arch.type == "x86" and tsc_native is not None:
|
||||
xc.domain_set_tsc_native(self.domid, tsc_native)
|
||||
|
||||
# Set timer configuration of domain
|
||||
timer_mode = self.info["platform"].get("timer_mode")
|
||||
if hvm and timer_mode is not None:
|
||||
xc.hvm_set_param(self.domid, HVM_PARAM_TIMER_MODE,
|
||||
|
||||
@@ -221,6 +221,10 @@ gopts.var('timer_mode', val='TIMER_MODE',
|
||||
use="""Timer mode (0=delay virtual time when ticks are missed;
|
||||
1=virtual time is always wallclock time.""")
|
||||
|
||||
gopts.var('tsc_native', val='TSC_NATIVE',
|
||||
fn=set_int, default=0,
|
||||
use="""TSC mode (0=emulate TSC, 1=native TSC).""")
|
||||
|
||||
gopts.var('vpt_align', val='VPT_ALIGN',
|
||||
fn=set_int, default=1,
|
||||
use="Enable aligning all periodic vpt to reduce timer interrupts.")
|
||||
@@ -715,6 +719,9 @@ def configure_image(vals):
|
||||
if vals.suppress_spurious_page_faults:
|
||||
config_image.append(['suppress_spurious_page_faults', vals.suppress_spurious_page_faults])
|
||||
|
||||
if vals.tsc_native is not None:
|
||||
config_image.append(['tsc_native', vals.tsc_native])
|
||||
|
||||
return config_image
|
||||
|
||||
def configure_disks(config_devs, vals):
|
||||
@@ -984,7 +991,7 @@ def make_config(vals):
|
||||
config.append([n, v])
|
||||
|
||||
map(add_conf, ['name', 'memory', 'maxmem', 'shadow_memory',
|
||||
'restart', 'on_poweroff',
|
||||
'restart', 'on_poweroff', 'tsc_native',
|
||||
'on_reboot', 'on_crash', 'vcpus', 'vcpu_avail', 'features',
|
||||
'on_xend_start', 'on_xend_stop', 'target', 'cpuid',
|
||||
'cpuid_check', 'machine_address_size', 'suppress_spurious_page_faults'])
|
||||
|
||||
@@ -1066,6 +1066,7 @@ class sxp2xml:
|
||||
'pci_msitranslate',
|
||||
'pci_power_mgmt',
|
||||
'xen_platform_pci',
|
||||
'tsc_native'
|
||||
]
|
||||
|
||||
platform_configs = []
|
||||
|
||||