[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH] xen/vcpu: remove vcpu_set_singleshot_timer flags field
The addition of the flags field in the vcpu_set_singleshot_timer in 505ef3ea8687 is an ABI breakage, as the size of the structure is increased. Remove such field addition and drop the implementation of the VCPU_SSHOTTMR_future flag. If a timer provides an expired timeout value just inject the timer interrupt. Bump the Xen interface version, and keep the flags field and VCPU_SSHOTTMR_future available for guests using the old interface. Note the removal of the field from the vcpu_set_singleshot_timer struct allows removing the compat translation of the struct. Fixes: 505ef3ea8687 ('Add flags field to VCPUOP_set_singlsehot_timer.') Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx> --- CHANGELOG.md | 2 ++ xen/common/compat/domain.c | 18 +++++------------- xen/common/domain.c | 13 ++++++++++--- xen/include/public/vcpu.h | 12 +++++++----- xen/include/public/xen-compat.h | 2 +- xen/include/xlat.lst | 2 +- 6 files changed, 26 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5dbf8b06d72c..b0d9bf4edbda 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. + - Remove flags field from vcpu_set_periodic_timer: its introduction was an + ABI breakage. ### Added - On x86, support for features new in Intel Sapphire Rapids CPUs: diff --git a/xen/common/compat/domain.c b/xen/common/compat/domain.c index c4254905359e..ffc73a9a1dc9 100644 --- a/xen/common/compat/domain.c +++ b/xen/common/compat/domain.c @@ -16,6 +16,10 @@ EMIT_FILE; CHECK_vcpu_set_periodic_timer; #undef xen_vcpu_set_periodic_timer +#define xen_vcpu_set_singleshot_timer vcpu_set_singleshot_timer +CHECK_vcpu_set_singleshot_timer; +#undef xen_vcpu_set_singleshot_timer + #define xen_vcpu_info vcpu_info CHECK_SIZE_(struct, vcpu_info); #undef xen_vcpu_info @@ -97,6 +101,7 @@ int compat_common_vcpu_op(int cmd, struct vcpu *v, case VCPUOP_is_up: case VCPUOP_set_periodic_timer: case VCPUOP_stop_periodic_timer: + case VCPUOP_set_singleshot_timer: case VCPUOP_stop_singleshot_timer: case VCPUOP_register_vcpu_info: rc = common_vcpu_op(cmd, v, arg); @@ -116,19 +121,6 @@ int compat_common_vcpu_op(int cmd, struct vcpu *v, break; } - case VCPUOP_set_singleshot_timer: - { - struct compat_vcpu_set_singleshot_timer cmp; - struct vcpu_set_singleshot_timer *nat; - - if ( copy_from_guest(&cmp, arg, 1) ) - return -EFAULT; - nat = COMPAT_ARG_XLAT_VIRT_BASE; - XLAT_vcpu_set_singleshot_timer(nat, &cmp); - rc = do_vcpu_op(cmd, vcpuid, guest_handle_from_ptr(nat, void)); - break; - } - default: rc = -ENOSYS; break; diff --git a/xen/common/domain.c b/xen/common/domain.c index 626debbae095..6a440590fe2a 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 81a3b3a7438c..6d86a661bd67 100644 --- a/xen/include/public/vcpu.h +++ b/xen/include/public/vcpu.h @@ -144,15 +144,17 @@ DEFINE_XEN_GUEST_HANDLE(vcpu_set_periodic_timer_t); #define VCPUOP_stop_singleshot_timer 9 /* arg == NULL */ struct vcpu_set_singleshot_timer { uint64_t timeout_abs_ns; /* Absolute system time value in nanoseconds. */ - uint32_t flags; /* VCPU_SSHOTTMR_??? */ +#if __XEN_INTERFACE_VERSION__ < 0x00040f00 + uint32_t flags; /* Ignored. */ +#endif }; 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). */ -#define _VCPU_SSHOTTMR_future (0) -#define VCPU_SSHOTTMR_future (1U << _VCPU_SSHOTTMR_future) +#if __XEN_INTERFACE_VERSION__ < 0x00040f00 +/* Ignored. */ +#define VCPU_SSHOTTMR_future 1 +#endif /* * Register a memory location in the guest address space for the diff --git a/xen/include/public/xen-compat.h b/xen/include/public/xen-compat.h index 97fe6984989a..dc43cc9567c0 100644 --- a/xen/include/public/xen-compat.h +++ b/xen/include/public/xen-compat.h @@ -10,7 +10,7 @@ #ifndef __XEN_PUBLIC_XEN_COMPAT_H__ #define __XEN_PUBLIC_XEN_COMPAT_H__ -#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040e00 +#define __XEN_LATEST_INTERFACE_VERSION__ 0x00040f00 #if defined(__XEN__) || defined(__XEN_TOOLS__) /* Xen is built with matching headers and implements the latest interface. */ diff --git a/xen/include/xlat.lst b/xen/include/xlat.lst index d601a8a98421..5463961ce26b 100644 --- a/xen/include/xlat.lst +++ b/xen/include/xlat.lst @@ -168,7 +168,7 @@ ? vcpu_register_vcpu_info vcpu.h ! vcpu_runstate_info vcpu.h ? vcpu_set_periodic_timer vcpu.h -! vcpu_set_singleshot_timer vcpu.h +? vcpu_set_singleshot_timer vcpu.h ? build_id version.h ? compile_info version.h ? feature_info version.h -- 2.40.0
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |