Skip to content

Commit f48ffef

Browse files
committed
Merge tag 'perf_urgent_for_v5.18_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull perf fixes from Borislav Petkov: - Add Sapphire Rapids CPU support - Fix a perf vmalloc-ed buffer mapping error (PERF_USE_VMALLOC in use) * tag 'perf_urgent_for_v5.18_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: perf/x86/cstate: Add SAPPHIRERAPIDS_X CPU support perf/core: Fix perf_mmap fail when CONFIG_PERF_USE_VMALLOC enabled
2 parents b877ca4 + 528c9f1 commit f48ffef

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

arch/x86/events/intel/cstate.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
* perf code: 0x02
5252
* Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW,
5353
* SKL,KNL,GLM,CNL,KBL,CML,ICL,ICX,
54-
* TGL,TNT,RKL,ADL,RPL
54+
* TGL,TNT,RKL,ADL,RPL,SPR
5555
* Scope: Core
5656
* MSR_CORE_C7_RESIDENCY: CORE C7 Residency Counter
5757
* perf code: 0x03
@@ -62,7 +62,7 @@
6262
* perf code: 0x00
6363
* Available model: SNB,IVB,HSW,BDW,SKL,KNL,GLM,CNL,
6464
* KBL,CML,ICL,ICX,TGL,TNT,RKL,ADL,
65-
* RPL
65+
* RPL,SPR
6666
* Scope: Package (physical package)
6767
* MSR_PKG_C3_RESIDENCY: Package C3 Residency Counter.
6868
* perf code: 0x01
@@ -74,7 +74,7 @@
7474
* perf code: 0x02
7575
* Available model: SLM,AMT,NHM,WSM,SNB,IVB,HSW,BDW,
7676
* SKL,KNL,GLM,CNL,KBL,CML,ICL,ICX,
77-
* TGL,TNT,RKL,ADL,RPL
77+
* TGL,TNT,RKL,ADL,RPL,SPR
7878
* Scope: Package (physical package)
7979
* MSR_PKG_C7_RESIDENCY: Package C7 Residency Counter.
8080
* perf code: 0x03
@@ -675,6 +675,7 @@ static const struct x86_cpu_id intel_cstates_match[] __initconst = {
675675
X86_MATCH_INTEL_FAM6_MODEL(ICELAKE, &icl_cstates),
676676
X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_X, &icx_cstates),
677677
X86_MATCH_INTEL_FAM6_MODEL(ICELAKE_D, &icx_cstates),
678+
X86_MATCH_INTEL_FAM6_MODEL(SAPPHIRERAPIDS_X, &icx_cstates),
678679

679680
X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE_L, &icl_cstates),
680681
X86_MATCH_INTEL_FAM6_MODEL(TIGERLAKE, &icl_cstates),

kernel/events/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6247,7 +6247,7 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma)
62476247
again:
62486248
mutex_lock(&event->mmap_mutex);
62496249
if (event->rb) {
6250-
if (event->rb->nr_pages != nr_pages) {
6250+
if (data_page_nr(event->rb) != nr_pages) {
62516251
ret = -EINVAL;
62526252
goto unlock;
62536253
}

kernel/events/internal.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,11 @@ static inline int page_order(struct perf_buffer *rb)
116116
}
117117
#endif
118118

119+
static inline int data_page_nr(struct perf_buffer *rb)
120+
{
121+
return rb->nr_pages << page_order(rb);
122+
}
123+
119124
static inline unsigned long perf_data_size(struct perf_buffer *rb)
120125
{
121126
return rb->nr_pages << (PAGE_SHIFT + page_order(rb));

kernel/events/ring_buffer.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -859,11 +859,6 @@ void rb_free(struct perf_buffer *rb)
859859
}
860860

861861
#else
862-
static int data_page_nr(struct perf_buffer *rb)
863-
{
864-
return rb->nr_pages << page_order(rb);
865-
}
866-
867862
static struct page *
868863
__perf_mmap_to_page(struct perf_buffer *rb, unsigned long pgoff)
869864
{

0 commit comments

Comments
 (0)