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

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


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 3 May 2023 17:55:52 +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=Tj6boY6MQ0Ajhx1lKmKqTBrZzfbIB+gH7SjBjs88Cgs=; b=WOmbBwvy6yvVcm4/sRFEytdm/A7nloW60M0F43SDphMcYYxgBT214ndozt8RGtpoqQPD7QCOfHTQJrGGhN03C8JJUFULnK06hHKMgevfMb/frnlf0q5aY4k4smaRnz3ca8Ls9FY9c1q0PgHH2GiPsPGlfT5V7b2HB5GzzH/7BqVrtG1RECjwcr97KSpdfYd/qW5tYwSQkt8VWo/hai6mnjPS/GcPtaguMBkgP7GWkjUGpSTVh9V0NPLYD0FLO5DScuHC0B4rLxTUPkMVjjV7kfVD4LO+9cKtptauRDGkYiuvYDNxaY3SdOlS0CkVoUJujN+2VNpgTRaSJGdoio6PKA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=inLmMtkj/mKxcjN81kgyPe/lnB/4VWpaGW50iS+vg88WDPZBlDV/ycy8N1GP97TGe3ZG82g/HYehDp5IbofzsKhgZcaFKPJH1/n9qnk8U8KGD+/1HJUJrowrjvPG30kgbRDi38rjV6HibvL6mFw3TciDbvmayb/aTpjF1lYhh646qt1ahcGVtS5X7FrwoZphGYAgkXGhagwQSKP8fKA8sl50nV7sR70u/j6EwifIqq41eOoesaWd74SO5YXDWBo3Rg59q65dxqU8JSh4M71os02P/97Ic0hkMV45tVEEfaSoV927OXyyiC/EVqemn+j4YLRY4uWusLw91S9DGcwRmA==
  • 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, 03 May 2023 15:55:58 +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
@@ -1571,12 +1571,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®.