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

Re: [PATCH v2 06/39] xen/riscv: use UINT64_MAX to disable the VS-timer





On 9/1/26 9:12 AM, Jan Beulich wrote:
On 27.08.2026 17:20, Oleksii Kurochko wrote:
vstimecmp is a 64-bit CSR independently of XLEN, which is why it is
written with csr_write64(). On RV32 that macro splits the value into
the vstimecmp/vstimecmph pair, so passing ULONG_MAX (0xffffffff there)
writes all ones to the low half and zero to the high half, leaving the
CSR at 0x00000000ffffffff rather than at its maximum. A VS-timer irq
would then become pending as soon as (time + htimedelta) reaches 2^32,
which is exactly what the code is trying to avoid.

Use UINT64_MAX, which matches the width of the CSR. On RV64 it is equal
to ULONG_MAX, so no functional change there.

Hmm. This again is an example where code (likely) will be silently wrong
for RV128. Presumably the CSR would be XLEN bits wide there as well, and
hence you'd need to write it with 128 bits of ones. Imo ~0 is what wants
using here.

Agree, it makes would be better to have ~0 here. I will apply that.

Thanks.

~ Oleksii



 


Rackspace

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