From patchwork Wed Oct 20 06:33:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaofei Tan X-Patchwork-Id: 12571675 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F18C3C433F5 for ; Wed, 20 Oct 2021 06:38:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C1945610A2 for ; Wed, 20 Oct 2021 06:38:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229591AbhJTGkr (ORCPT ); Wed, 20 Oct 2021 02:40:47 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:14833 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229741AbhJTGkq (ORCPT ); Wed, 20 Oct 2021 02:40:46 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4HZ15p3v3Nz90Ct; Wed, 20 Oct 2021 14:33:34 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Wed, 20 Oct 2021 14:38:30 +0800 Received: from localhost.localdomain (10.67.165.24) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Wed, 20 Oct 2021 14:38:30 +0800 From: Xiaofei Tan To: , CC: , , , Xiaofei Tan Subject: [PATCH 1/4] rasdaemon: Fix the issue of sprintf data type mismatch in uuid_le() Date: Wed, 20 Oct 2021 14:33:37 +0800 Message-ID: <20211020063340.26079-2-tanxiaofei@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211020063340.26079-1-tanxiaofei@huawei.com> References: <20211020063340.26079-1-tanxiaofei@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org The data type of sprintf called in the function uuid_le() is mismatch. Arm64 compiler force it to unsigned char by default, and can work normally. But if someone compile it with the option -fsigned-char, the function can't work correctly. Signed-off-by: Xiaofei Tan --- ras-extlog-handler.c | 2 +- ras-non-standard-handler.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ras-extlog-handler.c b/ras-extlog-handler.c index 5fd3580..1834687 100644 --- a/ras-extlog-handler.c +++ b/ras-extlog-handler.c @@ -152,7 +152,7 @@ static char *uuid_le(const char *uu) static const unsigned char le[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15}; for (i = 0; i < 16; i++) { - p += sprintf(p, "%.2x", uu[le[i]]); + p += sprintf(p, "%.2x", (unsigned char) uu[le[i]]); switch (i) { case 3: case 5: diff --git a/ras-non-standard-handler.c b/ras-non-standard-handler.c index 6ccf5bc..6d5a6f8 100644 --- a/ras-non-standard-handler.c +++ b/ras-non-standard-handler.c @@ -36,7 +36,7 @@ static char *uuid_le(const char *uu) static const unsigned char le[16] = {3,2,1,0,5,4,7,6,8,9,10,11,12,13,14,15}; for (i = 0; i < 16; i++) { - p += sprintf(p, "%.2x", uu[le[i]]); + p += sprintf(p, "%.2x", (unsigned char) uu[le[i]]); switch (i) { case 3: case 5: @@ -61,7 +61,7 @@ static int uuid_le_cmp(const char *sec_type, const char *uuid2) 3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15}; for (i = 0; i < 16; i++) - p += sprintf(p, "%.2x", sec_type[le[i]]); + p += sprintf(p, "%.2x", (unsigned char) sec_type[le[i]]); *p = 0; return strncmp(uuid1, uuid2, 32); } From patchwork Wed Oct 20 06:33:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaofei Tan X-Patchwork-Id: 12571677 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E842C433FE for ; Wed, 20 Oct 2021 06:38:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0C2A260F56 for ; Wed, 20 Oct 2021 06:38:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229741AbhJTGkr (ORCPT ); Wed, 20 Oct 2021 02:40:47 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:25300 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229771AbhJTGkq (ORCPT ); Wed, 20 Oct 2021 02:40:46 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4HZ16F18t2zbhGY; Wed, 20 Oct 2021 14:33:57 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Wed, 20 Oct 2021 14:38:30 +0800 Received: from localhost.localdomain (10.67.165.24) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Wed, 20 Oct 2021 14:38:30 +0800 From: Xiaofei Tan To: , CC: , , , Xiaofei Tan Subject: [PATCH 2/4] rasdaemon: Fix the issue of command option -r for hip08 Date: Wed, 20 Oct 2021 14:33:38 +0800 Message-ID: <20211020063340.26079-3-tanxiaofei@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211020063340.26079-1-tanxiaofei@huawei.com> References: <20211020063340.26079-1-tanxiaofei@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org 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 --- 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, From patchwork Wed Oct 20 06:33:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaofei Tan X-Patchwork-Id: 12571681 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 247A7C433FE for ; Wed, 20 Oct 2021 06:38:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 035E6611F2 for ; Wed, 20 Oct 2021 06:38:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229691AbhJTGlD (ORCPT ); Wed, 20 Oct 2021 02:41:03 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:25301 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229771AbhJTGk5 (ORCPT ); Wed, 20 Oct 2021 02:40:57 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4HZ16S6mW8zbhGZ; Wed, 20 Oct 2021 14:34:08 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Wed, 20 Oct 2021 14:38:30 +0800 Received: from localhost.localdomain (10.67.165.24) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Wed, 20 Oct 2021 14:38:30 +0800 From: Xiaofei Tan To: , CC: , , , Xiaofei Tan Subject: [PATCH 3/4] rasdaemon: Fix some print format issues for hisi common error section Date: Wed, 20 Oct 2021 14:33:39 +0800 Message-ID: <20211020063340.26079-4-tanxiaofei@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211020063340.26079-1-tanxiaofei@huawei.com> References: <20211020063340.26079-1-tanxiaofei@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org It is not right to use '%d' to print uint8_t and uint16_t, although there is no function issue. Change to use '%hhu' and '%hu' separately. Signed-off-by: Xiaofei Tan --- non-standard-hisilicon.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/non-standard-hisilicon.c b/non-standard-hisilicon.c index 3fccff6..f9c7bd4 100644 --- a/non-standard-hisilicon.c +++ b/non-standard-hisilicon.c @@ -198,7 +198,7 @@ static const char* get_soc_desc(uint8_t soc_id) static void decode_module(struct hisi_event *event, uint8_t module_id) { if (module_id >= sizeof(module_name)/sizeof(char *)) - HISI_SNPRINTF(event->error_msg, "module=unknown(id=%d) ", module_id); + HISI_SNPRINTF(event->error_msg, "module=unknown(id=%hhu) ", module_id); else HISI_SNPRINTF(event->error_msg, "module=%s ", module_name[module_id]); } @@ -207,36 +207,36 @@ static void decode_hisi_common_section_hdr(struct ras_ns_ev_decoder *ev_decoder, const struct hisi_common_error_section *err, struct hisi_event *event) { - HISI_SNPRINTF(event->error_msg, "[ table_version=%d", err->version); + HISI_SNPRINTF(event->error_msg, "[ table_version=%hhu", err->version); if (err->val_bits & BIT(HISI_COMMON_VALID_SOC_ID)) HISI_SNPRINTF(event->error_msg, "soc=%s", get_soc_desc(err->soc_id)); if (err->val_bits & BIT(HISI_COMMON_VALID_SOCKET_ID)) - HISI_SNPRINTF(event->error_msg, "socket_id=%d", err->socket_id); + HISI_SNPRINTF(event->error_msg, "socket_id=%hhu", err->socket_id); if (err->val_bits & BIT(HISI_COMMON_VALID_TOTEM_ID)) - HISI_SNPRINTF(event->error_msg, "totem_id=%d", err->totem_id); + HISI_SNPRINTF(event->error_msg, "totem_id=%hhu", err->totem_id); if (err->val_bits & BIT(HISI_COMMON_VALID_NIMBUS_ID)) - HISI_SNPRINTF(event->error_msg, "nimbus_id=%d", err->nimbus_id); + HISI_SNPRINTF(event->error_msg, "nimbus_id=%hhu", err->nimbus_id); if (err->val_bits & BIT(HISI_COMMON_VALID_SUBSYSTEM_ID)) - HISI_SNPRINTF(event->error_msg, "subsystem_id=%d", err->subsystem_id); + HISI_SNPRINTF(event->error_msg, "subsystem_id=%hhu", err->subsystem_id); if (err->val_bits & BIT(HISI_COMMON_VALID_MODULE_ID)) decode_module(event, err->module_id); if (err->val_bits & BIT(HISI_COMMON_VALID_SUBMODULE_ID)) - HISI_SNPRINTF(event->error_msg, "submodule_id=%d", err->submodule_id); + HISI_SNPRINTF(event->error_msg, "submodule_id=%hhu", err->submodule_id); if (err->val_bits & BIT(HISI_COMMON_VALID_CORE_ID)) - HISI_SNPRINTF(event->error_msg, "core_id=%d", err->core_id); + HISI_SNPRINTF(event->error_msg, "core_id=%hhu", err->core_id); if (err->val_bits & BIT(HISI_COMMON_VALID_PORT_ID)) - HISI_SNPRINTF(event->error_msg, "port_id=%d", err->port_id); + HISI_SNPRINTF(event->error_msg, "port_id=%hhu", err->port_id); if (err->val_bits & BIT(HISI_COMMON_VALID_ERR_TYPE)) - HISI_SNPRINTF(event->error_msg, "err_type=%d", err->err_type); + HISI_SNPRINTF(event->error_msg, "err_type=%hu", err->err_type); if (err->val_bits & BIT(HISI_COMMON_VALID_PCIE_INFO)) HISI_SNPRINTF(event->error_msg, "pcie_device_id=%04x:%02x:%02x.%x", From patchwork Wed Oct 20 06:33:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaofei Tan X-Patchwork-Id: 12571679 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77BB8C433EF for ; Wed, 20 Oct 2021 06:38:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5DB6A610A3 for ; Wed, 20 Oct 2021 06:38:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229809AbhJTGlD (ORCPT ); Wed, 20 Oct 2021 02:41:03 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:25302 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229691AbhJTGk5 (ORCPT ); Wed, 20 Oct 2021 02:40:57 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4HZ16S6z9gzbhGc; Wed, 20 Oct 2021 14:34:08 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Wed, 20 Oct 2021 14:38:30 +0800 Received: from localhost.localdomain (10.67.165.24) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Wed, 20 Oct 2021 14:38:30 +0800 From: Xiaofei Tan To: , CC: , , , Xiaofei Tan Subject: [PATCH 4/4] rasdaemon: Add some modules supported by hisi common error section Date: Wed, 20 Oct 2021 14:33:40 +0800 Message-ID: <20211020063340.26079-5-tanxiaofei@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211020063340.26079-1-tanxiaofei@huawei.com> References: <20211020063340.26079-1-tanxiaofei@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org Add some modules supported by hisi common error section. Besides, HHA is the module for some old platform, and it takes the same place of MATA, so remove it. Signed-off-by: Xiaofei Tan --- non-standard-hisilicon.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/non-standard-hisilicon.c b/non-standard-hisilicon.c index f9c7bd4..1432163 100644 --- a/non-standard-hisilicon.c +++ b/non-standard-hisilicon.c @@ -184,7 +184,11 @@ static const char* module_name[] = { "SEC", "RDE", "MEE", - "HHA", + "L4D", + "Tsensor", + "ROH", + "BTC", + "HILINK" }; static const char* get_soc_desc(uint8_t soc_id)