From de21f9abaa1707d51a8294fa1ffd72927ff20f66 Mon Sep 17 00:00:00 2001 From: Lostwayzxc Date: Wed, 1 Sep 2021 09:23:38 +0800 Subject: [PATCH] modify cpu parse for adpating to new bios version fix --- ...rse-for-adapting-to-new-bios-version.patch | 60 +++++++++++++++++++ rasdaemon.spec | 7 ++- 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 0008-modify-cpu-parse-for-adapting-to-new-bios-version.patch diff --git a/0008-modify-cpu-parse-for-adapting-to-new-bios-version.patch b/0008-modify-cpu-parse-for-adapting-to-new-bios-version.patch new file mode 100644 index 0000000..38ef9ac --- /dev/null +++ b/0008-modify-cpu-parse-for-adapting-to-new-bios-version.patch @@ -0,0 +1,60 @@ +From 6b767a2fce615384f062ecb392cd332452bf4482 Mon Sep 17 00:00:00 2001 +From: Lostwayzxc +Date: Wed, 1 Sep 2021 21:00:16 +0800 +Subject: [PATCH] modify cpu parse for adapting to new bios version + +--- + ras-cpu-isolation.c | 20 ++++++++++++++++++-- + 1 file changed, 18 insertions(+), 2 deletions(-) + +diff --git a/ras-cpu-isolation.c b/ras-cpu-isolation.c +index 6dcff70..b1643c4 100644 +--- a/ras-cpu-isolation.c ++++ b/ras-cpu-isolation.c +@@ -25,6 +25,7 @@ + + static struct cpu_info *cpu_infos = NULL; + static unsigned int ncores, cores_per_socket, cores_per_die; ++static unsigned int cores_per_cluster = 4; + static unsigned int sockets, dies = 1; + static unsigned int enabled = 1; + static const char *cpu_path_format = "/sys/devices/system/cpu/cpu%d/online"; +@@ -432,18 +433,33 @@ static unsigned long get_bit_value(int64_t value, unsigned offset, unsigned size + + static unsigned get_cpu_index(int64_t mpidr) + { +- unsigned core_id, socket_id, die_id, cpu; ++ unsigned core_id, cluster_id, socket_id, die_id, cpu; + /* + * Adapt to certain BIOS + * In the MPIDR: + * bit 8:15: core id ++ * bit 16:18: cluster id + * bit 19:20: die_id + * bit 21:22: socket_id + */ + core_id = get_bit_value(mpidr, 8, 8); ++ cluster_id = get_bit_value(mpidr, 16, 3); + socket_id = get_bit_value(mpidr, 21, 2); + die_id = get_bit_value(mpidr, 19, 2); +- cpu = core_id + socket_id * cores_per_socket + die_id * cores_per_die; ++ ++ /* When die id parsed from MPIDR is 1, it means TotemA, and when it's 3, ++ * it means TotemB. When cores per die equal to cores per socket, it means ++ * that there is only one die in the socket, in case that the only die is ++ * TotemB in CPU 1620s, we set die id to 0 directly. ++ */ ++ if (cores_per_die == cores_per_socket) { ++ die_id = 0; ++ } ++ else { ++ die_id = (die_id == 1 ? 0:1); ++ } ++ cpu = core_id + socket_id * cores_per_socket + die_id * cores_per_die + ++ cluster_id * cores_per_cluster; + + return cpu; + } +-- +2.27.0 + diff --git a/rasdaemon.spec b/rasdaemon.spec index ed3350a..54f8194 100644 --- a/rasdaemon.spec +++ b/rasdaemon.spec @@ -1,6 +1,6 @@ Name: rasdaemon Version: 0.6.6 -Release: 7 +Release: 8 License: GPLv2 Summary: Utility to get Platform Reliability, Availability and Serviceability (RAS) reports via the Kernel tracing events URL: https://github.com/mchehab/rasdaemon.git @@ -26,6 +26,7 @@ Patch4: bugfix-fix-disk-error-log-storm.patch Patch5: backport-rasdaemon-Fix-error-print.patch Patch6: 0006-add-cpu-online-fault-isolation.patch Patch7: 0007-add-trace-print-and-add-sqlite-store.patch +Patch8: 0008-modify-cpu-parse-for-adapting-to-new-bios-version.patch %description The rasdaemon program is a daemon which monitors the platform @@ -72,6 +73,10 @@ rm INSTALL %{buildroot}/usr/include/*.h /usr/bin/systemctl enable rasdaemon.service >/dev/null 2>&1 || : %changelog +* Sat Aug 28 2021 luoshengwei - 0.6.6-8 +- Since the bios changed the format of mpidr, we modify the way parsing mpidr +- accordingly. + * Mon Jul 12 2021 luoshengwei - 0.6.6-7 - Set the threshold limit of CE isolated algorithom to 10000/30D, since the - original limit 50/3D was too small. And set the threshold limit of offlined -- Gitee