On 19/10/2022 8:41 am, Jan Beulich wrote:
> --- a/xen/arch/x86/time.c
> +++ b/xen/arch/x86/time.c
> @@ -1462,12 +1462,34 @@ static void __update_vcpu_system_time(st
>          v->arch.pv.pending_system_time = _u;
>  }
>  
> +static void write_time_guest_area(struct vcpu_time_info *map,
> +                                  const struct vcpu_time_info *src)
> +{
> +    /* 1. Update userspace version. */
> +    write_atomic(&map->version, src->version);

version_update_begin()

~Andrew

> +    smp_wmb();
> +
> +    /* 2. Update all other userspace fields. */
> +    *map = *src;
> +
> +    /* 3. Update userspace version again. */
> +    smp_wmb();
> +    write_atomic(&map->version, version_update_end(src->version));
> +}
> +
>  bool update_secondary_system_time(struct vcpu *v,
>                                    struct vcpu_time_info *u)
>  {
>      XEN_GUEST_HANDLE(vcpu_time_info_t) user_u = v->arch.time_info_guest;
> +    struct vcpu_time_info *map = v->arch.time_guest_area.map;
>      struct guest_memory_policy policy = { .nested_guest_mode = false };
>  
> +    if ( map )
> +    {
> +        write_time_guest_area(map, u);
> +        return true;
> +    }
> +
>      if ( guest_handle_is_null(user_u) )
>          return true;
>  
>

Reply via email to