[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH RFC 05/10] x86: update GADDR based secondary time area


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 19 Oct 2022 09:41:38 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=4zbAeKGcLxlIY49axvUp6udDpWdFPLm3sDwSLxopW8A=; b=A7ir7CVPeBLLXLvaABUrjhDN5NppLgRmy2MP+ymQTgGQ4KJeR2IguxDd3tsquTgxJT0ibpygEsLKWSsTAkU81hUNy5npQS8VZ+3VeAra4dR68X8G7KXkAaOOvhebCUPQi6eaPKW6Xk93zUU3faOeXOIKMgFgaM8cXME5WMuoXZq4AICDmevfpGTFOX4BAHvlGEAcl+VjiMlIymo9vLvec3Jh0Nt9DqpU/OZCBrlbCl8ukLn+eZRAqK37T+gh9UuepF/YPUcxVi4EiP6CBVHg1xfwBhX/RDrgdMdENmyQ8v9TmiTeWvkBhCpGTwKk+hwwDBYXGjK5vWo8W2IkYPasUg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=M3o+6L9+WDc1yJ+tJBF/w+Yu8Ob5PCY/kqxIHbXRAuv/1R+mdKhYoZ6M/12+9tMgHPWwmpCoYWa0jfZ6X54hofU4ekEfngGv0CiXYcN9LltNpkRPAv4ApY/cZD+AKJaI9q5zduK3550dPd7igUVXcf9ZTNAgUeC9VFpgg4NGord9soP6P280Wf97bRBWS9IKqzxuW+fTUnwIhAYSXZJx8gzRY6sKROvVMHxsuDj1snxmaamayFHtWcMYSw8jcd/oNKsCUAuAKWhI2XbB0vtkg4NnCalIDXVRJaHadv8JFpN8IgPxhDSw+0N0Ny7zwDiUJUwmRM608rFgV/8FrotUcg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Wed, 19 Oct 2022 07:41:43 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Before adding a new vCPU operation to register the secondary time area
by guest-physical address, add code to actually keep such areas up-to-
date.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
RFC: Pages aren't marked dirty when written to (matching the handling of
     space mapped by map_vcpu_info() afaict), on the basis that the
     registrations are lost anyway across migration. Plus the contents
     of the areas in question have to be deemed volatile in the first
     place (so saving a "most recent" value is pretty meaningless even
     for e.g. snapshotting).

--- 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);
+    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;
 




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.