]> www.infradead.org Git - users/mchehab/rasdaemon.git/commitdiff
mce: Some improvements at the output format
authorMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 24 May 2013 14:21:32 +0000 (11:21 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 24 May 2013 14:43:14 +0000 (11:43 -0300)
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
mce-intel.c
ras-mce-handler.c
ras-mce-handler.h

index 545745cd136fc8393f13aaa7e559853ef8b171da..34ef709af26d62c201963bfb36bb49d9072ecb6a 100644 (file)
@@ -125,7 +125,8 @@ static const char *arstate[4] = {
 };
 
 static char *mmm_mnemonic[] = {
-       "GEN", "RD", "WR", "AC", "MS", "RES5", "RES6", "RES7"
+       "GEN", "RD",   "WR",   "AC",
+       "MS",  "RES5", "RES6", "RES7"
 };
 
 static char *mmm_desc[] = {
@@ -142,14 +143,15 @@ static char *mmm_desc[] = {
 static void decode_memory_controller(struct mce_event *e, uint32_t status)
 {
        char channel[30];
+
        if ((status & 0xf) == 0xf)
-               mce_snprintf(e->mc_channel, "unspecified");
+               sprintf(channel, "unspecified");
        else
-               mce_snprintf(e->mc_channel, "%u", status & 0xf);
-       mce_snprintf(e->error_msg, "MEMORY CONTROLLER %s_CHANNEL%s_ERR\n",
-                   mmm_mnemonic[(status >> 4) & 7],
-                   channel);
-       mce_snprintf(e->error_msg, "Transaction: %s\n",
+               sprintf(channel, "%u", status & 0xf);
+
+       mce_snprintf(e->error_msg, "MEMORY CONTROLLER %s_CHANNEL%s_ERR",
+                   mmm_mnemonic[(status >> 4) & 7], channel);
+       mce_snprintf(e->error_msg, "Transaction: %s",
                    mmm_desc[(status >> 4) & 7]);
 }
 
@@ -233,10 +235,10 @@ static void decode_mca(struct mce_event *e, uint64_t track, int *ismemerr)
 
        if ((mca >> 2) == 3) {
                mce_snprintf(e->mcastatus_msg,
-                            "%s Generic memory hierarchy error\n",
+                            "%s Generic memory hierarchy error",
                             decode_attr(LL, mca & 3));
        } else if (test_prefix(4, mca)) {
-               mce_snprintf(e->mcastatus_msg, "%s TLB %s Error\n",
+               mce_snprintf(e->mcastatus_msg, "%s TLB %s Error",
                                decode_attr(TT, (mca & TLB_TT_MASK) >> TLB_TT_SHIFT),
                                decode_attr(LL, (mca & TLB_LL_MASK) >> TLB_LL_SHIFT));
        } else if (test_prefix(8, mca)) {
@@ -245,7 +247,7 @@ static void decode_mca(struct mce_event *e, uint64_t track, int *ismemerr)
                char *type = decode_attr(TT, typenum);
                char *level = decode_attr(LL, levelnum);
                mce_snprintf(e->mcastatus_msg,
-                            "%s CACHE %s %s Error\n", type, level,
+                            "%s CACHE %s %s Error", type, level,
                             get_RRRR_str((mca & CACHE_RRRR_MASK) >>
                                              CACHE_RRRR_SHIFT));
 #if 0
@@ -256,13 +258,13 @@ static void decode_mca(struct mce_event *e, uint64_t track, int *ismemerr)
        } else if (test_prefix(10, mca)) {
                if (mca == 0x400)
                        mce_snprintf(e->mcastatus_msg,
-                                    "Internal Timer error\n");
+                                    "Internal Timer error");
                else
                        mce_snprintf(e->mcastatus_msg,
-                                    "Internal unclassified error: %x\n",
+                                    "Internal unclassified error: %x",
                                     mca);
        } else if (test_prefix(11, mca)) {
-               mce_snprintf(e->mcastatus_msg, "BUS %s %s %s %s %s Error\n",
+               mce_snprintf(e->mcastatus_msg, "BUS %s %s %s %s %s Error",
                             decode_attr(LL, (mca & BUS_LL_MASK) >> BUS_LL_SHIFT),
                             decode_attr(PP, (mca & BUS_PP_MASK) >> BUS_PP_SHIFT),
                             get_RRRR_str((mca & BUS_RRRR_MASK) >> BUS_RRRR_SHIFT),
@@ -272,7 +274,7 @@ static void decode_mca(struct mce_event *e, uint64_t track, int *ismemerr)
                decode_memory_controller(e, mca);
                *ismemerr = 1;
        } else
-               mce_snprintf(e->mcastatus_msg, "Unknown Error %x\n", mca);
+               mce_snprintf(e->mcastatus_msg, "Unknown Error %x", mca);
 }
 
 static void decode_tracking(struct mce_event *e, uint64_t track)
@@ -311,7 +313,7 @@ static void decode_mci(struct mce_event *e, int *ismemerr)
                mce_snprintf(e->mcistatus_msg, "Processor_context_corrupt");
 
        if (e->status & (MCI_STATUS_S|MCI_STATUS_AR))
-               mce_snprintf(e->mcistatus_msg, "%s\n",
+               mce_snprintf(e->mcistatus_msg, "%s",
                             arstate[(e->status >> 55) & 3]);
 
        if ((e->mcgcap == 0 || (e->mcgcap & MCG_TES_P)) &&
index 6231d561762139fbbc6801f64dc08f006c365dcc..1392de779c201a8b7cca4013fabf3ee22ba0d449 100644 (file)
@@ -238,15 +238,13 @@ static void report_mce_event(struct ras_events *ras,
        else
                trace_seq_printf(s, "bank=%x", e->bank);
 
-       trace_seq_printf(s, ", status= %lld", (long long)e->status);
+       trace_seq_printf(s, ", status= %llx", (long long)e->status);
        if (*e->error_msg)
                trace_seq_printf(s, ", %s", e->error_msg);
        if (*e->mcistatus_msg)
                trace_seq_printf(s, ", mci=%s", e->mcistatus_msg);
        if (*e->mcastatus_msg)
                trace_seq_printf(s, ", mca=%s", e->mcastatus_msg);
-       if (*e->mc_channel)
-               trace_seq_printf(s, ", mc_channel=%s", e->mc_channel);
 
        if (*e->user_action)
                trace_seq_printf(s, " %s", e->user_action);
@@ -261,7 +259,7 @@ static void report_mce_event(struct ras_events *ras,
        trace_seq_printf(s, ", walltime= %d", e->walltime);
 #endif
 
-       trace_seq_printf(s, ", CPU: %s,", cputype_name[mce->cputype]);
+       trace_seq_printf(s, ", cpu_type= %s", cputype_name[mce->cputype]);
        trace_seq_printf(s, ", cpu= %d", e->cpu);
        trace_seq_printf(s, ", socketid= %d", e->socketid);
 
@@ -296,7 +294,7 @@ static void report_mce_event(struct ras_events *ras,
        if (e->mcgcap)
                trace_seq_printf(s, ", mcgcap= %llx", (long long)e->mcgcap);
 
-       trace_seq_printf(s, ", apicid= %d", e->apicid);
+       trace_seq_printf(s, ", apicid= %x", e->apicid);
 
        /*
         * FIXME: The original mcelog userspace tool uses DMI to map from
index dd29921ed5e2aae891b4a73fa3af98d2b6bb6744..c73104fa8a6a6d4d795aa14f9e2fcc1bee92ff67 100644 (file)
@@ -70,7 +70,7 @@ struct mce_event {
        char            mcistatus_msg[1024];
        char            mcastatus_msg[1024];
        char            user_action[4096];
-       char            mc_channel[256];
+       char            mc_id[256];
 };
 
 struct mce_priv {