diff options
author | Like Xu <like.xu@linux.intel.com> | 2020-06-13 16:09:50 +0800 |
---|---|---|
committer | Peter Zijlstra <peterz@infradead.org> | 2020-07-02 15:51:46 +0200 |
commit | e1ad1ac2deb8f90af9f12ff316989dd5675dec11 (patch) | |
tree | 2fbd4a7c4fb774817085ead410f94e5e59ed84a9 /kernel/sched/idle.c | |
parent | 097e4311cda952dfb047f2a49d35aa5de500d474 (diff) |
perf/x86: Keep LBR records unchanged in host context for guest usage
When a guest wants to use the LBR registers, its hypervisor creates a guest
LBR event and let host perf schedules it. The LBR records msrs are
accessible to the guest when its guest LBR event is scheduled on
by the perf subsystem.
Before scheduling this event out, we should avoid host changes on
IA32_DEBUGCTLMSR or LBR_SELECT. Otherwise, some unexpected branch
operations may interfere with guest behavior, pollute LBR records, and even
cause host branches leakage. In addition, the read operation
on host is also avoidable.
To ensure that guest LBR records are not lost during the context switch,
the guest LBR event would enable the callstack mode which could
save/restore guest unread LBR records with the help of
intel_pmu_lbr_sched_task() naturally.
However, the guest LBR_SELECT may changes for its own use and the host
LBR event doesn't save/restore it. To ensure that we doesn't lost the guest
LBR_SELECT value when the guest LBR event is running, the vlbr_constraint
is bound up with a new constraint flag PERF_X86_EVENT_LBR_SELECT.
Signed-off-by: Like Xu <like.xu@linux.intel.com>
Signed-off-by: Wei Wang <wei.w.wang@intel.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/20200514083054.62538-6-like.xu@linux.intel.com
Diffstat (limited to 'kernel/sched/idle.c')
0 files changed, 0 insertions, 0 deletions