Commit 977b7876 authored by Rishabh Bhatnagar's avatar Rishabh Bhatnagar Committed by sanglipeng
Browse files

KVM: x86: Ensure PV TLB flush tracepoint reflects KVM behavior

stable inclusion
from stable-v5.10.180
commit 4b19cbdb1dd39874fc530250c588041609bdc11d
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I8FC2O

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=4b19cbdb1dd39874fc530250c588041609bdc11d



--------------------------------

From: Lai Jiangshan <laijs@linux.alibaba.com>

commit af3511ff upstream.

In record_steal_time(), st->preempted is read twice, and
trace_kvm_pv_tlb_flush() might output result inconsistent if
kvm_vcpu_flush_tlb_guest() see a different st->preempted later.

It is a very trivial problem and hardly has actual harm and can be
avoided by reseting and reading st->preempted in atomic way via xchg().

Signed-off-by: default avatarLai Jiangshan <laijs@linux.alibaba.com>

Message-Id: <20210531174628.10265-1-jiangshanlai@gmail.com>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: default avatarRishabh Bhatnagar <risbhat@amazon.com>
Tested-by: default avatarAllen Pais <apais@linux.microsoft.com>
Acked-by: default avatarSean Christopherson <seanjc@google.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarsanglipeng <sanglipeng1@jd.com>
parent 0b45b068
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment