• Paul Mackerras's avatar
    KVM: PPC: Book3S HV: Fix decrementer timeouts with non-zero TB offset · c5fb80d3
    Paul Mackerras authored
    Commit c7699822bc21 ("KVM: PPC: Book3S HV: Make physical thread 0 do
    the MMU switching") reordered the guest entry/exit code so that most
    of the guest register save/restore code happened in guest MMU context.
    A side effect of that is that the timebase still contains the guest
    timebase value at the point where we compute and use vcpu->arch.dec_expires,
    and therefore that is now a guest timebase value rather than a host
    timebase value.  That in turn means that the timeouts computed in
    kvmppc_set_timer() are wrong if the timebase offset for the guest is
    non-zero.  The consequence of that is things such as "sleep 1" in a
    guest after migration may sleep for much longer than they should.
    
    This fixes the problem by converting between guest and host timebase
    values as necessary, by adding or subtracting the timebase offset.
    This also fixes an incorrect comment.
    Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
    Acked-by: default avatarScott Wood <scottwood@freescale.com>
    c5fb80d3
book3s_hv_rmhandlers.S 53.4 KB