hbm_online_repair: add unload driver
This commit is contained in:
parent
f6ed71cb93
commit
fb8ec10677
107
hbm_online_repair-add-unload-driver.patch
Normal file
107
hbm_online_repair-add-unload-driver.patch
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
From 74f18b0e1fd4f99fa7d1d95e08894b408dcafe51 Mon Sep 17 00:00:00 2001
|
||||||
|
From: luckky <guodashun1@huawei.com>
|
||||||
|
Date: Wed, 18 Dec 2024 14:31:04 +0800
|
||||||
|
Subject: [PATCH] hbm_online_repair add unload driver
|
||||||
|
|
||||||
|
---
|
||||||
|
src/c/hbm_online_repair/hbm_online_repair.c | 47 +++++++++++++--------
|
||||||
|
1 file changed, 29 insertions(+), 18 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/c/hbm_online_repair/hbm_online_repair.c b/src/c/hbm_online_repair/hbm_online_repair.c
|
||||||
|
index 00c9c0b..6783485 100644
|
||||||
|
--- a/src/c/hbm_online_repair/hbm_online_repair.c
|
||||||
|
+++ b/src/c/hbm_online_repair/hbm_online_repair.c
|
||||||
|
@@ -11,6 +11,8 @@
|
||||||
|
#define DEFAULT_LOG_LEVEL LOG_INFO
|
||||||
|
#define DEFAULT_PAGE_ISOLATION_THRESHOLD 3355443
|
||||||
|
|
||||||
|
+#define DRIVER_COMMAND_LEN 32
|
||||||
|
+
|
||||||
|
int global_level_setting;
|
||||||
|
int page_isolation_threshold;
|
||||||
|
|
||||||
|
@@ -57,25 +59,31 @@ int execute_command(const char *command)
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
- ret = WEXITSTATUS(ret);
|
||||||
|
+ ret = -WEXITSTATUS(ret);
|
||||||
|
log(LOG_DEBUG, "command %s exited with status: %d\n", command, ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
-int load_required_driver(void)
|
||||||
|
+int handle_driver(char* driver_name, bool load)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
- ret = execute_command("modprobe hisi_mem_ras 2>&1");
|
||||||
|
- if (ret < 0) {
|
||||||
|
- log(LOG_ERROR, "load repair driver failed\n");
|
||||||
|
- return ret;
|
||||||
|
- }
|
||||||
|
- ret = execute_command("modprobe page_eject 2>&1");
|
||||||
|
- if (ret < 0) {
|
||||||
|
- log(LOG_ERROR, "load page driver failed\n");
|
||||||
|
+ char command[DRIVER_COMMAND_LEN];
|
||||||
|
+
|
||||||
|
+ snprintf(command, DRIVER_COMMAND_LEN, "%s %s 2>&1", load ? "modprobe" : "rmmod", driver_name);
|
||||||
|
+ ret = execute_command(command);
|
||||||
|
+ log(ret < 0 ? LOG_ERROR : LOG_DEBUG, "%s %s %s\n", load ? "load" : "unload", driver_name, ret < 0 ? "failed" : "success");
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int handle_all_drivers(bool load)
|
||||||
|
+{
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = handle_driver("hisi_mem_ras", load);
|
||||||
|
+ if (ret < 0)
|
||||||
|
return ret;
|
||||||
|
- }
|
||||||
|
- log(LOG_INFO, "load required driver success\n");
|
||||||
|
+
|
||||||
|
+ ret = handle_driver("page_eject", load);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -116,21 +124,21 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
|
hbm_param_init();
|
||||||
|
|
||||||
|
- ret = load_required_driver();
|
||||||
|
+ ret = handle_all_drivers(true);
|
||||||
|
if (ret < 0) {
|
||||||
|
- log(LOG_DEBUG, "load required driver failed\n");
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct ras_events *ras = init_trace_instance();
|
||||||
|
- if (!ras)
|
||||||
|
- return -1;
|
||||||
|
+ if (!ras) {
|
||||||
|
+ ret = -1;
|
||||||
|
+ goto err_unload;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
ret = toggle_ras_event(ras->tracing, "ras", "non_standard_event", 1);
|
||||||
|
if (ret < 0) {
|
||||||
|
log(LOG_WARNING, "unable to enable ras non_standard_event.\n");
|
||||||
|
- free(ras);
|
||||||
|
- return -1;
|
||||||
|
+ goto err_free;
|
||||||
|
}
|
||||||
|
|
||||||
|
get_flash_total_size();
|
||||||
|
@@ -142,6 +150,9 @@ int main(int argc, char *argv[])
|
||||||
|
log(LOG_WARNING, "unable to disable ras non_standard_event.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
+err_free:
|
||||||
|
free(ras);
|
||||||
|
+err_unload:
|
||||||
|
+ handle_all_drivers(false);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.43.0
|
||||||
|
|
||||||
@ -4,7 +4,7 @@
|
|||||||
Summary: System Inspection Framework
|
Summary: System Inspection Framework
|
||||||
Name: sysSentry
|
Name: sysSentry
|
||||||
Version: 1.0.2
|
Version: 1.0.2
|
||||||
Release: 65
|
Release: 66
|
||||||
License: Mulan PSL v2
|
License: Mulan PSL v2
|
||||||
Group: System Environment/Daemons
|
Group: System Environment/Daemons
|
||||||
Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz
|
Source0: https://gitee.com/openeuler/sysSentry/releases/download/v%{version}/%{name}-%{version}.tar.gz
|
||||||
@ -87,6 +87,7 @@ Patch74: add-boundary-check-for-settings.patch
|
|||||||
Patch75: change-status-of-period-task-and-sort-mod-file.patch
|
Patch75: change-status-of-period-task-and-sort-mod-file.patch
|
||||||
Patch76: uniform-avg_block_io-log-and-ai_block_io-log.patch
|
Patch76: uniform-avg_block_io-log-and-ai_block_io-log.patch
|
||||||
Patch77: set-logrotate.patch
|
Patch77: set-logrotate.patch
|
||||||
|
Patch78: hbm_online_repair-add-unload-driver.patch
|
||||||
|
|
||||||
BuildRequires: cmake gcc-c++
|
BuildRequires: cmake gcc-c++
|
||||||
BuildRequires: python3 python3-setuptools
|
BuildRequires: python3 python3-setuptools
|
||||||
@ -392,6 +393,12 @@ rm -rf %{buildroot}
|
|||||||
%attr(0550,root,root) %{python3_sitelib}/syssentry/bmc_alarm.py
|
%attr(0550,root,root) %{python3_sitelib}/syssentry/bmc_alarm.py
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Dec 18 2024 luckky <guodashun1@huawei.com> - 1.0.2-66
|
||||||
|
- Type:bugfix
|
||||||
|
- CVE:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC: add boundary check for settings
|
||||||
|
|
||||||
* Wed Dec 18 2024 shixuantong <shixuantong@huawei.com> - 1.0.2-65
|
* Wed Dec 18 2024 shixuantong <shixuantong@huawei.com> - 1.0.2-65
|
||||||
- Type:enhancement
|
- Type:enhancement
|
||||||
- CVE:NA
|
- CVE:NA
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user