diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dbf8b06d7..5bfd3aa5c0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ### Changed - Repurpose command line gnttab_max_{maptrack_,}frames options so they don't cap toolstack provided values. + - Ignore VCPUOP_set_singleshot_timer's VCPU_SSHOTTMR_future flag. The only + known user doesn't use it properly, leading to in-guest breakage. ### Added - On x86, support for features new in Intel Sapphire Rapids CPUs: diff --git a/xen/common/domain.c b/xen/common/domain.c index 626debbae0..6a440590fe 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -1762,9 +1762,16 @@ long common_vcpu_op(int cmd, struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg) if ( copy_from_guest(&set, arg, 1) ) return -EFAULT; - if ( (set.flags & VCPU_SSHOTTMR_future) && - (set.timeout_abs_ns < NOW()) ) - return -ETIME; + if ( set.timeout_abs_ns < NOW() ) + { + /* + * Simplify the logic if the timeout has already expired and just + * inject the event. + */ + stop_timer(&v->singleshot_timer); + send_timer_event(v); + break; + } migrate_timer(&v->singleshot_timer, smp_processor_id()); set_timer(&v->singleshot_timer, set.timeout_abs_ns); diff --git a/xen/include/public/vcpu.h b/xen/include/public/vcpu.h index 81a3b3a743..a836b264a9 100644 --- a/xen/include/public/vcpu.h +++ b/xen/include/public/vcpu.h @@ -150,7 +150,10 @@ typedef struct vcpu_set_singleshot_timer vcpu_set_singleshot_timer_t; DEFINE_XEN_GUEST_HANDLE(vcpu_set_singleshot_timer_t); /* Flags to VCPUOP_set_singleshot_timer. */ - /* Require the timeout to be in the future (return -ETIME if it's passed). */ + /* + * Request the timeout to be in the future (return -ETIME if it's passed) + * but can be ignored by the hypervisor. + */ #define _VCPU_SSHOTTMR_future (0) #define VCPU_SSHOTTMR_future (1U << _VCPU_SSHOTTMR_future)