Skip to content

Commit 9b82f05

Browse files
committed
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf updates from Ingo Molnar: "The main changes in this cycle were: Kernel side changes: - A couple of x86/cpu cleanups and changes were grandfathered in due to patch dependencies. These clean up the set of CPU model/family matching macros with a consistent namespace and C99 initializer style. - A bunch of updates to various low level PMU drivers: * AMD Family 19h L3 uncore PMU * Intel Tiger Lake uncore support * misc fixes to LBR TOS sampling - optprobe fixes - perf/cgroup: optimize cgroup event sched-in processing - misc cleanups and fixes Tooling side changes are to: - perf {annotate,expr,record,report,stat,test} - perl scripting - libapi, libperf and libtraceevent - vendor events on Intel and S390, ARM cs-etm - Intel PT updates - Documentation changes and updates to core facilities - misc cleanups, fixes and other enhancements" * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (89 commits) cpufreq/intel_pstate: Fix wrong macro conversion x86/cpu: Cleanup the now unused CPU match macros hwrng: via_rng: Convert to new X86 CPU match macros crypto: Convert to new CPU match macros ASoC: Intel: Convert to new X86 CPU match macros powercap/intel_rapl: Convert to new X86 CPU match macros PCI: intel-mid: Convert to new X86 CPU match macros mmc: sdhci-acpi: Convert to new X86 CPU match macros intel_idle: Convert to new X86 CPU match macros extcon: axp288: Convert to new X86 CPU match macros thermal: Convert to new X86 CPU match macros hwmon: Convert to new X86 CPU match macros platform/x86: Convert to new CPU match macros EDAC: Convert to new X86 CPU match macros cpufreq: Convert to new X86 CPU match macros ACPI: Convert to new X86 CPU match macros x86/platform: Convert to new CPU match macros x86/kernel: Convert to new CPU match macros x86/kvm: Convert to new CPU match macros x86/perf/events: Convert to new CPU match macros ...
2 parents 4b9fd8a + 629b3df commit 9b82f05

File tree

161 files changed

+3532
-2098
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

161 files changed

+3532
-2098
lines changed

arch/powerpc/perf/core-book3s.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ static void power_pmu_bhrb_read(struct perf_event *event, struct cpu_hw_events *
518518
}
519519
}
520520
cpuhw->bhrb_stack.nr = u_index;
521+
cpuhw->bhrb_stack.hw_idx = -1ULL;
521522
return;
522523
}
523524

arch/x86/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1875,7 +1875,6 @@ config X86_SMAP
18751875

18761876
config X86_UMIP
18771877
def_bool y
1878-
depends on CPU_SUP_INTEL || CPU_SUP_AMD
18791878
prompt "User Mode Instruction Prevention" if EXPERT
18801879
---help---
18811880
User Mode Instruction Prevention (UMIP) is a security feature in

arch/x86/crypto/aesni-intel_glue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ static struct aead_alg aesni_aeads[0];
10641064
static struct simd_aead_alg *aesni_simd_aeads[ARRAY_SIZE(aesni_aeads)];
10651065

10661066
static const struct x86_cpu_id aesni_cpu_id[] = {
1067-
X86_FEATURE_MATCH(X86_FEATURE_AES),
1067+
X86_MATCH_FEATURE(X86_FEATURE_AES, NULL),
10681068
{}
10691069
};
10701070
MODULE_DEVICE_TABLE(x86cpu, aesni_cpu_id);

arch/x86/crypto/crc32-pclmul_glue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ static struct shash_alg alg = {
170170
};
171171

172172
static const struct x86_cpu_id crc32pclmul_cpu_id[] = {
173-
X86_FEATURE_MATCH(X86_FEATURE_PCLMULQDQ),
173+
X86_MATCH_FEATURE(X86_FEATURE_PCLMULQDQ, NULL),
174174
{}
175175
};
176176
MODULE_DEVICE_TABLE(x86cpu, crc32pclmul_cpu_id);

arch/x86/crypto/crc32c-intel_glue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ static struct shash_alg alg = {
221221
};
222222

223223
static const struct x86_cpu_id crc32c_cpu_id[] = {
224-
X86_FEATURE_MATCH(X86_FEATURE_XMM4_2),
224+
X86_MATCH_FEATURE(X86_FEATURE_XMM4_2, NULL),
225225
{}
226226
};
227227
MODULE_DEVICE_TABLE(x86cpu, crc32c_cpu_id);

arch/x86/crypto/crct10dif-pclmul_glue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ static struct shash_alg alg = {
114114
};
115115

116116
static const struct x86_cpu_id crct10dif_cpu_id[] = {
117-
X86_FEATURE_MATCH(X86_FEATURE_PCLMULQDQ),
117+
X86_MATCH_FEATURE(X86_FEATURE_PCLMULQDQ, NULL),
118118
{}
119119
};
120120
MODULE_DEVICE_TABLE(x86cpu, crct10dif_cpu_id);

arch/x86/crypto/ghash-clmulni-intel_glue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ static struct ahash_alg ghash_async_alg = {
313313
};
314314

315315
static const struct x86_cpu_id pcmul_cpu_id[] = {
316-
X86_FEATURE_MATCH(X86_FEATURE_PCLMULQDQ), /* Pickle-Mickle-Duck */
316+
X86_MATCH_FEATURE(X86_FEATURE_PCLMULQDQ, NULL), /* Pickle-Mickle-Duck */
317317
{}
318318
};
319319
MODULE_DEVICE_TABLE(x86cpu, pcmul_cpu_id);

arch/x86/events/amd/power.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ static int power_cpu_init(unsigned int cpu)
259259
}
260260

261261
static const struct x86_cpu_id cpu_match[] = {
262-
{ .vendor = X86_VENDOR_AMD, .family = 0x15 },
262+
X86_MATCH_VENDOR_FAM(AMD, 0x15, NULL),
263263
{},
264264
};
265265

arch/x86/events/amd/uncore.c

Lines changed: 31 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,31 @@ static void amd_uncore_del(struct perf_event *event, int flags)
180180
hwc->idx = -1;
181181
}
182182

183+
/*
184+
* Convert logical CPU number to L3 PMC Config ThreadMask format
185+
*/
186+
static u64 l3_thread_slice_mask(int cpu)
187+
{
188+
u64 thread_mask, core = topology_core_id(cpu);
189+
unsigned int shift, thread = 0;
190+
191+
if (topology_smt_supported() && !topology_is_primary_thread(cpu))
192+
thread = 1;
193+
194+
if (boot_cpu_data.x86 <= 0x18) {
195+
shift = AMD64_L3_THREAD_SHIFT + 2 * (core % 4) + thread;
196+
thread_mask = BIT_ULL(shift);
197+
198+
return AMD64_L3_SLICE_MASK | thread_mask;
199+
}
200+
201+
core = (core << AMD64_L3_COREID_SHIFT) & AMD64_L3_COREID_MASK;
202+
shift = AMD64_L3_THREAD_SHIFT + thread;
203+
thread_mask = BIT_ULL(shift);
204+
205+
return AMD64_L3_EN_ALL_SLICES | core | thread_mask;
206+
}
207+
183208
static int amd_uncore_event_init(struct perf_event *event)
184209
{
185210
struct amd_uncore *uncore;
@@ -203,18 +228,11 @@ static int amd_uncore_event_init(struct perf_event *event)
203228
return -EINVAL;
204229

205230
/*
206-
* SliceMask and ThreadMask need to be set for certain L3 events in
207-
* Family 17h. For other events, the two fields do not affect the count.
231+
* SliceMask and ThreadMask need to be set for certain L3 events.
232+
* For other events, the two fields do not affect the count.
208233
*/
209-
if (l3_mask && is_llc_event(event)) {
210-
int thread = 2 * (cpu_data(event->cpu).cpu_core_id % 4);
211-
212-
if (smp_num_siblings > 1)
213-
thread += cpu_data(event->cpu).apicid & 1;
214-
215-
hwc->config |= (1ULL << (AMD64_L3_THREAD_SHIFT + thread) &
216-
AMD64_L3_THREAD_MASK) | AMD64_L3_SLICE_MASK;
217-
}
234+
if (l3_mask && is_llc_event(event))
235+
hwc->config |= l3_thread_slice_mask(event->cpu);
218236

219237
uncore = event_to_amd_uncore(event);
220238
if (!uncore)
@@ -520,9 +538,9 @@ static int __init amd_uncore_init(void)
520538
if (!boot_cpu_has(X86_FEATURE_TOPOEXT))
521539
return -ENODEV;
522540

523-
if (boot_cpu_data.x86 == 0x17 || boot_cpu_data.x86 == 0x18) {
541+
if (boot_cpu_data.x86 >= 0x17) {
524542
/*
525-
* For F17h or F18h, the Northbridge counters are
543+
* For F17h and above, the Northbridge counters are
526544
* repurposed as Data Fabric counters. Also, L3
527545
* counters are supported too. The PMUs are exported
528546
* based on family as either L2 or L3 and NB or DF.

arch/x86/events/intel/core.c

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1945,6 +1945,14 @@ static __initconst const u64 knl_hw_cache_extra_regs
19451945
* intel_bts events don't coexist with intel PMU's BTS events because of
19461946
* x86_add_exclusive(x86_lbr_exclusive_lbr); there's no need to keep them
19471947
* disabled around intel PMU's event batching etc, only inside the PMI handler.
1948+
*
1949+
* Avoid PEBS_ENABLE MSR access in PMIs.
1950+
* The GLOBAL_CTRL has been disabled. All the counters do not count anymore.
1951+
* It doesn't matter if the PEBS is enabled or not.
1952+
* Usually, the PEBS status are not changed in PMIs. It's unnecessary to
1953+
* access PEBS_ENABLE MSR in disable_all()/enable_all().
1954+
* However, there are some cases which may change PEBS status, e.g. PMI
1955+
* throttle. The PEBS_ENABLE should be updated where the status changes.
19481956
*/
19491957
static void __intel_pmu_disable_all(void)
19501958
{
@@ -1954,21 +1962,19 @@ static void __intel_pmu_disable_all(void)
19541962

19551963
if (test_bit(INTEL_PMC_IDX_FIXED_BTS, cpuc->active_mask))
19561964
intel_pmu_disable_bts();
1957-
1958-
intel_pmu_pebs_disable_all();
19591965
}
19601966

19611967
static void intel_pmu_disable_all(void)
19621968
{
19631969
__intel_pmu_disable_all();
1970+
intel_pmu_pebs_disable_all();
19641971
intel_pmu_lbr_disable_all();
19651972
}
19661973

19671974
static void __intel_pmu_enable_all(int added, bool pmi)
19681975
{
19691976
struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events);
19701977

1971-
intel_pmu_pebs_enable_all();
19721978
intel_pmu_lbr_enable_all(pmi);
19731979
wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL,
19741980
x86_pmu.intel_ctrl & ~cpuc->intel_ctrl_guest_mask);
@@ -1986,6 +1992,7 @@ static void __intel_pmu_enable_all(int added, bool pmi)
19861992

19871993
static void intel_pmu_enable_all(int added)
19881994
{
1995+
intel_pmu_pebs_enable_all();
19891996
__intel_pmu_enable_all(added, false);
19901997
}
19911998

@@ -2374,9 +2381,21 @@ static int handle_pmi_common(struct pt_regs *regs, u64 status)
23742381
* PEBS overflow sets bit 62 in the global status register
23752382
*/
23762383
if (__test_and_clear_bit(62, (unsigned long *)&status)) {
2384+
u64 pebs_enabled = cpuc->pebs_enabled;
2385+
23772386
handled++;
23782387
x86_pmu.drain_pebs(regs);
23792388
status &= x86_pmu.intel_ctrl | GLOBAL_STATUS_TRACE_TOPAPMI;
2389+
2390+
/*
2391+
* PMI throttle may be triggered, which stops the PEBS event.
2392+
* Although cpuc->pebs_enabled is updated accordingly, the
2393+
* MSR_IA32_PEBS_ENABLE is not updated. Because the
2394+
* cpuc->enabled has been forced to 0 in PMI.
2395+
* Update the MSR if pebs_enabled is changed.
2396+
*/
2397+
if (pebs_enabled != cpuc->pebs_enabled)
2398+
wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled);
23802399
}
23812400

23822401
/*

0 commit comments

Comments
 (0)