diff options
| -rw-r--r-- | arch/x86/kvm/pmu.c | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/arch/x86/kvm/pmu.c b/arch/x86/kvm/pmu.c index 06ce377dcbc9..026db42a86c3 100644 --- a/arch/x86/kvm/pmu.c +++ b/arch/x86/kvm/pmu.c | |||
| @@ -113,12 +113,19 @@ static void pmc_reprogram_counter(struct kvm_pmc *pmc, u32 type, | |||
| 113 | .config = config, | 113 | .config = config, |
| 114 | }; | 114 | }; |
| 115 | 115 | ||
| 116 | attr.sample_period = (-pmc->counter) & pmc_bitmask(pmc); | ||
| 117 | |||
| 116 | if (in_tx) | 118 | if (in_tx) |
| 117 | attr.config |= HSW_IN_TX; | 119 | attr.config |= HSW_IN_TX; |
| 118 | if (in_tx_cp) | 120 | if (in_tx_cp) { |
| 121 | /* | ||
| 122 | * HSW_IN_TX_CHECKPOINTED is not supported with nonzero | ||
| 123 | * period. Just clear the sample period so at least | ||
| 124 | * allocating the counter doesn't fail. | ||
| 125 | */ | ||
| 126 | attr.sample_period = 0; | ||
| 119 | attr.config |= HSW_IN_TX_CHECKPOINTED; | 127 | attr.config |= HSW_IN_TX_CHECKPOINTED; |
| 120 | 128 | } | |
| 121 | attr.sample_period = (-pmc->counter) & pmc_bitmask(pmc); | ||
| 122 | 129 | ||
| 123 | event = perf_event_create_kernel_counter(&attr, -1, current, | 130 | event = perf_event_create_kernel_counter(&attr, -1, current, |
| 124 | intr ? kvm_perf_overflow_intr : | 131 | intr ? kvm_perf_overflow_intr : |
