x86, perf: Avoid context switching LBR_INFO when not needed

We context switch LBRs in call stack mode. Currently LBR_INFO
was also context switched, but we normally don't need that
in call stack mode.

Make the context switch check the NO_CYCLES|NO_FLAGS event
flags that were earlier added, and if set avoid writing
the LBR_INFO MSRs unnecessarily.

The same is done for the LBR reset code.

v2:
Use true instead of one
Signed-off-by: Andi Kleen <ak@linux.intel.com>
3 files changed