All of lore.kernel.org
 help / color / mirror / Atom feed
* [MODERATED] [PATCH v2 0/8] PERFv2
@ 2019-02-06  1:23 Andi Kleen
  2019-02-06  1:23 ` [MODERATED] [PATCH v2 1/8] PERFv2 Andi Kleen
                   ` (9 more replies)
  0 siblings, 10 replies; 31+ messages in thread
From: Andi Kleen @ 2019-02-06  1:23 UTC (permalink / raw)
  To: speck; +Cc: Andi Kleen

Walnut is an functional (not security) issue with TSX. The upcoming
microcode updates on Skylake may corrupt perfmon counter 3
when RTM transactions are used.

There is a new MSR that allows to force abort RTM, and free
counter 3.

The following patchkit adds the support to perf to avoid
using counter 3, or disabling TSX when counter 3 is needed
for perf.

There are per perf event and global options to set the
default.

This patch sets the default to TSX enabled, but
that could be easily changed.

We can have a discussion on the trade offs of the default
setting. I suspect it's a decision that should be made by Linus,
as it may impact user programs either way.

The trade offs for setting the option default are:
    
Using 4 (or 8 with HT off) events in perf versus
allowing RTM usage while perf is active.
    
- Existing programs that use perf groups with 4 counters
  may not retrieve perfmon data anymore. Perf usages
  that use less than four (or 7 with HT off) counters
  are not impacted. Perf usages that don't use group
  will still work, but will see increase multiplexing.
    
- TSX programs should not functionally break from
  forcing RTM to abort because they always need a valid
  fall back path. However they will see significantly
  lower performance if they rely on TSX for performance
  (all RTM transactions will run and only abort at the end),
  potentially slowing them down so much that it is
  equivalent to functional breakage.

Patches are against tip/perf/core as of 
commit ca3bb3d027f69ac3ab1dafb32bde2f5a3a44439c (tip/perf/core)
Author: Elena Reshetova <elena.reshetova@intel.com>

-Andi

v1: Initial post

v2: Minor updates in code (see individual patches)
Removed optimization to not change MSR for update. This caused missing
MSR updates in some cases. 
Redid KVM code to always intercept MSR and pass correct flag
to host perf.

Andi Kleen (8):
  x86/pmu/intel: Export number of counters in caps
  x86/pmu/intel: Support excluding GP counters in scheduler
  x86/pmu/intel: Handle TSX with counter 3 on Skylake
  x86/pmu/intel: Add perf event attribute to enable counter 3
  x86/pmu/intel: Add global option for enable all counters
  perf stat: Make all existing groups weak
  perf stat: Don't count EL for --transaction with three counters
  kvm: vmx: Support TSX_FORCE_ABORT in KVM guests

 arch/x86/events/core.c             | 50 ++++++++++++++++++---
 arch/x86/events/intel/core.c       | 72 ++++++++++++++++++++++++++++++
 arch/x86/events/intel/uncore.c     |  2 +-
 arch/x86/events/perf_event.h       | 15 ++++++-
 arch/x86/include/asm/cpufeatures.h |  1 +
 arch/x86/include/asm/kvm_host.h    |  1 +
 arch/x86/include/asm/msr-index.h   |  3 ++
 arch/x86/kvm/cpuid.c               |  3 +-
 arch/x86/kvm/pmu.c                 | 19 +++++---
 arch/x86/kvm/pmu.h                 |  6 ++-
 arch/x86/kvm/pmu_amd.c             |  2 +-
 arch/x86/kvm/vmx/pmu_intel.c       | 16 ++++++-
 include/linux/perf_event.h         |  1 +
 tools/perf/builtin-stat.c          | 38 +++++++++++-----
 tools/perf/util/pmu.c              | 10 +++++
 tools/perf/util/pmu.h              |  1 +
 16 files changed, 206 insertions(+), 34 deletions(-)

-- 
2.17.2

^ permalink raw reply	[flat|nested] 31+ messages in thread

end of thread, other threads:[~2019-02-07 23:12 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-06  1:23 [MODERATED] [PATCH v2 0/8] PERFv2 Andi Kleen
2019-02-06  1:23 ` [MODERATED] [PATCH v2 1/8] PERFv2 Andi Kleen
2019-02-07 23:11   ` [MODERATED] " Konrad Rzeszutek Wilk
2019-02-06  1:23 ` [MODERATED] [PATCH v2 2/8] PERFv2 Andi Kleen
2019-02-06  1:23 ` [MODERATED] [PATCH v2 3/8] PERFv2 Andi Kleen
2019-02-06 19:07   ` [MODERATED] " Andi Kleen
2019-02-06  1:23 ` [MODERATED] [PATCH v2 4/8] PERFv2 Andi Kleen
2019-02-06  3:55   ` [MODERATED] " Andi Kleen
2019-02-06  1:23 ` [MODERATED] [PATCH v2 5/8] PERFv2 Andi Kleen
2019-02-06  1:24 ` [MODERATED] [PATCH v2 6/8] PERFv2 Andi Kleen
2019-02-06  1:24 ` [MODERATED] [PATCH v2 7/8] PERFv2 Andi Kleen
2019-02-06  1:24 ` [MODERATED] [PATCH v2 8/8] PERFv2 Andi Kleen
2019-02-06 19:10 ` [MODERATED] Re: [PATCH v2 0/8] PERFv2 Andi Kleen
2019-02-07 13:27 ` Peter Zijlstra
2019-02-07 13:33   ` Peter Zijlstra
2019-02-07 13:48     ` Peter Zijlstra
2019-02-07 14:39     ` Andi Kleen
2019-02-07 14:37   ` Andi Kleen
2019-02-07 15:33     ` Peter Zijlstra
2019-02-07 15:51       ` Andrew Cooper
2019-02-07 16:35       ` Andi Kleen
2019-02-07 15:37     ` Peter Zijlstra
2019-02-07 16:20       ` Andi Kleen
2019-02-07 16:49         ` Peter Zijlstra
2019-02-07 21:55           ` Andi Kleen
2019-02-07 16:35       ` Andrew Cooper
2019-02-07 17:00         ` Peter Zijlstra
2019-02-07 17:55           ` Andrew Cooper
2019-02-07 22:04           ` Andi Kleen
2019-02-07 22:45             ` Andrew Cooper
2019-02-07 16:01     ` Peter Zijlstra

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.