]> www.infradead.org Git - users/mchehab/rasdaemon.git/commitdiff
rasdaemon: CXL: Extract, log and record region info from cxl_general_media and cxl_dr...
authorShiju Jose <shiju.jose@huawei.com>
Wed, 15 May 2024 11:18:36 +0000 (12:18 +0100)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Mon, 18 Nov 2024 12:32:52 +0000 (13:32 +0100)
Add extract, log and record region info to cxl_general_media and
cxl_dram events.

The corresponding kernel changes:
https://lore.kernel.org/all/cover.1711598777.git.alison.schofield@intel.com/T/#m6fd773b5477fc44b875848e053708a1c8996c4e4

Signed-off-by: Shiju Jose <shiju.jose@huawei.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
ras-cxl-handler.c
ras-record.c
ras-record.h
ras-report.c

index 8641e387115f4bee0f7d6b4768dd1f7cfc4e3db9..67ce32e201b280562c0f7649cf990269faa6912c 100644 (file)
@@ -811,6 +811,26 @@ int ras_cxl_general_media_event_handler(struct trace_seq *s,
                                              ev.transaction_type)) <= 0)
                return -1;
 
+       if (tep_get_field_val(s, event, "hpa", record, &val, 1) < 0)
+               return -1;
+       ev.hpa = val;
+       if (trace_seq_printf(s, "hpa:0x%llx ", (unsigned long long)ev.hpa) <= 0)
+               return -1;
+
+       ev.region = tep_get_field_raw(s, event, "region_name", record, &len, 1);
+       if (!ev.region)
+               return -1;
+       if (trace_seq_printf(s, "region:%s ", ev.region) <= 0)
+               return -1;
+
+       ev.region_uuid = tep_get_field_raw(s, event, "region_uuid",
+                                          record, &len, 1);
+       if (!ev.region_uuid)
+               return -1;
+       ev.region_uuid = uuid_be(ev.region_uuid);
+       if (trace_seq_printf(s, "region_uuid:%s ", ev.region_uuid) <= 0)
+               return -1;
+
        if (tep_get_field_val(s,  event, "validity_flags", record, &val, 1) < 0)
                return -1;
        ev.validity_flags = val;
@@ -933,6 +953,26 @@ int ras_cxl_dram_event_handler(struct trace_seq *s,
                                              ev.transaction_type)) <= 0)
                return -1;
 
+       if (tep_get_field_val(s, event, "hpa", record, &val, 1) < 0)
+               return -1;
+       ev.hpa = val;
+       if (trace_seq_printf(s, "hpa:0x%llx ", (unsigned long long)ev.hpa) <= 0)
+               return -1;
+
+       ev.region = tep_get_field_raw(s, event, "region", record, &len, 1);
+       if (!ev.region)
+               return -1;
+       if (trace_seq_printf(s, "region:%s ", ev.region) <= 0)
+               return -1;
+
+       ev.region_uuid = tep_get_field_raw(s, event, "region_uuid",
+                                          record, &len, 1);
+       if (!ev.region_uuid)
+               return -1;
+       ev.region_uuid = uuid_be(ev.region_uuid);
+       if (trace_seq_printf(s, "region_uuid:%s ", ev.region_uuid) <= 0)
+               return -1;
+
        if (tep_get_field_val(s,  event, "validity_flags", record, &val, 1) < 0)
                return -1;
        ev.validity_flags = val;
index 672bd57412a13b59f3e01ec12062eea6a1a8ba07..b4a1abd7d0f147704522e592650b76593e394d33 100644 (file)
@@ -877,6 +877,9 @@ static const struct db_fields cxl_general_media_event_fields[] = {
        { .name = "rank",               .type = "INTEGER" },
        { .name = "device",             .type = "INTEGER" },
        { .name = "comp_id",            .type = "BLOB" },
+       { .name = "hpa",                .type = "INTEGER" },
+       { .name = "region",             .type = "TEXT" },
+       { .name = "region_uuid",        .type = "TEXT" },
 };
 
 static const struct db_table_descriptor cxl_general_media_event_tab = {
@@ -907,6 +910,9 @@ int ras_store_cxl_general_media_event(struct ras_events *ras,
        sqlite3_bind_int(priv->stmt_cxl_general_media_event, 20, ev->device);
        sqlite3_bind_blob(priv->stmt_cxl_general_media_event, 21, ev->comp_id,
                          CXL_EVENT_GEN_MED_COMP_ID_SIZE, NULL);
+       sqlite3_bind_int64(priv->stmt_cxl_general_media_event, 22, ev->hpa);
+       sqlite3_bind_text(priv->stmt_cxl_general_media_event, 23, ev->region, -1, NULL);
+       sqlite3_bind_text(priv->stmt_cxl_general_media_event, 24, ev->region_uuid, -1, NULL);
 
        rc = sqlite3_step(priv->stmt_cxl_general_media_event);
        if (rc != SQLITE_OK && rc != SQLITE_DONE)
@@ -951,6 +957,9 @@ static const struct db_fields cxl_dram_event_fields[] = {
        { .name = "row",                .type = "INTEGER" },
        { .name = "column",             .type = "INTEGER" },
        { .name = "cor_mask",           .type = "BLOB" },
+       { .name = "hpa",                .type = "INTEGER" },
+       { .name = "region",             .type = "TEXT" },
+       { .name = "region_uuid",        .type = "TEXT" },
 };
 
 static const struct db_table_descriptor cxl_dram_event_tab = {
@@ -984,6 +993,9 @@ int ras_store_cxl_dram_event(struct ras_events *ras, struct ras_cxl_dram_event *
        sqlite3_bind_int(priv->stmt_cxl_dram_event, 24, ev->column);
        sqlite3_bind_blob(priv->stmt_cxl_dram_event, 25, ev->cor_mask,
                          CXL_EVENT_DER_CORRECTION_MASK_SIZE, NULL);
+       sqlite3_bind_int64(priv->stmt_cxl_dram_event, 26, ev->hpa);
+       sqlite3_bind_text(priv->stmt_cxl_dram_event, 27, ev->region, -1, NULL);
+       sqlite3_bind_text(priv->stmt_cxl_dram_event, 28, ev->region_uuid, -1, NULL);
 
        rc = sqlite3_step(priv->stmt_cxl_dram_event);
        if (rc != SQLITE_OK && rc != SQLITE_DONE)
index bd861ff268c3d6cce1dffae84fabf56043c136c0..cd549a1a28e7a820e165daa83e2bfea04ebf4380 100644 (file)
@@ -198,6 +198,9 @@ struct ras_cxl_general_media_event {
        uint32_t device;
        uint8_t *comp_id;
        uint16_t validity_flags;
+       uint64_t hpa;
+       const char *region;
+       const char *region_uuid;
 };
 
 struct ras_cxl_dram_event {
@@ -216,6 +219,9 @@ struct ras_cxl_dram_event {
        uint16_t column;
        uint8_t *cor_mask;
        uint16_t validity_flags;
+       uint64_t hpa;
+       const char *region;
+       const char *region_uuid;
 };
 
 struct ras_cxl_memory_module_event {
index 91f129dc5694ad14e37818f3c2713618d11a46e8..bc77d045885d4b98dc28822e43f2724bb726d52e 100644 (file)
@@ -554,6 +554,9 @@ static int set_cxl_general_media_event_backtrace(char *buf, struct ras_cxl_gener
                "descriptor=%u\n"
                "type=%u\n"
                "transaction_type=%u\n"
+               "hpa=0x%lx\n"
+               "region=%s\n"
+               "region_uuid=%s\n"
                "channel=%u\n"
                "rank=%u\n"
                "device=0x%x\n",
@@ -574,6 +577,9 @@ static int set_cxl_general_media_event_backtrace(char *buf, struct ras_cxl_gener
                ev->descriptor,
                ev->type,
                ev->transaction_type,
+               ev->hpa,
+               ev->region,
+               ev->region_uuid,
                ev->channel,
                ev->rank,
                ev->device);
@@ -611,6 +617,9 @@ static int set_cxl_dram_event_backtrace(char *buf, struct ras_cxl_dram_event *ev
                "descriptor=%u\n"
                "type=%u\n"
                "transaction_type=%u\n"
+               "hpa=0x%lx\n"
+               "region=%s\n"
+               "region_uuid=%s\n"
                "channel=%u\n"
                "rank=%u\n"
                "nibble_mask=%u\n"
@@ -635,6 +644,9 @@ static int set_cxl_dram_event_backtrace(char *buf, struct ras_cxl_dram_event *ev
                ev->descriptor,
                ev->type,
                ev->transaction_type,
+               ev->hpa,
+               ev->region,
+               ev->region_uuid,
                ev->channel,
                ev->rank,
                ev->nibble_mask,