On 30/06/2022 06:20, Jiamei Xie wrote:
Hi,
Hi Jiamei,
-----Original Message-----
From: Jiamei Xie <jiamei....@arm.com>
Sent: 2022年6月30日 9:54
To: xen-devel@lists.xenproject.org
Cc: Jiamei Xie <jiamei....@arm.com>; Stefano Stabellini
<sstabell...@kernel.org>; Julien Grall <jul...@xen.org>; Bertrand Marquis
<bertrand.marq...@arm.com>; Volodymyr Babchuk
<volodymyr_babc...@epam.com>; Wei Chen <wei.c...@arm.com>
Subject: [PATCH v3] xen/arm: avoid overflow when setting vtimer in context
switch
virt_vtimer_save is calculating the new time for the vtimer in:
"v->arch.virt_timer.cval + v->domain->arch.virt_timer_base.offset
- boot_count".
In this formula, "cval + offset" might cause uint64_t overflow.
Changing it to "ticks_to_ns(v->domain->arch.virt_timer_base.offset -
boot_count) + ticks_to_ns(v->arch.virt_timer.cval)" can avoid overflow,
and "ticks_to_ns(arch.virt_timer_base.offset - boot_count)" will be
always the same, which has been caculated in domain_vtimer_init.
Introduce a new field virt_timer_base.nanoseconds to store this value
for arm in struct arch_domain, so we can use it directly.
Signed-off-by: Jiamei Xie <jiamei....@arm.com>
Change-Id: Ib80cee51eaf844661e6f92154a0339ad2a652f9b
I am sorry I forget to remove the Change-Id.
No worries. This can be dropped on commit (if no other changes are
requested).
Cheers,
--
Julien Grall