parlib: Fix u32/u64 issue with pvcalarm
authorBarret Rhoden <brho@cs.berkeley.edu>
Fri, 14 Dec 2018 22:01:30 +0000 (17:01 -0500)
committerBarret Rhoden <brho@cs.berkeley.edu>
Fri, 14 Dec 2018 22:23:48 +0000 (17:23 -0500)
vcore_account_uptime_ticks() returns a u64.  By making it a u32, we'll
eventually make diff 'negative'/'very large' once a vcore's uptime
passes 32 bits, which would break things.

This never popped up, but I noticed it while hunting down other
alarm/time bugs.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
user/parlib/pvcalarm.c

index 95f9fdc..698adc3 100644 (file)
@@ -264,7 +264,7 @@ static void handle_alarm_prof(struct event_msg *ev_msg, unsigned int ev_type,
 {
        int vcoreid = vcore_id();
        struct pvcalarm_data *pvcalarm_data = &global_pvcalarm.data[vcoreid];
-       uint32_t uptime = vcore_account_uptime_ticks(vcoreid);
+       uint64_t uptime = vcore_account_uptime_ticks(vcoreid);
        uint64_t diff = uptime - pvcalarm_data->start_uptime;
 
        if (diff < global_pvcalarm.interval) {