backport bugfix patches from community

Signed-off-by: Lv Ying <lvying6@huawei.com>
This commit is contained in:
Lv Ying 2023-12-31 22:55:05 +08:00
parent 8aa29a9a70
commit ef66da8259
3 changed files with 108 additions and 0 deletions

View File

@ -0,0 +1,38 @@
From 5cf2386450f8a4837bcc68673f616732c38d13e0 Mon Sep 17 00:00:00 2001
From: Zeph / Liz Loss-Cutler-Hull <warp-spam_git@aehallh.com>
Date: Sun, 9 Jul 2023 04:57:19 -0700
Subject: [PATCH 2/2] Check CPUs online, not configured.
When the number of CPUs detected is greater than the number of CPUs in
the system, rasdaemon will crash when it receives some events.
Looking deeper, we also fail to use the poll method for similar reasons
in this case.
All of this can be prevented by checking to see how many CPUs are
currently online (sysconf(_SC_NPROCESSORS_ONLN)) instead of how many
CPUs the current kernel was configured to support
(sysconf(_SC_NPROCESSORS_CONF)).
For the kernel side of the discussion, see https://lore.kernel.org/lkml/CAM6Wdxft33zLeeXHhmNX5jyJtfGTLiwkQSApc=10fqf+rQh9DA@mail.gmail.com/T/
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
---
ras-events.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ras-events.c b/ras-events.c
index fc54325..4cf0ad1 100644
--- a/ras-events.c
+++ b/ras-events.c
@@ -353,7 +353,7 @@ static void parse_ras_data(struct pthread_data *pdata, struct kbuffer *kbuf,
static int get_num_cpus(struct ras_events *ras)
{
- return sysconf(_SC_NPROCESSORS_CONF);
+ return sysconf(_SC_NPROCESSORS_ONLN);
#if 0
char fname[MAX_PATH + 1];
int num_cpus = 0;
--
2.35.3

View File

@ -0,0 +1,62 @@
From 57e082edfe2651fc09035a7d9227be57ab9b8a06 Mon Sep 17 00:00:00 2001
From: Lv Ying <lvying6@huawei.com>
Date: Thu, 15 Dec 2022 21:01:59 +0800
Subject: [PATCH 1/2] rasdaemon/diskerror: fix incomplete diskerror log
Currently, rasdaemon output incomplete diskerror log(only contains timestamp):
<idle>-0 [000] 0.017915: block_rq_complete: 2022-12-16 04:17:32 +0800
Fix incomplete diskerror log just like block_rq_complete tracepoint output format:
<idle>-0 [042] d.h. 177962.715669: block_rq_complete: 21,0 N () 18446744073709551615 + 0 [-121]
---
ras-diskerror-handler.c | 22 ++++++++++++++--------
1 file changed, 14 insertions(+), 8 deletions(-)
diff --git a/ras-diskerror-handler.c b/ras-diskerror-handler.c
index b46f859..07805f7 100644
--- a/ras-diskerror-handler.c
+++ b/ras-diskerror-handler.c
@@ -97,26 +97,32 @@ int ras_diskerror_event_handler(struct trace_seq *s,
dev = (dev_t)val;
if (asprintf(&ev.dev, "%u:%u", major(dev), minor(dev)) < 0)
return -1;
+ trace_seq_printf(s, "%s ", ev.dev);
+
+ ev.rwbs = pevent_get_field_raw(s, event, "rwbs", record, &len, 1);
+ if (!ev.rwbs)
+ return -1;
+ trace_seq_printf(s, "%s ", ev.rwbs);
+
+ ev.cmd = pevent_get_field_raw(s, event, "cmd", record, &len, 1);
+ if (!ev.cmd)
+ return -1;
+ trace_seq_printf(s, "(%s) ", ev.cmd);
if (pevent_get_field_val(s, event, "sector", record, &val, 1) < 0)
return -1;
ev.sector = val;
+ trace_seq_printf(s, "%llu ", ev.sector);
if (pevent_get_field_val(s, event, "nr_sector", record, &val, 1) < 0)
return -1;
ev.nr_sector = (unsigned int)val;
+ trace_seq_printf(s, "+ %u ", ev.nr_sector);
if (pevent_get_field_val(s, event, "error", record, &val, 1) < 0)
return -1;
ev.error = get_blk_error((int)val);
-
- ev.rwbs = pevent_get_field_raw(s, event, "rwbs", record, &len, 1);
- if (!ev.rwbs)
- return -1;
-
- ev.cmd = pevent_get_field_raw(s, event, "cmd", record, &len, 1);
- if (!ev.cmd)
- return -1;
+ trace_seq_printf(s, "[%s]", ev.error);
/* Insert data into the SGBD */
#ifdef HAVE_SQLITE3
--
2.35.3

View File

@ -43,6 +43,8 @@ Patch9016: 0001-rasdaemon-fix-return-value-type-issue-of-read-write-.patch
Patch9017: 0002-rasdaemon-fix-issue-of-signed-and-unsigned-integer-c.patch Patch9017: 0002-rasdaemon-fix-issue-of-signed-and-unsigned-integer-c.patch
Patch9018: 0003-rasdaemon-Add-support-for-creating-the-vendor-error-.patch Patch9018: 0003-rasdaemon-Add-support-for-creating-the-vendor-error-.patch
Patch9019: 0004-rasdaemon-Add-four-modules-supported-by-HiSilicon-co.patch Patch9019: 0004-rasdaemon-Add-four-modules-supported-by-HiSilicon-co.patch
Patch9020: backport-Check-CPUs-online-not-configured.patch
Patch9021: backport-rasdaemon-diskerror-fix-incomplete-diskerror-log.patch
%description %description
The rasdaemon program is a daemon which monitors the platform The rasdaemon program is a daemon which monitors the platform
@ -94,6 +96,12 @@ fi
/usr/bin/systemctl disable rasdaemon.service >/dev/null 2>&1 || : /usr/bin/systemctl disable rasdaemon.service >/dev/null 2>&1 || :
%changelog %changelog
* Sun Dec 31 2023 Lv Ying <lvying6@huawei.com> - 0.6.8-7
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:backport bugfix patches from community
* Fri Dec 01 2023 renhongxun <renhongxun@h-partners.com> - 0.6.8-6 * Fri Dec 01 2023 renhongxun <renhongxun@h-partners.com> - 0.6.8-6
- Type:bugfix - Type:bugfix
- ID:NA - ID:NA