xen/xen.bug1026236.suse_vtsc_tolerance.patch
Charles Arnold 508747f303 - Update to Xen 4.20.0 pre-release (jsc#PED-8907)
xen-4.20.0-testing-src.tar.bz2
- New Features
  * On Arm:
    - Experimental support for Armv8-R.
    - Support for NXP S32G3 Processors Family and NXP LINFlexD UART driver.
    - Basic handling for SCMI requests over SMC using Shared Memory, by allowing
      forwarding the calls to EL3 FW if coming from hwdom.
    - Support for LLC (Last Level Cache) coloring.
  * On x86:
    - xl suspend/resume subcommands.
- Changed Features
  * Fixed blkif protocol specification for sector sizes different than 512b.
  * The dombuilder in libxenguest no longer un-gzips secondary modules, instead
    leaving this to the guest kernel to do in guest context.
  * On x86:
    - Prefer ACPI reboot over UEFI ResetSystem() run time service call.
    - Switched the xAPIC flat driver to use physical destination mode for external
      interrupts instead of logical destination mode.
- Removed Features
  * On x86:
    - Support for running on Xeon Phi processors.
    - Removed the `ucode=allow-same` command line option.
    - Removed x2APIC Cluster Mode for external interrupts.  x2APIC Physical and
      Mixed Modes are still available.
- Dropped patches
  xsa466.patch

- Move /etc/bash_completion.d/xl back to %_datadir/bash-completion/completions

OBS-URL: https://build.opensuse.org/package/show/Virtualization/xen?expand=0&rev=863
2025-01-02 17:22:02 +00:00

59 lines
2.2 KiB
Diff

suse_vtsc_tolerance=<val>
Reference: bsc#1026236
To avoid emulation of vTSC after live migration or save/restore allow
different clock frequency up to the specified value. If the frequency
is within the allowed range TSC access by the domU will be performed
at native speed. Otherwise TSC access will be emulated. It is up to
the hostadmin to decide how much tolerance all running domUs can
actually handle. The default is zero tolerance.
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -47,6 +47,9 @@
static char __initdata opt_clocksource[10];
string_param("clocksource", opt_clocksource);
+static unsigned int __ro_after_init opt_suse_vtsc_tolerance;
+integer_param("suse_vtsc_tolerance", opt_suse_vtsc_tolerance);
+
unsigned long __read_mostly cpu_khz; /* CPU clock frequency in kHz. */
DEFINE_SPINLOCK(rtc_lock);
unsigned long pit0_ticks;
@@ -2887,6 +2890,8 @@ int tsc_set_info(struct domain *d,
switch ( tsc_mode )
{
+ bool disable_vtsc;
+
case XEN_CPUID_TSC_MODE_DEFAULT:
case XEN_CPUID_TSC_MODE_ALWAYS_EMULATE:
d->arch.vtsc_offset = get_s_time() - elapsed_nsec;
@@ -2900,8 +2905,25 @@ int tsc_set_info(struct domain *d,
* When a guest is created, gtsc_khz is passed in as zero, making
* d->arch.tsc_khz == cpu_khz. Thus no need to check incarnation.
*/
+ disable_vtsc = d->arch.tsc_khz == cpu_khz;
+
+ if ( tsc_mode == XEN_CPUID_TSC_MODE_DEFAULT && !disable_vtsc &&
+ opt_suse_vtsc_tolerance && is_hvm_domain(d) )
+ {
+ long khz_diff = ABS((long)cpu_khz - gtsc_khz);
+
+ disable_vtsc = khz_diff <= opt_suse_vtsc_tolerance;
+
+ printk(XENLOG_G_INFO "%pd: host has %lu kHz,"
+ " domU expects %u kHz,"
+ " difference of %ld is %s tolerance of %u\n",
+ d, cpu_khz, gtsc_khz, khz_diff,
+ disable_vtsc ? "within" : "outside",
+ opt_suse_vtsc_tolerance);
+ }
+
if ( tsc_mode == XEN_CPUID_TSC_MODE_DEFAULT && host_tsc_is_safe() &&
- (d->arch.tsc_khz == cpu_khz ||
+ (disable_vtsc ||
(is_hvm_domain(d) &&
hvm_get_tsc_scaling_ratio(d->arch.tsc_khz))) )
{