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
Showing the changes to kernel (3 of 4 files). Show all
Unified · Split
| @@ -6247,7 +6247,7 @@ static int perf_mmap(struct file *file, struct vm_area_struct *vma) · 6246 unmodified lines | ||
| 6247 | 6247 | again: |
| 6248 | 6248 | mutex_lock(&event->mmap_mutex); |
| 6249 | 6249 | if (event->rb) { |
| 6250 | − if (event->rb->nr_pages != nr_pages) { | |
| 6250 | + if (data_page_nr(event->rb) != nr_pages) { | |
| 6251 | 6251 | ret = -EINVAL; |
| 6252 | 6252 | goto unlock; |
| 6253 | 6253 | } |
| @@ -116,6 +116,11 @@ static inline int page_order(struct perf_buffer *rb) · 115 unmodified lines | ||
| 116 | 116 | } |
| 117 | 117 | #endif |
| 118 | 118 | |
| 119 | +static inline int data_page_nr(struct perf_buffer *rb) | |
| 120 | +{ | |
| 121 | + return rb->nr_pages << page_order(rb); | |
| 122 | +} | |
| 123 | + | |
| 119 | 124 | static inline unsigned long perf_data_size(struct perf_buffer *rb) |
| 120 | 125 | { |
| 121 | 126 | return rb->nr_pages << (PAGE_SHIFT + page_order(rb)); |
| @@ -859,11 +859,6 @@ void rb_free(struct perf_buffer *rb) · 858 unmodified lines | ||
| 859 | 859 | } |
| 860 | 860 | |
| 861 | 861 | #else |
| 862 | −static int data_page_nr(struct perf_buffer *rb) | |
| 863 | −{ | |
| 864 | − return rb->nr_pages << page_order(rb); | |
| 865 | −} | |
| 866 | − | |
| 867 | 862 | static struct page * |
| 868 | 863 | __perf_mmap_to_page(struct perf_buffer *rb, unsigned long pgoff) |
| 869 | 864 | { |