diff --git a/0033-Move-all-curses-calls-into-display-threads.patch b/0033-Move-all-curses-calls-into-display-threads.patch new file mode 100644 index 0000000..c2375e0 --- /dev/null +++ b/0033-Move-all-curses-calls-into-display-threads.patch @@ -0,0 +1,260 @@ +From eb42e7eb07892e91939e3875a124d5f485697ae9 Mon Sep 17 00:00:00 2001 +From: Andi Kleen +Date: Mon, 18 Nov 2024 08:04:04 -0800 +Subject: [PATCH] Move all curses calls into display threads + +Curses is not thread safe, but currently both the cons and the disp +thread can issue curses calls concurrently. + +Move all curses handling into the display thread. The cons thread +just does the select and pipe handling now. + +Fixes #91 +--- + common/disp.c | 138 +++++++++++++++++++++--------------------- + common/include/disp.h | 4 +- + 2 files changed, 73 insertions(+), 69 deletions(-) + +diff --git a/common/disp.c b/common/disp.c +index ea865c3..78bf9e9 100644 +--- a/common/disp.c ++++ b/common/disp.c +@@ -58,6 +58,7 @@ static cons_ctl_t s_cons_ctl; + static int disp_start(void); + static void* disp_handler(void *); + static void* cons_handler(void *); ++static disp_flag_t handle_getch(cmd_t *cmdp); + + static int mutex_cond_init(pthread_mutex_t *mutex, pthread_cond_t *cond) + { +@@ -465,6 +466,12 @@ disp_handler(void *arg __attribute__((unused))) + uint64_t start_ms; + int64_t diff_ms; + ++ if (!reg_curses_init(B_TRUE)) { ++ goto L_EXIT; ++ } ++ ++ win_fix_init(); ++ + /* + * Wait cons thread to complete initialization. + */ +@@ -509,6 +516,7 @@ disp_handler(void *arg __attribute__((unused))) + s_disp_ctl.flag = DISP_FLAG_NONE; + (void) pthread_mutex_unlock(&s_disp_ctl.mutex); + ++ + diff_ms = current_ms(&g_tvbase) - start_ms; + if (g_run_secs <= diff_ms / MS_SEC) { + g_run_secs = TIME_NSEC_MAX; +@@ -532,6 +540,7 @@ disp_handler(void *arg __attribute__((unused))) + continue; + } + ++ handle_cmd: + switch (flag) { + case DISP_FLAG_QUIT: + debug_print(NULL, 2, +@@ -601,6 +610,12 @@ disp_handler(void *arg __attribute__((unused))) + } + break; + ++ case DISP_FLAG_GETCH: ++ flag = handle_getch(&cmd); ++ if (flag == DISP_FLAG_ERR) ++ goto L_EXIT; ++ goto handle_cmd; ++ + default: + break; + } +@@ -610,7 +625,7 @@ L_EXIT: + if (pagelist_inited) { + page_list_fini(); + } +- ++ reg_curses_fini(); + /* + * Let the perf thread exit first. + */ +@@ -620,6 +635,53 @@ L_EXIT: + return (NULL); + } + ++static disp_flag_t ++handle_getch(cmd_t *cmd_id_p) ++{ ++ int c, cmd_id; ++ unsigned char ch; ++ ++ if ((c = getch()) == ERR) { ++ /* ++ * It's possile if the associated ++ * terminal is lost. ++ */ ++ debug_print(NULL, 2, "cons: " ++ "getch() failed.\n"); ++ return DISP_FLAG_ERR; ++ } ++ ++ ch = tolower((unsigned char)c); ++ dump_write("\n<-- User hit the key '%c' " ++ "(ascii = %d) -->\n", ch, (int)ch); ++ ++ /* These will send the command to itself. */ ++ ++ cmd_id = cmd_id_get(ch); ++ if (cmd_id != CMD_INVALID_ID) { ++ CMD_ID_SET(cmd_id_p, cmd_id); ++ return DISP_FLAG_CMD; ++ } else { ++ /* ++ * Hit the keys 'UP'/'DOWN'/'ENTER' ++ */ ++ switch (ch) { ++ case 2: /* KEY DOWN */ ++ return DISP_FLAG_SCROLLDOWN; ++ ++ case 3: /* KEY UP */ ++ return DISP_FLAG_SCROLLUP; ++ ++ case 13: /* enter. */ ++ return DISP_FLAG_SCROLLENTER; ++ ++ default: ++ break; ++ } ++ } ++ return DISP_FLAG_NONE; ++} ++ + /* + * The handler of 'cons thread' + */ +@@ -627,17 +689,10 @@ L_EXIT: + static void * + cons_handler(void *arg __attribute__((unused))) + { +- int c, cmd_id; + unsigned char ch; + +- if (!reg_curses_init(B_TRUE)) { +- goto L_EXIT; +- } +- +- win_fix_init(); +- + /* +- * Excute "home" command. It shows the NumaTop default page. ++ * Execute "home" command. It shows the NumaTop default page. + */ + disp_go_home(); + +@@ -676,75 +731,22 @@ cons_handler(void *arg __attribute__((unused))) + + CMD_ID_SET(&s_disp_ctl.cmd, + CMD_RESIZE_ID); +- dispthr_flagset_nolock(DISP_FLAG_CMD); ++ dispthr_flagset_nolock(DISP_FLAG_CMD); + +- (void) pthread_mutex_unlock( +- &s_disp_ctl.mutex); ++ (void) pthread_mutex_unlock( ++ &s_disp_ctl.mutex); + } + } + } else { + /* +- * Character is from STDIN. ++ * Character is from STDIN. Tell disp handler to process. + */ +- if ((c = getch()) == ERR) { +- /* +- * It's possile if the associated +- * terminal is lost. +- */ +- debug_print(NULL, 2, "cons: " +- "getch() failed.\n"); +- break; +- } +- +- ch = tolower((unsigned char)c); +- dump_write("\n<-- User hit the key '%c' " +- "(ascii = %d) -->\n", ch, (int)ch); +- +- cmd_id = cmd_id_get(ch); +- if (cmd_id != CMD_INVALID_ID) { +- /* +- * The character is a command. Send +- * the command to 'disp thread'. +- */ +- (void) pthread_mutex_lock( +- &s_disp_ctl.mutex); +- +- CMD_ID_SET(&s_disp_ctl.cmd, cmd_id); +- dispthr_flagset_nolock(DISP_FLAG_CMD); +- +- (void) pthread_mutex_unlock( +- &s_disp_ctl.mutex); +- } else { +- /* +- * Hit the keys 'UP'/'DOWN'/'ENTER' +- */ +- switch (ch) { +- case 2: /* KEY DOWN */ +- dispthr_flagset_lock( +- DISP_FLAG_SCROLLDOWN); +- break; +- +- case 3: /* KEY UP */ +- dispthr_flagset_lock( +- DISP_FLAG_SCROLLUP); +- break; +- +- case 13: /* enter. */ +- dispthr_flagset_lock( +- DISP_FLAG_SCROLLENTER); +- break; +- +- default: +- break; +- } +- } ++ dispthr_flagset_lock(DISP_FLAG_GETCH); + } ++ + } + } + +- reg_curses_fini(); +- +-L_EXIT: + debug_print(NULL, 2, "cons thread is exiting\n"); + return (NULL); + } +diff --git a/common/include/disp.h b/common/include/disp.h +index f9d28de..f934406 100644 +--- a/common/include/disp.h ++++ b/common/include/disp.h +@@ -47,6 +47,7 @@ extern "C" { + + typedef enum { + DISP_FLAG_NONE = 0, ++ DISP_FLAG_ERR, + DISP_FLAG_QUIT, + DISP_FLAG_PROFILING_DATA_READY, + DISP_FLAG_PROFILING_DATA_FAIL, +@@ -59,7 +60,8 @@ typedef enum { + DISP_FLAG_CMD, + DISP_FLAG_SCROLLUP, + DISP_FLAG_SCROLLDOWN, +- DISP_FLAG_SCROLLENTER ++ DISP_FLAG_SCROLLENTER, ++ DISP_FLAG_GETCH + } disp_flag_t; + + typedef struct _disp_ctl { +-- +2.41.0 + diff --git a/0034-Avoid-race-on-submitting-display-commands.patch b/0034-Avoid-race-on-submitting-display-commands.patch new file mode 100644 index 0000000..92e52bf --- /dev/null +++ b/0034-Avoid-race-on-submitting-display-commands.patch @@ -0,0 +1,32 @@ +From 8dfa30ea03111981ce5cbc793960688d93f17b68 Mon Sep 17 00:00:00 2001 +From: Andi Kleen +Date: Tue, 19 Nov 2024 11:02:35 -0800 +Subject: [PATCH] Avoid race on submitting display commands + +Doesn't work for quitting, but we can ignore it here. +--- + common/disp.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/common/disp.c b/common/disp.c +index 78bf9e9..c542b77 100644 +--- a/common/disp.c ++++ b/common/disp.c +@@ -193,6 +193,14 @@ disp_consthr_quit(void) + static void + dispthr_flagset_nolock(disp_flag_t flag) + { ++ if (flag != DISP_FLAG_QUIT) { ++ /* Wait in case we the disp thread hasn't processed the flag yet. */ ++ while (*(volatile disp_flag_t *)&s_disp_ctl.flag != DISP_FLAG_NONE) { ++ (void) pthread_mutex_unlock(&s_disp_ctl.mutex); ++ usleep(1); ++ (void) pthread_mutex_lock(&s_disp_ctl.mutex); ++ } ++ } + s_disp_ctl.flag = flag; + (void) pthread_cond_signal(&s_disp_ctl.cond); + } +-- +2.41.0 + diff --git a/0035-Remove-EMR-specific-events-configuration.patch b/0035-Remove-EMR-specific-events-configuration.patch new file mode 100644 index 0000000..7783d2f --- /dev/null +++ b/0035-Remove-EMR-specific-events-configuration.patch @@ -0,0 +1,126 @@ +From 4d9a0e4cd945c58163c0655904f46f932338c9b9 Mon Sep 17 00:00:00 2001 +From: Dapeng Mi +Date: Tue, 15 Oct 2024 12:29:57 +0000 +Subject: [PATCH 1/3] Remove EMR specific events configuration + +Emerald Rapids shares same perf events configuration with +Sapphire rapids, it's unnecessary to define duplicated events +configuration and helper for EMR. It's fine to directly use SPR's +configuration. + +Thus delete these duplicated EMR code. + +Signed-off-by: Dapeng Mi +--- + x86/include/skl.h | 4 ---- + x86/plat.c | 6 +++--- + x86/skl.c | 28 +--------------------------- + 3 files changed, 4 insertions(+), 34 deletions(-) + +diff --git a/x86/include/skl.h b/x86/include/skl.h +index ab19f58..7a8b8f2 100644 +--- a/x86/include/skl.h ++++ b/x86/include/skl.h +@@ -51,10 +51,6 @@ extern void spr_profiling_config(perf_count_id_t, struct _plat_event_config *); + extern void spr_ll_config(struct _plat_event_config *); + extern int spr_offcore_num(void); + +-extern void emr_profiling_config(perf_count_id_t, struct _plat_event_config *); +-extern void emr_ll_config(struct _plat_event_config *); +-extern int emr_offcore_num(void); +- + #ifdef __cplusplus + } + #endif +diff --git a/x86/plat.c b/x86/plat.c +index d0c7cba..d69544e 100644 +--- a/x86/plat.c ++++ b/x86/plat.c +@@ -52,7 +52,7 @@ s_plat_profiling_config[CPU_TYPE_NUM] = { + skl_profiling_config, + icx_profiling_config, + spr_profiling_config, +- emr_profiling_config, ++ spr_profiling_config, /* EMR */ + zen_profiling_config, + zen3_profiling_config, + zen4_profiling_config +@@ -72,7 +72,7 @@ s_plat_ll_config[CPU_TYPE_NUM] = { + skl_ll_config, + icx_ll_config, + spr_ll_config, +- emr_ll_config, ++ spr_ll_config, /* EMR */ + zen_ll_config, + zen_ll_config, + zen_ll_config +@@ -92,7 +92,7 @@ s_plat_offcore_num[CPU_TYPE_NUM] = { + skl_offcore_num, + icx_offcore_num, + spr_offcore_num, +- emr_offcore_num, ++ spr_offcore_num, /* EMR */ + zen_offcore_num, + zen_offcore_num, + zen_offcore_num +diff --git a/x86/skl.c b/x86/skl.c +index a80a868..9be1bf0 100644 +--- a/x86/skl.c ++++ b/x86/skl.c +@@ -63,14 +63,6 @@ static plat_event_config_t s_spr_config[PERF_COUNT_NUM] = { + { PERF_TYPE_RAW, 0x012B, 0x53, 0x104000001, 0, 0, "off_core_response_1" } + }; + +-static plat_event_config_t s_emr_config[PERF_COUNT_NUM] = { +- { PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES, 0x53, 0, 0, 0, "cpu_clk_unhalted.core" }, +- { PERF_TYPE_RAW, 0x012A, 0x53, 0x730000001, 0, 0, "off_core_response_0" }, +- { PERF_TYPE_HARDWARE, PERF_COUNT_HW_REF_CPU_CYCLES, 0x53, 0, 0, 0, "cpu_clk_unhalted.ref" }, +- { PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS, 0x53, 0, 0, 0, "instr_retired.any" }, +- { PERF_TYPE_RAW, 0x012B, 0x53, 0x104000001, 0, 0, "off_core_response_1" } +-}; +- + static plat_event_config_t s_skl_ll = { + PERF_TYPE_RAW, 0x01CD, 0x53, LL_THRESH, 0, 1, "mem_trans_retired.latency_above_threshold" + }; +@@ -93,12 +85,6 @@ spr_profiling_config(perf_count_id_t perf_count_id, plat_event_config_t *cfg) + plat_config_get(perf_count_id, cfg, s_spr_config); + } + +-void +-emr_profiling_config(perf_count_id_t perf_count_id, plat_event_config_t *cfg) +-{ +- plat_config_get(perf_count_id, cfg, s_emr_config); +-} +- + void + skl_ll_config(plat_event_config_t *cfg) + { +@@ -117,12 +103,6 @@ spr_ll_config(plat_event_config_t *cfg) + skl_ll_config(cfg); + } + +-void +-emr_ll_config(plat_event_config_t *cfg) +-{ +- skl_ll_config(cfg); +-} +- + int + skl_offcore_num(void) + { +@@ -139,10 +119,4 @@ int + spr_offcore_num(void) + { + return skl_offcore_num(); +-} +- +-int +-emr_offcore_num(void) +-{ +- return skl_offcore_num(); +-} ++} +\ No newline at end of file +-- +2.41.0 + diff --git a/0036-Support-Intel-Granite-Rapids-platform.patch b/0036-Support-Intel-Granite-Rapids-platform.patch new file mode 100644 index 0000000..7f3e51a --- /dev/null +++ b/0036-Support-Intel-Granite-Rapids-platform.patch @@ -0,0 +1,83 @@ +From f1dadf9fbd33457b660884c6ce526315b1647e72 Mon Sep 17 00:00:00 2001 +From: Dapeng Mi +Date: Tue, 15 Oct 2024 12:41:10 +0000 +Subject: [PATCH 2/3] Support Intel Granite Rapids platform + +Granite Rapids shares same perf events configuration with +Sapphire rapids, directly reuse SPR's configuration to enable GNR's +support. + +Signed-off-by: Dapeng Mi +--- + x86/include/types.h | 3 ++- + x86/plat.c | 7 +++++++ + 2 files changed, 9 insertions(+), 1 deletion(-) + +diff --git a/x86/include/types.h b/x86/include/types.h +index 1a0199a..814ef1c 100644 +--- a/x86/include/types.h ++++ b/x86/include/types.h +@@ -48,12 +48,13 @@ typedef enum { + CPU_ICX, + CPU_SPR, + CPU_EMR, ++ CPU_GNR, + CPU_ZEN, + CPU_ZEN3, + CPU_ZEN4 + } cpu_type_t; + +-#define CPU_TYPE_NUM 16 ++#define CPU_TYPE_NUM 17 + + typedef enum { + PERF_COUNT_INVALID = -1, +diff --git a/x86/plat.c b/x86/plat.c +index d69544e..0eea408 100644 +--- a/x86/plat.c ++++ b/x86/plat.c +@@ -53,6 +53,7 @@ s_plat_profiling_config[CPU_TYPE_NUM] = { + icx_profiling_config, + spr_profiling_config, + spr_profiling_config, /* EMR */ ++ spr_profiling_config, /* GNR */ + zen_profiling_config, + zen3_profiling_config, + zen4_profiling_config +@@ -73,6 +74,7 @@ s_plat_ll_config[CPU_TYPE_NUM] = { + icx_ll_config, + spr_ll_config, + spr_ll_config, /* EMR */ ++ spr_ll_config, /* GNR */ + zen_ll_config, + zen_ll_config, + zen_ll_config +@@ -93,6 +95,7 @@ s_plat_offcore_num[CPU_TYPE_NUM] = { + icx_offcore_num, + spr_offcore_num, + spr_offcore_num, /* EMR */ ++ spr_offcore_num, /* GNR */ + zen_offcore_num, + zen_offcore_num, + zen_offcore_num +@@ -199,6 +202,9 @@ cpu_type_get(void) + case 207: + type = CPU_EMR; + break; ++ case 173: ++ type = CPU_GNR; ++ break; + } + } else if (family == 23) { /* Family 17h */ + type = CPU_ZEN; +@@ -252,6 +258,7 @@ plat_detect(void) + case CPU_ICX: + case CPU_SPR: + case CPU_EMR: ++ case CPU_GNR: + case CPU_ZEN: + case CPU_ZEN3: + case CPU_ZEN4: +-- +2.41.0 + diff --git a/0037-Support-Intel-Sierra-Forest-platform.patch b/0037-Support-Intel-Sierra-Forest-platform.patch new file mode 100644 index 0000000..b402134 --- /dev/null +++ b/0037-Support-Intel-Sierra-Forest-platform.patch @@ -0,0 +1,251 @@ +From 38fafde94d30242b6725f7f50ef92bc85a39f6f5 Mon Sep 17 00:00:00 2001 +From: Dapeng Mi +Date: Tue, 15 Oct 2024 12:56:10 +0000 +Subject: [PATCH 3/3] Support Intel Sierra Forest platform + +Add support for Intel Sierra Forest platform. SRF is the 1st generation +XEON server with pure E-cores. Since E-core's events are different with +P-cores, so create separate srf.h/c files to implement these E-core +specific data structures and helpers. + +Signed-off-by: Dapeng Mi +--- + Makefile.am | 2 ++ + x86/include/srf.h | 50 ++++++++++++++++++++++++++++++++ + x86/include/types.h | 3 +- + x86/plat.c | 8 ++++++ + x86/srf.c | 70 +++++++++++++++++++++++++++++++++++++++++++++ + 5 files changed, 132 insertions(+), 1 deletion(-) + create mode 100644 x86/include/srf.h + create mode 100644 x86/srf.c + +diff --git a/Makefile.am b/Makefile.am +index f23e1a6..a6ef1de 100644 +--- a/Makefile.am ++++ b/Makefile.am +@@ -64,6 +64,7 @@ libnumatop_la_SOURCES += \ + x86/include/nhm.h \ + x86/include/skl.h \ + x86/include/snb.h \ ++ x86/include/srf.h \ + x86/include/types.h \ + x86/include/util.h \ + x86/include/wsm.h \ +@@ -73,6 +74,7 @@ libnumatop_la_SOURCES += \ + x86/plat.c \ + x86/skl.c \ + x86/snb.c \ ++ x86/srf.c \ + x86/ui_perf_map.c \ + x86/util.c \ + x86/wsm.c \ +diff --git a/x86/include/srf.h b/x86/include/srf.h +new file mode 100644 +index 0000000..8bb0f44 +--- /dev/null ++++ b/x86/include/srf.h +@@ -0,0 +1,50 @@ ++/* ++ * Copyright (c) 2024, Intel Corporation ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are met: ++ * ++ * * Redistributions of source code must retain the above copyright notice, ++ * this list of conditions and the following disclaimer. ++ * * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * * Neither the name of Intel Corporation nor the names of its contributors ++ * may be used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ++ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ++ * POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++#ifndef _NUMATOP_INTEL_SRF_H ++#define _NUMATOP_INTEL_SRF_H ++ ++#ifdef __cplusplus ++extern "C" { ++#endif ++ ++#include ++#include ++#include "../../common/include/types.h" ++ ++struct _plat_event_config; ++ ++extern void srf_profiling_config(perf_count_id_t, struct _plat_event_config *); ++extern void srf_ll_config(struct _plat_event_config *); ++extern int srf_offcore_num(void); ++ ++#ifdef __cplusplus ++} ++#endif ++ ++#endif /* _NUMATOP_INTEL_SRF_H */ +\ No newline at end of file +diff --git a/x86/include/types.h b/x86/include/types.h +index 814ef1c..4e3bea1 100644 +--- a/x86/include/types.h ++++ b/x86/include/types.h +@@ -49,12 +49,13 @@ typedef enum { + CPU_SPR, + CPU_EMR, + CPU_GNR, ++ CPU_SRF, + CPU_ZEN, + CPU_ZEN3, + CPU_ZEN4 + } cpu_type_t; + +-#define CPU_TYPE_NUM 17 ++#define CPU_TYPE_NUM 18 + + typedef enum { + PERF_COUNT_INVALID = -1, +diff --git a/x86/plat.c b/x86/plat.c +index 0eea408..557a8c9 100644 +--- a/x86/plat.c ++++ b/x86/plat.c +@@ -36,6 +36,7 @@ + #include "include/snb.h" + #include "include/bdw.h" + #include "include/skl.h" ++#include "include/srf.h" + #include "include/zen.h" + + pfn_plat_profiling_config_t +@@ -54,6 +55,7 @@ s_plat_profiling_config[CPU_TYPE_NUM] = { + spr_profiling_config, + spr_profiling_config, /* EMR */ + spr_profiling_config, /* GNR */ ++ srf_profiling_config, + zen_profiling_config, + zen3_profiling_config, + zen4_profiling_config +@@ -75,6 +77,7 @@ s_plat_ll_config[CPU_TYPE_NUM] = { + spr_ll_config, + spr_ll_config, /* EMR */ + spr_ll_config, /* GNR */ ++ srf_ll_config, + zen_ll_config, + zen_ll_config, + zen_ll_config +@@ -96,6 +99,7 @@ s_plat_offcore_num[CPU_TYPE_NUM] = { + spr_offcore_num, + spr_offcore_num, /* EMR */ + spr_offcore_num, /* GNR */ ++ srf_offcore_num, + zen_offcore_num, + zen_offcore_num, + zen_offcore_num +@@ -205,6 +209,9 @@ cpu_type_get(void) + case 173: + type = CPU_GNR; + break; ++ case 175: ++ type = CPU_SRF; ++ break; + } + } else if (family == 23) { /* Family 17h */ + type = CPU_ZEN; +@@ -259,6 +266,7 @@ plat_detect(void) + case CPU_SPR: + case CPU_EMR: + case CPU_GNR: ++ case CPU_SRF: + case CPU_ZEN: + case CPU_ZEN3: + case CPU_ZEN4: +diff --git a/x86/srf.c b/x86/srf.c +new file mode 100644 +index 0000000..790432e +--- /dev/null ++++ b/x86/srf.c +@@ -0,0 +1,70 @@ ++/* ++ * Copyright (c) 2024, Intel Corporation ++ * ++ * Redistribution and use in source and binary forms, with or without ++ * modification, are permitted provided that the following conditions are met: ++ * ++ * * Redistributions of source code must retain the above copyright notice, ++ * this list of conditions and the following disclaimer. ++ * * Redistributions in binary form must reproduce the above copyright ++ * notice, this list of conditions and the following disclaimer in the ++ * documentation and/or other materials provided with the distribution. ++ * * Neither the name of Intel Corporation nor the names of its contributors ++ * may be used to endorse or promote products derived from this software ++ * without specific prior written permission. ++ * ++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ++ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ++ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ++ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE ++ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ++ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ++ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE ++ * POSSIBILITY OF SUCH DAMAGE. ++ */ ++ ++/* This file contains the bdw platform specific functions. */ ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include "../common/include/os/linux/perf_event.h" ++#include "../common/include/os/plat.h" ++#include "include/srf.h" ++ ++static plat_event_config_t s_srf_config[PERF_COUNT_NUM] = { ++ { PERF_TYPE_HARDWARE, PERF_COUNT_HW_CPU_CYCLES, 0x53, 0, 0, 0, "cpu_clk_unhalted.core" }, ++ { PERF_TYPE_RAW, 0x01B7, 0x53, 0x730000001, 0, 0, "off_core_response_0" }, ++ { PERF_TYPE_HARDWARE, PERF_COUNT_HW_REF_CPU_CYCLES, 0x53, 0, 0, 0, "cpu_clk_unhalted.ref" }, ++ { PERF_TYPE_HARDWARE, PERF_COUNT_HW_INSTRUCTIONS, 0x53, 0, 0, 0, "instr_retired.any" }, ++ { PERF_TYPE_RAW, 0x02B7, 0x53, 0x184000001, 0, 0, "off_core_response_1" } ++}; ++ ++static plat_event_config_t s_srf_ll = { ++ PERF_TYPE_RAW, 0x05D0, 0x53, LL_THRESH, 0, 1, "mem_trans_retired.latency_above_threshold" ++}; ++ ++void ++srf_profiling_config(perf_count_id_t perf_count_id, plat_event_config_t *cfg) ++{ ++ plat_config_get(perf_count_id, cfg, s_srf_config); ++} ++ ++void ++srf_ll_config(plat_event_config_t *cfg) ++{ ++ memcpy(cfg, &s_srf_ll, sizeof (plat_event_config_t)); ++} ++ ++int ++srf_offcore_num(void) ++{ ++ return (2); ++} +\ No newline at end of file +-- +2.41.0 + diff --git a/numatop.spec b/numatop.spec index b7bc4e9..13ddb04 100644 --- a/numatop.spec +++ b/numatop.spec @@ -42,6 +42,11 @@ Patch29: 0029-common-use-mount-umount-system-calls-rather-than-usi.patch Patch30: 0030-common-remove-executing-commands-for-directory-and-f.patch Patch31: 0031-powerpc-util-fix-build-warning-cast-LHS-of-expressio.patch Patch32: 0032-common-os-map-Fix-overflow-warning.patch +Patch33: 0033-Move-all-curses-calls-into-display-threads.patch +Patch34: 0034-Avoid-race-on-submitting-display-commands.patch +Patch35: 0035-Remove-EMR-specific-events-configuration.patch +Patch36: 0036-Support-Intel-Granite-Rapids-platform.patch +Patch37: 0037-Support-Intel-Sierra-Forest-platform.patch BuildRequires: autoconf