Skip to content

Commit da99f93

Browse files
committed
Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Ingo Molnar: "Fixes and HW enablement patches: - Tooling fixes, most of which are tooling header synchronization with v5.6 changes - Fix kprobes fallout on ARM - Add Intel Elkhart Lake support and extend Tremont support, these are relatively simple and should only affect those models - Fix the AMD family 17h generic event table" * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (30 commits) perf llvm: Fix script used to obtain kernel make directives to work with new kbuild tools headers kvm: Sync linux/kvm.h with the kernel sources tools headers kvm: Sync kvm headers with the kernel sources tools arch x86: Sync asm/cpufeatures.h with the kernel sources tools headers x86: Sync disabled-features.h tools include UAPI: Sync sound/asound.h copy tools headers UAPI: Sync asm-generic/mman-common.h with the kernel perf tools: Add arm64 version of get_cpuid() tools headers UAPI: Sync drm/i915_drm.h with the kernel sources tools headers uapi: Sync linux/fscrypt.h with the kernel sources tools headers UAPI: Sync sched.h with the kernel perf trace: Resolve prctl's 'option' arg strings to numbers perf beauty prctl: Export the 'options' strarray tools headers UAPI: Sync prctl.h with the kernel sources tools headers UAPI: Sync copy of arm64's asm/unistd.h with the kernel sources perf maps: Move kmap::kmaps setup to maps__insert() perf maps: Fix map__clone() for struct kmap perf maps: Mark ksymbol DSOs with kernel type perf maps: Mark module DSOs with kernel type tools include UAPI: Sync x86's syscalls_64.tbl, generic unistd.h and fcntl.h to pick up openat2 and pidfd_getfd ...
2 parents 829e694 + dfb9b69 commit da99f93

File tree

32 files changed

+383
-103
lines changed

32 files changed

+383
-103
lines changed

arch/arm/kernel/ftrace.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,10 @@ static int ftrace_modify_code(unsigned long pc, unsigned long old,
7878
{
7979
unsigned long replaced;
8080

81-
if (IS_ENABLED(CONFIG_THUMB2_KERNEL)) {
81+
if (IS_ENABLED(CONFIG_THUMB2_KERNEL))
8282
old = __opcode_to_mem_thumb32(old);
83-
new = __opcode_to_mem_thumb32(new);
84-
} else {
83+
else
8584
old = __opcode_to_mem_arm(old);
86-
new = __opcode_to_mem_arm(new);
87-
}
8885

8986
if (validate) {
9087
if (probe_kernel_read(&replaced, (void *)pc, MCOUNT_INSN_SIZE))

arch/arm/kernel/patch.c

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ struct patch {
1616
unsigned int insn;
1717
};
1818

19+
#ifdef CONFIG_MMU
1920
static DEFINE_RAW_SPINLOCK(patch_lock);
2021

2122
static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags)
22-
__acquires(&patch_lock)
2323
{
2424
unsigned int uintaddr = (uintptr_t) addr;
2525
bool module = !core_kernel_text(uintaddr);
@@ -34,24 +34,26 @@ static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags)
3434

3535
if (flags)
3636
raw_spin_lock_irqsave(&patch_lock, *flags);
37-
else
38-
__acquire(&patch_lock);
3937

4038
set_fixmap(fixmap, page_to_phys(page));
4139

4240
return (void *) (__fix_to_virt(fixmap) + (uintaddr & ~PAGE_MASK));
4341
}
4442

4543
static void __kprobes patch_unmap(int fixmap, unsigned long *flags)
46-
__releases(&patch_lock)
4744
{
4845
clear_fixmap(fixmap);
4946

5047
if (flags)
5148
raw_spin_unlock_irqrestore(&patch_lock, *flags);
52-
else
53-
__release(&patch_lock);
5449
}
50+
#else
51+
static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags)
52+
{
53+
return addr;
54+
}
55+
static void __kprobes patch_unmap(int fixmap, unsigned long *flags) { }
56+
#endif
5557

5658
void __kprobes __patch_text_real(void *addr, unsigned int insn, bool remap)
5759
{
@@ -64,8 +66,6 @@ void __kprobes __patch_text_real(void *addr, unsigned int insn, bool remap)
6466

6567
if (remap)
6668
waddr = patch_map(addr, FIX_TEXT_POKE0, &flags);
67-
else
68-
__acquire(&patch_lock);
6969

7070
if (thumb2 && __opcode_is_thumb16(insn)) {
7171
*(u16 *)waddr = __opcode_to_mem_thumb16(insn);
@@ -102,8 +102,7 @@ void __kprobes __patch_text_real(void *addr, unsigned int insn, bool remap)
102102
if (waddr != addr) {
103103
flush_kernel_vmap_range(waddr, twopage ? size / 2 : size);
104104
patch_unmap(FIX_TEXT_POKE0, &flags);
105-
} else
106-
__release(&patch_lock);
105+
}
107106

108107
flush_icache_range((uintptr_t)(addr),
109108
(uintptr_t)(addr) + size);

arch/x86/events/amd/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,7 @@ static const u64 amd_f17h_perfmon_event_map[PERF_COUNT_HW_MAX] =
250250
[PERF_COUNT_HW_CPU_CYCLES] = 0x0076,
251251
[PERF_COUNT_HW_INSTRUCTIONS] = 0x00c0,
252252
[PERF_COUNT_HW_CACHE_REFERENCES] = 0xff60,
253+
[PERF_COUNT_HW_CACHE_MISSES] = 0x0964,
253254
[PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 0x00c2,
254255
[PERF_COUNT_HW_BRANCH_MISSES] = 0x00c3,
255256
[PERF_COUNT_HW_STALLED_CYCLES_FRONTEND] = 0x0287,

arch/x86/events/intel/core.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4765,6 +4765,7 @@ __init int intel_pmu_init(void)
47654765
break;
47664766

47674767
case INTEL_FAM6_ATOM_TREMONT_D:
4768+
case INTEL_FAM6_ATOM_TREMONT:
47684769
x86_pmu.late_ack = true;
47694770
memcpy(hw_cache_event_ids, glp_hw_cache_event_ids,
47704771
sizeof(hw_cache_event_ids));

arch/x86/events/intel/cstate.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,17 +40,18 @@
4040
* Model specific counters:
4141
* MSR_CORE_C1_RES: CORE C1 Residency Counter
4242
* perf code: 0x00
43-
* Available model: SLM,AMT,GLM,CNL
43+
* Available model: SLM,AMT,GLM,CNL,TNT
4444
* Scope: Core (each processor core has a MSR)
4545
* MSR_CORE_C3_RESIDENCY: CORE C3 Residency Counter
4646
* perf code: 0x01
4747
* Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,GLM,
48-
* CNL,KBL,CML
48+
* CNL,KBL,CML,TNT
4949
* Scope: Core
5050
* MSR_CORE_C6_RESIDENCY: CORE C6 Residency Counter
5151
* perf code: 0x02
5252
* Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW,
53-
* SKL,KNL,GLM,CNL,KBL,CML,ICL,TGL
53+
* SKL,KNL,GLM,CNL,KBL,CML,ICL,TGL,
54+
* TNT
5455
* Scope: Core
5556
* MSR_CORE_C7_RESIDENCY: CORE C7 Residency Counter
5657
* perf code: 0x03
@@ -60,17 +61,18 @@
6061
* MSR_PKG_C2_RESIDENCY: Package C2 Residency Counter.
6162
* perf code: 0x00
6263
* Available model: SNB,IVB,HSW,BDW,SKL,KNL,GLM,CNL,
63-
* KBL,CML,ICL,TGL
64+
* KBL,CML,ICL,TGL,TNT
6465
* Scope: Package (physical package)
6566
* MSR_PKG_C3_RESIDENCY: Package C3 Residency Counter.
6667
* perf code: 0x01
6768
* Available model: NHM,WSM,SNB,IVB,HSW,BDW,SKL,KNL,
68-
* GLM,CNL,KBL,CML,ICL,TGL
69+
* GLM,CNL,KBL,CML,ICL,TGL,TNT
6970
* Scope: Package (physical package)
7071
* MSR_PKG_C6_RESIDENCY: Package C6 Residency Counter.
7172
* perf code: 0x02
72-
* Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW
73-
* SKL,KNL,GLM,CNL,KBL,CML,ICL,TGL
73+
* Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW,
74+
* SKL,KNL,GLM,CNL,KBL,CML,ICL,TGL,
75+
* TNT
7476
* Scope: Package (physical package)
7577
* MSR_PKG_C7_RESIDENCY: Package C7 Residency Counter.
7678
* perf code: 0x03
@@ -87,7 +89,8 @@
8789
* Scope: Package (physical package)
8890
* MSR_PKG_C10_RESIDENCY: Package C10 Residency Counter.
8991
* perf code: 0x06
90-
* Available model: HSW ULT,KBL,GLM,CNL,CML,ICL,TGL
92+
* Available model: HSW ULT,KBL,GLM,CNL,CML,ICL,TGL,
93+
* TNT
9194
* Scope: Package (physical package)
9295
*
9396
*/
@@ -640,8 +643,9 @@ static const struct x86_cpu_id intel_cstates_match[] __initconst = {
640643

641644
X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT, glm_cstates),
642645
X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT_D, glm_cstates),
643-
644646
X86_CSTATES_MODEL(INTEL_FAM6_ATOM_GOLDMONT_PLUS, glm_cstates),
647+
X86_CSTATES_MODEL(INTEL_FAM6_ATOM_TREMONT_D, glm_cstates),
648+
X86_CSTATES_MODEL(INTEL_FAM6_ATOM_TREMONT, glm_cstates),
645649

646650
X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE_L, icl_cstates),
647651
X86_CSTATES_MODEL(INTEL_FAM6_ICELAKE, icl_cstates),

arch/x86/events/intel/ds.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1714,6 +1714,8 @@ intel_pmu_save_and_restart_reload(struct perf_event *event, int count)
17141714
old = ((s64)(prev_raw_count << shift) >> shift);
17151715
local64_add(new - old + count * period, &event->count);
17161716

1717+
local64_set(&hwc->period_left, -new);
1718+
17171719
perf_event_update_userpage(event);
17181720

17191721
return 0;

arch/x86/events/msr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@ static bool test_intel(int idx, void *data)
7575

7676
case INTEL_FAM6_ATOM_GOLDMONT:
7777
case INTEL_FAM6_ATOM_GOLDMONT_D:
78-
7978
case INTEL_FAM6_ATOM_GOLDMONT_PLUS:
79+
case INTEL_FAM6_ATOM_TREMONT_D:
80+
case INTEL_FAM6_ATOM_TREMONT:
8081

8182
case INTEL_FAM6_XEON_PHI_KNL:
8283
case INTEL_FAM6_XEON_PHI_KNM:

tools/arch/arm64/include/uapi/asm/kvm.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,10 +220,18 @@ struct kvm_vcpu_events {
220220
#define KVM_REG_ARM_PTIMER_CVAL ARM64_SYS_REG(3, 3, 14, 2, 2)
221221
#define KVM_REG_ARM_PTIMER_CNT ARM64_SYS_REG(3, 3, 14, 0, 1)
222222

223-
/* EL0 Virtual Timer Registers */
223+
/*
224+
* EL0 Virtual Timer Registers
225+
*
226+
* WARNING:
227+
* KVM_REG_ARM_TIMER_CVAL and KVM_REG_ARM_TIMER_CNT are not defined
228+
* with the appropriate register encodings. Their values have been
229+
* accidentally swapped. As this is set API, the definitions here
230+
* must be used, rather than ones derived from the encodings.
231+
*/
224232
#define KVM_REG_ARM_TIMER_CTL ARM64_SYS_REG(3, 3, 14, 3, 1)
225-
#define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2)
226233
#define KVM_REG_ARM_TIMER_CVAL ARM64_SYS_REG(3, 3, 14, 0, 2)
234+
#define KVM_REG_ARM_TIMER_CNT ARM64_SYS_REG(3, 3, 14, 3, 2)
227235

228236
/* KVM-as-firmware specific pseudo-registers */
229237
#define KVM_REG_ARM_FW (0x0014 << KVM_REG_ARM_COPROC_SHIFT)

tools/arch/arm64/include/uapi/asm/unistd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@
1919
#define __ARCH_WANT_NEW_STAT
2020
#define __ARCH_WANT_SET_GET_RLIMIT
2121
#define __ARCH_WANT_TIME32_SYSCALLS
22+
#define __ARCH_WANT_SYS_CLONE3
2223

2324
#include <asm-generic/unistd.h>

tools/arch/x86/include/asm/cpufeatures.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@
220220
#define X86_FEATURE_ZEN ( 7*32+28) /* "" CPU is AMD family 0x17 (Zen) */
221221
#define X86_FEATURE_L1TF_PTEINV ( 7*32+29) /* "" L1TF workaround PTE inversion */
222222
#define X86_FEATURE_IBRS_ENHANCED ( 7*32+30) /* Enhanced IBRS */
223+
#define X86_FEATURE_MSR_IA32_FEAT_CTL ( 7*32+31) /* "" MSR IA32_FEAT_CTL configured */
223224

224225
/* Virtualization flags: Linux defined, word 8 */
225226
#define X86_FEATURE_TPR_SHADOW ( 8*32+ 0) /* Intel TPR Shadow */
@@ -357,6 +358,7 @@
357358
/* Intel-defined CPU features, CPUID level 0x00000007:0 (EDX), word 18 */
358359
#define X86_FEATURE_AVX512_4VNNIW (18*32+ 2) /* AVX-512 Neural Network Instructions */
359360
#define X86_FEATURE_AVX512_4FMAPS (18*32+ 3) /* AVX-512 Multiply Accumulation Single precision */
361+
#define X86_FEATURE_FSRM (18*32+ 4) /* Fast Short Rep Mov */
360362
#define X86_FEATURE_AVX512_VP2INTERSECT (18*32+ 8) /* AVX-512 Intersect for D/Q */
361363
#define X86_FEATURE_MD_CLEAR (18*32+10) /* VERW clears CPU buffers */
362364
#define X86_FEATURE_TSX_FORCE_ABORT (18*32+13) /* "" TSX_FORCE_ABORT */

0 commit comments

Comments
 (0)