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

[PATCH v2 3/8] x86: update GADDR based secondary time area


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 23 Jan 2023 15:54:19 +0100
  • 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=uB3131ouV1w0eF2ri7Zz76fAeueaRAbvh0LQL2AdBT4=; b=L3p/eGSB/cmTKCJy5bq6b7dh2QZsx61UT6SsbOqanbWCrdH9DoMo0ADL13SCu+NwlGlJJ/PHqxliyUlgRk16/3PJuDbChU5jI/EV5EFV3ktYKPahM6YaD1YqgsaXGYIFuIv0rfy3sqG2O1V0hm/laSCz6Y295kDxIEz5G+dCsOu8nmtavjsxxukFkeHMe8zOrFZWA4fNG8iUUdt5hGApmsSMiDgLoC+tRi9OsOt4YfxVRTEJ7ZJxQB6ZDyXzTgnd3LJqJaqSS/p1EwH325ASNgit7pIKudu/100xxVmpykkO8qaQBEFbL2GnxWW2FxEjXC2cnMyjd0MH/xgzrL1W4g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZKjw0lQj7/r6HOS2+9hXSwapljUiThwRDoha6a0Hy4UL5LHsxftjNusUdOObOJ+7wscsoKRk3w+OYptXaryGHbwkfJTyjtDmUqKzSid+2rlDhV/TVInyj7dJ4Lwo9jCbM9rANysDcRr/bdzryVWAQxp1G9C8LGon6FywCY5fMdRrbIht0+yyXIHgsbUUvIUW594IelZPnol5fUuaLnm613UFg3Jg2nW0l93QCiMLkrbQoysuCeBiDG11dxI6zjxUEQ4BzJAGNOHSA1NpT2VY7qNuPAk6r01yN4x0exUA0rtClBdF3zO/lTuG2dVziGRDtZNvkbhJCAx5jS1yUDtdbQ==
  • 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>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 23 Jan 2023 14:54:26 +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.

Note that pages aren't marked dirty when written to (matching the
handling of space mapped by map_vcpu_info()), on the basis that the
registrations are lost anyway across migration (or would need re-
populating at the target for transparent 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).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>

--- 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®.