|
|
0d82f9 |
From 8c42fcfa92998da170ee84cd24c2377db2e90f33 Mon Sep 17 00:00:00 2001
|
|
|
0d82f9 |
From: Tao Liu <ltao@redhat.com>
|
|
|
0d82f9 |
Date: Tue, 12 Jul 2022 19:41:25 +0800
|
|
|
0d82f9 |
Subject: [PATCH 2/2] Fix data type error in perf_handle_mm_page_alloc
|
|
|
0d82f9 |
|
|
|
0d82f9 |
For systems as s390, unsigned long and unsigned int are different in
|
|
|
0d82f9 |
size. After expanding the macro, the code will be:
|
|
|
0d82f9 |
|
|
|
0d82f9 |
unsigned int order = *((unsigned long*)
|
|
|
0d82f9 |
(((const unsigned char*)(&raw->data)) +
|
|
|
0d82f9 |
((struct __perf_event_field_table_mm_page_alloc*)(perf_event_mm_page_alloc.fields))->order_info.offset));
|
|
|
0d82f9 |
|
|
|
0d82f9 |
or simply:
|
|
|
0d82f9 |
|
|
|
0d82f9 |
unsigned int order = *((unsigned long*)
|
|
|
0d82f9 |
(((const unsigned char*)(&raw->data)) + 16));
|
|
|
0d82f9 |
|
|
|
0d82f9 |
If we have the following data array:
|
|
|
0d82f9 |
|
|
|
0d82f9 |
Raw data[16]: 0x0
|
|
|
0d82f9 |
Raw data[17]: 0x0
|
|
|
0d82f9 |
Raw data[18]: 0x0
|
|
|
0d82f9 |
Raw data[19]: 0x2
|
|
|
0d82f9 |
Raw data[20]: 0x0
|
|
|
0d82f9 |
Raw data[21]: 0x0
|
|
|
0d82f9 |
Raw data[22]: 0xc
|
|
|
0d82f9 |
Raw data[23]: 0xc0
|
|
|
0d82f9 |
|
|
|
0d82f9 |
The order will be: 0x0cc0, instead of 0x2.
|
|
|
0d82f9 |
|
|
|
0d82f9 |
This patch will fix the error data type.
|
|
|
0d82f9 |
|
|
|
0d82f9 |
Signed-off-by: Tao Liu <ltao@redhat.com>
|
|
|
0d82f9 |
---
|
|
|
0d82f9 |
src/backend/perf-events.c | 2 +-
|
|
|
0d82f9 |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
0d82f9 |
|
|
|
0d82f9 |
diff --git a/src/backend/perf-events.c b/src/backend/perf-events.c
|
|
|
0d82f9 |
index 0252991..67f1dad 100644
|
|
|
0d82f9 |
--- a/src/backend/perf-events.c
|
|
|
0d82f9 |
+++ b/src/backend/perf-events.c
|
|
|
0d82f9 |
@@ -156,7 +156,7 @@ static int perf_handle_mm_page_alloc(const unsigned char* header) {
|
|
|
0d82f9 |
sizeof(callchain->ips) * callchain->nr);
|
|
|
0d82f9 |
|
|
|
0d82f9 |
unsigned long pfn = read_data_from_perf_raw(mm_page_alloc, pfn, unsigned long, raw);
|
|
|
0d82f9 |
- unsigned int order = read_data_from_perf_raw(mm_page_alloc, order, unsigned long, raw);
|
|
|
0d82f9 |
+ unsigned int order = read_data_from_perf_raw(mm_page_alloc, order, unsigned int, raw);
|
|
|
0d82f9 |
int pid = read_data_from_perf_raw(mm_page_alloc, common_pid, int, raw);
|
|
|
0d82f9 |
|
|
|
0d82f9 |
// TODO: pfn == -1?
|
|
|
0d82f9 |
--
|
|
|
0d82f9 |
2.33.1
|
|
|
0d82f9 |
|