WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] Allow guest to register a secondary vcpu_time_in

To: "Jeremy Fitzhardinge" <jeremy@xxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Allow guest to register a secondary vcpu_time_info structure
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Tue, 06 Oct 2009 10:26:08 +0100
Cc: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>, Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Delivery-date: Tue, 06 Oct 2009 02:27:15 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <4ACA8AE6.3000602@xxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <4ACA8AE6.3000602@xxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
>>> Jeremy Fitzhardinge <jeremy@xxxxxxxx> 06.10.09 02:10 >>>
>-void update_vcpu_system_time(struct vcpu *v)
>+static void update_guest_time_info(struct vcpu *v, struct vcpu_time_info *u)
>+{
>+    struct vcpu_time_info info;
>+    u32 version;
>+
>+    if ( guest_handle_is_null(v->time_info_guest) )
>+        return;
>+
>+    if ( __copy_from_guest(&info, v->time_info_guest, 1) )
>+        return;

I'd suggest using __copy_field_from_guest() here to get just the
version member, after copying *u into info.

>+
>+    /*
>+     * Update the guest copy of the time info.  We need to make sure
>+     * we update the guest's version of the version number rather than
>+     * use a verbtim copy of the master one, because the guest may
>+     * update the version for its own purposes.
>+     */
>+    version = info.version;
>+    info = *u;
>+    info.version = (version + 2) & ~1;
>+
>+    __copy_to_guest(v->time_info_guest, &info, 1);
>+}

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel