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

[PATCH xen 2/2] xen: update system time immediately when VCPUOP_register_vcpu_info


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: Dongli Zhang <dongli.zhang@xxxxxxxxxx>
  • Date: Tue, 12 Oct 2021 00:24:28 -0700
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.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=uUBzOadnaIwwsYIV3T/XKD51rUxNsmjfESD7O5siaBc=; b=Kz7hh2LYjUxOZ5hRHw3nxLx9PKPqMtRfUx15eTktxVOwTyPxtSEyYzLtIRdRSvKqzXTnepmF3iayrSVY0lxFgPwjclxKSZLOmzh3ax/nlVzhE+Cr0Kpjy8Sbybea8Disq4TkRhF7eUv+B9cs2ZSE6/CqN508KyYGRxzDIoW9Y7H2HNMglpb1PIomJQpuOFI6IA39ZHDQroxW9kE9WoaS3IyliWbbiSiNNvVLJPvsylBXlERlXfyWWPnt1EpdLWq8QZYfcGQHBynAVhT9MzFG0fuZRFdRuQPYhbjYSrb4QxjsPgwtqGbGPpuQbAe/VgaS1a1F5y/4I+TDHL/zobK6bg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f/vO2Cu4mEpfsfrD+0+lk+EdvxgZWNfodU5k8p9xOuWSmRdpvDEHIsAC54RPE1IoMiHk1wRxH2B+MM9rK0ON0v1Wam/erHjgZtvK/qe4WnOf1tZ6iagP0wJ5SR9Vg9YRiVRCbROGwhS1J1CpZ1VHqzOyReX7HrDswkRYFd0GdYwFd8II/e2uWuVrr+UGo/CjZZw8AxEwPGPVORYQ+c0R/pfh/81IXuxJmwmXcDvcz0vzSQnfWPlY7NrRHMHIelMKLmxfjjCAguio9kuHDWNIL1sQOrqdHEhxcwasLrnz47J769KSvXBE1c40q6/X10Po+M6HtZxGO8gCPUHNCK7fFw==
  • Authentication-results: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=oracle.com;
  • Cc: linux-kernel@xxxxxxxxxxxxxxx, x86@xxxxxxxxxx, boris.ostrovsky@xxxxxxxxxx, jgross@xxxxxxxx, sstabellini@xxxxxxxxxx, tglx@xxxxxxxxxxxxx, mingo@xxxxxxxxxx, bp@xxxxxxxxx, hpa@xxxxxxxxx, andrew.cooper3@xxxxxxxxxx, george.dunlap@xxxxxxxxxx, iwj@xxxxxxxxxxxxxx, jbeulich@xxxxxxxx, julien@xxxxxxx, wl@xxxxxxx, joe.jin@xxxxxxxxxx
  • Delivery-date: Tue, 12 Oct 2021 07:25:12 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

The guest may access the pv vcpu_time_info immediately after
VCPUOP_register_vcpu_info. This is to borrow the idea of
VCPUOP_register_vcpu_time_memory_area, where the
force_update_vcpu_system_time() is called immediately when the new memory
area is registered.

Otherwise, we may observe clock drift at the VM side if the VM accesses
the clocksource immediately after VCPUOP_register_vcpu_info().

Cc: Joe Jin <joe.jin@xxxxxxxxxx>
Signed-off-by: Dongli Zhang <dongli.zhang@xxxxxxxxxx>
---
 xen/common/domain.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 40d67ec342..c879f6723b 100644
--- a/xen/common/domain.c
+++ b/xen/common/domain.c
@@ -1695,6 +1695,8 @@ long do_vcpu_op(int cmd, unsigned int vcpuid, 
XEN_GUEST_HANDLE_PARAM(void) arg)
         rc = map_vcpu_info(v, info.mfn, info.offset);
         domain_unlock(d);
 
+        force_update_vcpu_system_time(v);
+
         break;
     }
 
-- 
2.17.1




 


Rackspace

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