On 30/06/2022 06:20, Jiamei Xie wrote:
Hi,
Hi Jiamei,
-----Original Message-----
From: Jiamei Xie <[email protected]>
Sent: 2022年6月30日 9:54
To: [email protected]
Cc: Jiamei Xie <[email protected]>; Stefano Stabellini
<[email protected]>; Julien Grall <[email protected]>; Bertrand Marquis
<[email protected]>; Volodymyr Babchuk
<[email protected]>; Wei Chen <[email protected]>
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 <[email protected]>
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