rasdaemon/0002-rasdaemon-Fix-the-issue-of-command-option-r-for-hip0.patch

73 lines
2.4 KiB
Diff
Raw Normal View History

From 6af26231fd58be578ea7d2ceb009fddf14c386a7 Mon Sep 17 00:00:00 2001
From: Xiaofei Tan <tanxiaofei@huawei.com>
Date: Mon, 1 Feb 2021 19:09:59 +0800
Subject: [PATCH 2/4] rasdaemon: Fix the issue of command option -r for hip08
It will record event even the option -r is not provided for hip08.
It is not right, and fix it.
Signed-off-by: Xiaofei Tan <tanxiaofei@huawei.com>
---
non-standard-hisi_hip08.c | 6 +++---
non-standard-hisilicon.c | 6 ++++++
2 files changed, 9 insertions(+), 3 deletions(-)
diff --git a/non-standard-hisi_hip08.c b/non-standard-hisi_hip08.c
index ebf03e1..9092183 100644
--- a/non-standard-hisi_hip08.c
+++ b/non-standard-hisi_hip08.c
@@ -670,7 +670,7 @@ static int decode_hip08_oem_type1_error(struct ras_events *ras,
}
#ifdef HAVE_SQLITE3
- if (!ev_decoder->stmt_dec_record) {
+ if (ras->record_events && !ev_decoder->stmt_dec_record) {
if (ras_mc_add_vendor_table(ras, &ev_decoder->stmt_dec_record,
&hip08_oem_type1_event_tab)
!= SQLITE_OK) {
@@ -842,7 +842,7 @@ static int decode_hip08_oem_type2_error(struct ras_events *ras,
}
#ifdef HAVE_SQLITE3
- if (!ev_decoder->stmt_dec_record) {
+ if (ras->record_events && !ev_decoder->stmt_dec_record) {
if (ras_mc_add_vendor_table(ras, &ev_decoder->stmt_dec_record,
&hip08_oem_type2_event_tab) != SQLITE_OK) {
trace_seq_printf(s,
@@ -992,7 +992,7 @@ static int decode_hip08_pcie_local_error(struct ras_events *ras,
}
#ifdef HAVE_SQLITE3
- if (!ev_decoder->stmt_dec_record) {
+ if (ras->record_events && !ev_decoder->stmt_dec_record) {
if (ras_mc_add_vendor_table(ras, &ev_decoder->stmt_dec_record,
&hip08_pcie_local_event_tab) != SQLITE_OK) {
trace_seq_printf(s,
diff --git a/non-standard-hisilicon.c b/non-standard-hisilicon.c
index a6f5e78..3fccff6 100644
--- a/non-standard-hisilicon.c
+++ b/non-standard-hisilicon.c
@@ -77,6 +77,9 @@ void record_vendor_data(struct ras_ns_ev_decoder *ev_decoder,
enum hisi_oem_data_type data_type,
int id, int64_t data, const char *text)
{
+ if (ev_decoder->stmt_dec_record == NULL)
+ return;
+
switch (data_type) {
case HISI_OEM_DATA_TYPE_INT:
sqlite3_bind_int(ev_decoder->stmt_dec_record, id, data);
@@ -94,6 +97,9 @@ int step_vendor_data_tab(struct ras_ns_ev_decoder *ev_decoder, const char *name)
{
int rc;
+ if (ev_decoder->stmt_dec_record == NULL)
+ return 0;
+
rc = sqlite3_step(ev_decoder->stmt_dec_record);
if (rc != SQLITE_OK && rc != SQLITE_DONE)
log(TERM, LOG_ERR,
--
2.33.0