|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v2 5/8] x86/xen/time: Clear xen_clock mapping later
The current logic has a corner case when both xen_save_time_memory_area()
and xen_restore_time_memory_area() fails. In this case, the mapping is never
cleared and kept with previous pvclock values (invalidating the comment
regarding VDSO_CLOCKMODE_PVCLOCK as the data may not have been zeroed).
Also convert the clear_page with a memset, there's no need to clear the
entire page when we only care about 64 bytes of it.
Fixes: 2229f70b5bbb ("x86/xen/time: setup vcpu 0 time info page")
Signed-off-by: Teddy Astie <teddy.astie@xxxxxxxxxx>
---
CC: Juergen Gross <jgross@xxxxxxxx>
CC: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: Oleksandr Tyshchenko <oleksandr_tyshchenko@xxxxxxxx>
CC: David Woodhouse <dwmw2@xxxxxxxxxxxxx>
CC: x86@xxxxxxxxxx
CC: linux-kernel@xxxxxxxxxxxxxxx
arch/x86/xen/time.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 2656b3a08553..87b890691fcb 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -407,9 +407,7 @@ void xen_save_time_memory_area(void)
ret = HYPERVISOR_vcpu_op(VCPUOP_register_vcpu_time_memory_area, 0, &t);
if (ret != 0)
- pr_notice("Cannot unregister vcpu_time_info (err %d)\n", ret);
- else
- clear_page(xen_clock);
+ pr_notice("Cannot unregister vcpu_time_info (err %d)", ret);
}
void xen_restore_time_memory_area(void)
@@ -420,6 +418,7 @@ void xen_restore_time_memory_area(void)
if (!xen_clock)
goto out;
+ memset(xen_clock, 0, sizeof(*xen_clock));
t.addr.v = &xen_clock->pvti;
ret = HYPERVISOR_vcpu_op(VCPUOP_register_vcpu_time_memory_area, 0, &t);
--
2.56.0
--
Teddy Astie | Vates XCP-ng Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |