aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndi Kleen <ak@linux.intel.com>2016-08-24 10:04:44 -0700
committerAndi Kleen <ak@linux.intel.com>2016-08-24 10:04:44 -0700
commit57d317acf8086632ffa83358f833229f5bd966e8 (patch)
tree4f3df5bffb9aeea90b700ae92ca117d1321bfbce
parent008c73e6de3a4bf969d1627e695d4efc807aed92 (diff)
downloadmcelog-57d317acf8086632ffa83358f833229f5bd966e8.tar.gz
Remove obsolete disk db
The disk database for errors never quite worked out because DIMMs don't have stable enough identifiers. It has been long replaced with the simpler in memory database. Remove the old obsolete diskdb code. Signed-off-by: Andi Kleen <ak@linux.intel.com>
-rw-r--r--Makefile15
-rw-r--r--TODO-diskdb31
-rw-r--r--db.c599
-rw-r--r--db.h29
-rw-r--r--dbquery.c130
-rw-r--r--diskdb.c96
-rw-r--r--diskdb.h32
-rw-r--r--mcelog.c10
8 files changed, 1 insertions, 941 deletions
diff --git a/Makefile b/Makefile
index 4e663bb..8308612 100644
--- a/Makefile
+++ b/Makefile
@@ -17,11 +17,6 @@ WARNINGS := -Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter
-Wstrict-prototypes -Wformat-security -Wmissing-declarations \
-Wdeclaration-after-statement
-# The on disk database has still many problems (partly in this code and partly
-# due to missing support from BIOS), so it's disabled by default. You can
-# enable it here by uncommenting the following line
-# CONFIG_DISKDB = 1
-
TRIGGERS=cache-error-trigger dimm-error-trigger page-error-trigger \
socket-memory-error-trigger \
bus-error-trigger \
@@ -39,20 +34,12 @@ OBJ := p4.o k8.o mcelog.o dmi.o tsc.o core2.o bitfield.o intel.o \
xeon75xx.o sandy-bridge.o ivy-bridge.o haswell.o \
broadwell_de.o broadwell_epex.o skylake_xeon.o \
msr.o bus.o unknown.o
-DISKDB_OBJ := diskdb.o dimm.o db.o
-CLEAN := mcelog dmi tsc dbquery .depend .depend.X dbquery.o ${DISKDB_OBJ} \
+CLEAN := mcelog dmi tsc dbquery .depend .depend.X dbquery.o \
version.o version.c version.tmp
DOC := mce.pdf
ADD_DEFINES :=
-ifdef CONFIG_DISKDB
-ADD_DEFINES := -DCONFIG_DISKDB=1
-OBJ += ${DISKDB_OBJ}
-
-all: dbquery
-endif
-
SRC := $(OBJ:.o=.c)
mcelog: ${OBJ} version.o
diff --git a/TODO-diskdb b/TODO-diskdb
deleted file mode 100644
index 469c031..0000000
--- a/TODO-diskdb
+++ /dev/null
@@ -1,31 +0,0 @@
-
-diskdb was a experimental attempt to track errors per DIMM
-on disk. It ran into problems unfortunately.
-
-diskdb is not compiled by default now. It can be enabled with
-make CONFIG_DISKDB=1
-
-It is replaced with a new memory only database now that
-relies on daemon mode.
-
-Open fundamental issues:
-- DIMM tracking over boot doesn't work due to SMBIOS not reporting
-serial numbers
-
-Code problems:
-- Missing aging
-- For Intel Nehalem CE errors need reverse smbios translation
-- SMBIOS interleaving decoding missing
-- Some crash races in db.c (see comments there)
-- Need lock timeout
-- Default enable/disable heuristics (smbios check etc.)
-- write db test suite (with crash)
-
-General:
-- Missing CPU database
-
-Missing:
-- rename to different name without memory
-
-Old:
-- add ifdef for memory because it's broken
diff --git a/db.c b/db.c
deleted file mode 100644
index b396b27..0000000
--- a/db.c
+++ /dev/null
@@ -1,599 +0,0 @@
-/* Copyright (C) 2006 Andi Kleen, SuSE Labs.
- Dumb database manager.
- not suitable for large datasets, but human readable files and simple.
- assumes groups and entries-per-group are max low double digits.
- the in memory presentation could be easily optimized with a few
- hashes, but that shouldn't be needed for now.
- Note: obsolete, new design uses in memory databases only
-
- mcelog is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public
- License as published by the Free Software Foundation; version
- 2.
-
- mcelog is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should find a copy of v2 of the GNU General Public License somewhere
- on your Linux system; if not, write to the Free Software Foundation,
- Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
-
-/* TBD:
- add lock file to protect final rename
- timeout for locks
-*/
-
-#define _GNU_SOURCE 1
-#include <stdio.h>
-#include <ctype.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <stdarg.h>
-#include <sys/fcntl.h>
-#include <sys/file.h>
-#include <assert.h>
-
-#include "db.h"
-#include "memutil.h"
-
-/* file format
-
-# comment
-[group1]
-entry1: value
-entry2: value
-
-# comment
-# comment2
-[group2]
-entry: value
-
-value is anything before new line, but first will be skipped
-spaces are allowed in entry names or groups
-comments are preserved, but moved in front of the group
-blank lines allowed.
-
-code doesnt check for unique records/entries right now. first wins.
-
-*/
-
-struct entry {
- char *name;
- char *val;
-};
-
-struct group {
- struct group *next;
- char *name;
- struct entry *entries;
- char *comment;
- int numentries;
-};
-
-#define ENTRY_CHUNK (128 / sizeof(struct entry))
-
-struct database {
- struct group *groups;
- FILE *fh;
- char *fn;
- int dirty;
-};
-
-static int read_db(struct database *db);
-static FILE *open_file(char *fn, int wr);
-static void free_group(struct group *g);
-
-static void DBerror(char *fmt, ...)
-{
- va_list ap;
- va_start(ap,fmt);
- vfprintf(stderr, fmt, ap);
- va_end(ap);
- exit(1);
-}
-
-#define DB_NEW(p) ((p) = xalloc(sizeof(*(p))))
-
-static struct group *alloc_group(char *name)
-{
- struct group *g;
- DB_NEW(g);
- g->entries = xalloc(ENTRY_CHUNK * sizeof(struct entry));
- g->name = name;
- return g;
-}
-
-static char *cleanline(char *s)
-{
- char *p;
- while (isspace(*s))
- s++;
- if (*s == 0)
- return NULL;
- p = strchr(s, '\n');
- if (p)
- *p = 0;
- return s;
-}
-
-struct database *open_db(char *fn, int wr)
-{
- struct database *db;
-
- DB_NEW(db);
- db->fh = open_file(fn, wr);
- if (!db->fh) {
- DBerror("Cannot open database %s\n", fn);
- free(db);
- return NULL;
- }
- db->fn = xstrdup(fn);
- if (read_db(db) < 0) {
- free(db->fn);
- free(db);
- return NULL;
- }
- return db;
-}
-
-static int read_db(struct database *db)
-{
- char *line = NULL;
- size_t linesz = 0;
- struct group *group = NULL, **pgroup = &db->groups;
- int linenr = 0;
-
- while (getline(&line, &linesz, db->fh) > 0) {
- char *s;
- s = strchr(line, '#');
- if (s) {
- struct group *cmt;
- DB_NEW(cmt);
- *pgroup = cmt;
- pgroup = &cmt->next;
- cmt->comment = xstrdup(s + 1);
- *s = 0;
- }
- s = cleanline(line);
- linenr++;
- if (!s)
- continue;
- if (*s == '[') {
- int n;
- char *name;
- ++s;
- n = strcspn(s, "]");
- if (s[n] == 0)
- goto parse_error;
- name = xalloc(n + 1);
- memcpy(name, s, n);
- group = alloc_group(name);
- *pgroup = group;
- pgroup = &group->next;
- } else {
- char *p;
- if (!group)
- goto parse_error;
- p = s + strcspn(s, ":");
- if (*p != ':')
- goto parse_error;
- *p++ = 0;
- if (*p == ' ')
- p++;
- else
- goto parse_error;
- change_entry(db, group, line, p);
- }
- }
-
- if (ferror(db->fh)) {
- DBerror("IO error while reading database %s: %s\n", db->fn,
- strerror(errno));
- goto error;
- }
-
- free(line);
- return 0;
-
-parse_error:
- DBerror("Parse error in database %s at line %d\n", db->fn, linenr);
-error:
- free(line);
- return -1;
-}
-
-/*
-Crash safety strategy:
-
-While the database is opened hold a exclusive flock on the file
-When writing write to a temporary file (.out). Only when the file
-is written rename to another temporary file (.complete).
-
-Then sync and swap tmp file with main file, then sync directory
-(later is linux specific)
-
-During open if the main file doesn't exist and a .complete file does
-rename the .complete file to main first; or open the .complete
-file if the file system is read only.
-
-*/
-
-/* Flush directory. Useful on ext2, on journaling file systems
- the later fsync would usually force earlier transactions on the
- metadata too. */
-static int flush_dir(char *fn)
-{
- int err, fd;
- char *p;
- char dir[strlen(fn) + 1];
- strcpy(dir, fn);
- p = strrchr(dir, '/');
- if (p)
- *p = 0;
- else
- strcpy(dir, ".");
- fd = open(dir, O_DIRECTORY|O_RDONLY);
- if (fd < 0)
- return -1;
- err = 0;
- if (fsync(fd) < 0)
- err = -1;
- if (close(fd) < 0)
- err = -1;
- return err;
-}
-
-static int force_rename(char *a, char *b)
-{
- unlink(b); /* ignore error */
- return rename(a, b);
-}
-
-static int rewrite_db(struct database *db)
-{
- FILE *fhtmp;
- int err;
-
- int tmplen = strlen(db->fn) + 10;
- char fn_complete[tmplen], fn_old[tmplen], fn_out[tmplen];
-
- sprintf(fn_complete, "%s.complete", db->fn);
- sprintf(fn_old, "%s~", db->fn);
- sprintf(fn_out, "%s.out", db->fn);
-
- fhtmp = fopen(fn_out, "w");
- if (!fhtmp) {
- DBerror("Cannot open `%s' output file: %s\n", fn_out,
- strerror(errno));
- return -1;
- }
-
- dump_database(db, fhtmp);
-
- err = 0;
- /* Finish the output file */
- if (ferror(fhtmp) || fflush(fhtmp) != 0 || fsync(fileno(fhtmp)) != 0 ||
- fclose(fhtmp))
- err = -1;
- /* Rename to .complete */
- else if (force_rename(fn_out, fn_complete))
- err = -1;
- /* RED-PEN: need to do retry for race */
- /* Move to final name */
- else if (force_rename(db->fn, fn_old) || rename(fn_complete, db->fn))
- err = -1;
- /* Hit disk */
- else if (flush_dir(db->fn))
- err = -1;
-
- if (err) {
- DBerror("Error writing to database %s: %s\n", db->fn,
- strerror(errno));
- }
-
- return err;
-}
-
-int sync_db(struct database *db)
-{
- if (!db->dirty)
- return 0;
- /* RED-PEN window without lock */
- if (rewrite_db(db))
- return -1;
- fclose(db->fh);
- db->dirty = 0;
- db->fh = open_file(db->fn, 1);
- if (!db->fh)
- return -1;
- return 0;
-}
-
-static void free_group(struct group *g)
-{
- free(g->entries);
- free(g->name);
- free(g->comment);
- free(g);
-}
-
-static void free_data(struct database *db)
-{
- struct group *g, *gnext;
- for (g = db->groups; g; g = gnext) {
- gnext = g->next;
- free_group(g);
- }
-}
-
-int close_db(struct database *db)
-{
- if (db->dirty && rewrite_db(db))
- return -1;
- if (fclose(db->fh))
- return -1;
- free_data(db);
- free(db->fn);
- free(db);
- return 0;
-}
-
-static FILE *open_file(char *fn, int wr)
-{
- char tmp[strlen(fn) + 10];
- FILE *fh;
- if (access(fn, wr ? (R_OK|W_OK) : R_OK)) {
- switch (errno) {
- case EROFS:
- wr = 0;
- break;
- case ENOENT:
- /* No main DB file */
- sprintf(tmp, "%s.complete", fn);
- /* Handle race */
- if (!access(tmp, R_OK)) {
- if (rename(tmp, fn) < 0 && errno == EEXIST)
- return open_file(fn, wr);
- } else
- creat(fn, 0644);
- break;
- }
- }
- fh = fopen(fn, wr ? "r+" : "r");
- if (fh) {
- if (flock(fileno(fh), wr ? LOCK_EX : LOCK_SH) < 0) {
- fclose(fh);
- return NULL;
- }
- }
- return fh;
-}
-
-void dump_group(struct group *g, FILE *out)
-{
- struct entry *e;
- fprintf(out, "[%s]\n", g->name);
- for (e = &g->entries[0]; e->name && !ferror(out); e++)
- fprintf(out, "%s: %s\n", e->name, e->val);
-}
-
-void dump_database(struct database *db, FILE *out)
-{
- struct group *g;
- for (g = db->groups; g && !ferror(out); g = g->next) {
- if (g->comment) {
- fprintf(out, "#%s", g->comment);
- continue;
- }
- dump_group(g, out);
- }
-}
-
-struct group *find_group(struct database *db, char *name)
-{
- struct group *g;
- for (g = db->groups; g; g = g->next)
- if (g->name && !strcmp(g->name, name))
- return g;
- return NULL;
-}
-
-int delete_group(struct database *db, struct group *group)
-{
- struct group *g, **gprev;
- gprev = &db->groups;
- for (g = *gprev; g; gprev = &g->next, g = g->next) {
- if (g == group) {
- *gprev = g->next;
- free_group(g);
- return 0;
- }
- }
- db->dirty = 1;
- return -1;
-}
-
-char *entry_val(struct group *g, char *entry)
-{
- struct entry *e;
- for (e = &g->entries[0]; e->name; e++)
- if (!strcmp(e->name, entry))
- return e->val;
- return NULL;
-}
-
-struct group *add_group(struct database *db, char *name, int *existed)
-{
- struct group *g, **gprev = &db->groups;
- for (g = *gprev; g; gprev = &g->next, g = g->next)
- if (g->name && !strcmp(g->name, name))
- break;
- if (existed)
- *existed = (g != NULL);
- if (!g) {
- g = alloc_group(xstrdup(name));
- g->next = *gprev;
- *gprev = g;
- }
- db->dirty = 1;
- return g;
-
-}
-
-void change_entry(struct database *db, struct group *g,
- char *entry, char *newval)
-{
- int i;
- struct entry *e, *entries;
- db->dirty = 1;
- entries = &g->entries[0];
- for (e = entries; e->name; e++) {
- if (!strcmp(e->name, entry)) {
- free(e->val);
- e->val = xstrdup(newval);
- return;
- }
- }
- i = e - entries;
- assert(i == g->numentries);
- if (i > 0 && (i % ENTRY_CHUNK) == 0) {
- int new = (i + ENTRY_CHUNK) * sizeof(struct entry);
- g->entries = xrealloc(g->entries, new);
- }
- entries = &g->entries[0];
- e = &entries[i];
- e->name = xstrdup(entry);
- e->val = xstrdup(newval);
- g->numentries++;
-}
-
-void delete_entry(struct database *db, struct group *g, char *entry)
-{
- struct entry *e;
- for (e = &g->entries[0]; e->name; e++)
- if (!strcmp(e->name, entry))
- break;
- if (e->name == NULL)
- return;
- while ((++e)->name)
- e[-1] = e[0];
- g->numentries--;
-}
-
-struct group *
-clone_group(struct database *db, struct group *gold, char *newname)
-{
- struct entry *e;
- struct group *gnew = add_group(db, newname, NULL);
- for (e = &gold->entries[0]; e->name; e++)
- change_entry(db, gnew, e->name, e->val);
- return gnew;
-}
-
-static char *save_comment(char *c)
-{
- int len = strlen(c);
- char *s = xalloc(len + 2);
- strcpy(s, c);
- if (len == 0 || c[len - 1] != '\n')
- s[len] = '\n';
- return s;
-}
-
-void add_comment(struct database *db, struct group *group, char *comment)
-{
- struct group *g;
- struct group **gprev = &db->groups;
- for (g = *gprev; g; gprev = &g->next, g = g->next) {
- if ((group && g == group) || (!group && g->comment == NULL))
- break;
- }
- DB_NEW(g);
- g->comment = save_comment(comment);
- g->next = *gprev;
- *gprev = g;
- db->dirty = 1;
-}
-
-struct group *first_group(struct database *db)
-{
- return next_group(db->groups);
-}
-
-struct group *next_group(struct group *g)
-{
- struct group *n;
- if (!g)
- return NULL;
- n = g->next;
- while (n && n->comment)
- n = n->next;
- return n;
-}
-
-char *group_name(struct group *g)
-{
- return g->name;
-}
-
-struct group *find_entry(struct database *db, struct group *prev,
- char *entry, char *value)
-{
- int previ = 0;
- struct entry *e;
- struct group *g;
- if (prev)
- g = prev->next;
- else
- g = db->groups;
- for (; g; g = g->next) {
- if (g->comment)
- continue;
- /* Short cut when entry is at the same place as previous */
- if (previ < g->numentries) {
- e = &g->entries[previ];
- if (!strcmp(e->name, entry)) {
- if (!strcmp(e->val, value))
- return g;
- continue;
- }
- }
- for (e = &g->entries[0]; e->name; e++) {
- if (strcmp(e->name, entry))
- continue;
- if (!strcmp(e->val, value))
- return g;
- previ = e - &g->entries[0];
- break;
- }
- }
- return NULL;
-}
-
-void rename_group(struct database *db, struct group *g, char *newname)
-{
- free(g->name);
- g->name = xstrdup(newname);
- db->dirty = 1;
-}
-
-unsigned long entry_num(struct group *g, char *entry)
-{
- char *e = entry_val(g, entry);
- unsigned long val = 0;
- if (e)
- sscanf(e, "%lu", &val);
- return val;
-}
-
-void change_entry_num(struct database *db, struct group *g,
- char *entry, unsigned long val)
-{
- char buf[20];
- sprintf(buf, "%lu", val);
- change_entry(db, g, entry, buf);
-}
diff --git a/db.h b/db.h
deleted file mode 100644
index 294d8b6..0000000
--- a/db.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#include <stdio.h>
-struct database;
-struct group;
-
-struct database *open_db(char *fn, int wr);
-int sync_db(struct database *db);
-int close_db(struct database *db);
-struct group *find_group(struct database *db, char *name);
-char *entry_val(struct group *g, char *entry);
-struct group *add_group(struct database *db, char *name, int *existed);
-int delete_group(struct database *db, struct group *g);
-void change_entry(struct database *db, struct group *g,
- char *entry, char *newval);
-void add_comment(struct database *db, struct group *group, char *comment);
-struct group *first_group(struct database *db);
-struct group *next_group(struct group *g);
-void dump_group(struct group *g, FILE *out);
-void dump_database(struct database *db, FILE *out);
-struct group *find_entry(struct database *db, struct group *prev,
- char *entry, char *value);
-void rename_group(struct database *db, struct group *group, char *newname);
-char *group_name(struct group *g);
-unsigned long entry_num(struct group *g, char *entry);
-void change_entry_num(struct database *db, struct group *g, char *entry,
- unsigned long val);
-void delete_entry(struct database *db, struct group *g, char *entry);
-struct group *
-clone_group(struct database *db, struct group *gold, char *newname);
-
diff --git a/dbquery.c b/dbquery.c
deleted file mode 100644
index 38cbce5..0000000
--- a/dbquery.c
+++ /dev/null
@@ -1,130 +0,0 @@
-/* Access db files. This is for testing and debugging only. */
-#define _GNU_SOURCE 1
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <stdarg.h>
-#include "db.h"
-
-#define C(x) if (x) printf(#x " failed: %s\n", strerror(errno))
-#define NEEDGROUP if (!group) { printf("need group first\n"); break; }
-
-void Eprintf(char *fmt, ...)
-{
- va_list ap;
- va_start(ap, fmt);
- vfprintf(stderr, fmt, ap);
- va_end(ap);
-}
-
-void usage(void)
-{
- printf(
- "s sync\n"
- "q close/quit\n"
- "ggroup find group\n"
- "G delete group\n"
- "agroup add group\n"
- "ventry dump entry\n"
- "centry,val change entry to val\n"
- "fentry,val find entry with value and dump its group\n"
- "Ccomment add comment\n"
- "Lnewname clone group to newname\n"
- "d dump group\n"
- "D dump database\n");
-}
-
-int main(int ac, char **av)
-{
- struct database *db;
- struct group *group = NULL;
- char *line = NULL;
- size_t linesz = 0;
- if (!av[1]) {
- printf("%s database\n", av[0]);
- exit(1);
- }
- printf("dbtest\n");
- db = open_db(av[1], 1);
- while (printf("> "),
- fflush(stdout),
- getline(&line, &linesz, stdin) > 0) {
- char *p = line + strlen(line) - 1;
- while (p >= line && isspace(*p))
- *p-- = 0;
- switch (line[0]) {
- case 's':
- C(sync_db(db));
- break;
- case 'q':
- C(close_db(db));
- exit(0);
- case 'g':
- group = find_group(db, line + 1);
- if (group)
- printf("found\n");
- break;
- case 'G':
- NEEDGROUP;
- C(delete_group(db, group));
- group = NULL;
- break;
- case 'a': {
- int existed = 0;
- group = add_group(db, line + 1, &existed);
- if (existed)
- printf("existed\n");
- break;
- }
- case 'v':
- NEEDGROUP;
- printf("%s\n", entry_val(group, line + 1));
- break;
- case 'c': {
- p = line + 1;
- char *entry = strsep(&p, ",");
- NEEDGROUP;
- change_entry(db, group, entry, strsep(&p, ""));
- break;
- }
- case 'L':
- NEEDGROUP;
- clone_group(db, group, line + 1);
- break;
- case 'f': {
- struct group *g;
- p = line + 1;
- char *entry = strsep(&p, ",");
- char *val = strsep(&p, "");
- g = NULL;
- int nr = 0;
- while ((g = find_entry(db, g, entry, val)) != NULL) {
- if (nr == 0)
- group = g;
- nr++;
- dump_group(group, stdout);
- }
- if (nr == 0)
- printf("not found\n");
- break;
- }
- case 'C':
- NEEDGROUP;
- add_comment(db, group, line + 1);
- break;
- case 'd':
- NEEDGROUP;
- dump_group(group, stdout);
- break;
- case 'D':
- dump_database(db, stdout);
- break;
- default:
- usage();
- break;
- }
- }
- return 0;
-}
diff --git a/diskdb.c b/diskdb.c
deleted file mode 100644
index 03d845f..0000000
--- a/diskdb.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* High level interface to disk based DIMM database */
-/* Note: obsolete: new design is in memdb.c */
-#include <stdlib.h>
-#include <getopt.h>
-#include <stdio.h>
-#include "mcelog.h"
-#include "diskdb.h"
-#include "paths.h"
-#include "dimm.h"
-#include "dmi.h"
-
-char *error_trigger;
-unsigned error_thresh = 20;
-char *dimm_db_fn = DIMM_DB_FILENAME;
-
-static void checkdimmdb(void)
-{
- if (open_dimm_db(dimm_db_fn) < 0)
- exit(1);
-}
-
-int diskdb_modifier(int opt)
-{
- char *end;
-
- switch (opt) {
- case O_DATABASE:
- dimm_db_fn = optarg;
- checkdmi();
- checkdimmdb();
- break;
- case O_ERROR_TRIGGER:
- checkdmi();
- open_dimm_db(dimm_db_fn);
- error_thresh = strtoul(optarg, &end, 0);
- if (end == optarg || *end != ',')
- usage();
- error_trigger = end + 1;
- break;
- default:
- return 0;
- }
- return 1;
-}
-
-void diskdb_resolve_addr(u64 addr)
-{
- if (open_dimm_db(dimm_db_fn) >= 0)
- new_error(addr, error_thresh, error_trigger);
-}
-
-
-void diskdb_usage(void)
-{
- fprintf(stderr,
- "Manage disk DIMM error database\n"
- " mcelog [options] --drop-old-memory|--reset-memory locator\n"
- " mcelog --dump-memory locator\n"
- " old can be either locator or name\n"
- "Disk database options:"
- "--database fn Set filename of DIMM database (default " DIMM_DB_FILENAME ")\n"
- "--error-trigger cmd,thresh Run cmd on exceeding thresh errors per DIMM\n");
-}
-
-
-static void dimm_common(int ac, char **av)
-{
- no_syslog();
- checkdmi();
- checkdimmdb();
- argsleft(ac, av);
-}
-
-int diskdb_cmd(int opt, int ac, char **av)
-{
- char *arg = optarg;
-
- switch (opt) {
- case O_DUMP_MEMORY:
- dimm_common(ac, av);
- if (arg)
- dump_dimm(arg);
- else
- dump_all_dimms();
- return 1;
- case O_RESET_MEMORY:
- dimm_common(ac, av);
- reset_dimm(arg);
- return 1;
- case O_DROP_OLD_MEMORY:
- dimm_common(ac, av);
- gc_dimms();
- return 1;
- }
- return 0;
-}
diff --git a/diskdb.h b/diskdb.h
deleted file mode 100644
index 49ea628..0000000
--- a/diskdb.h
+++ /dev/null
@@ -1,32 +0,0 @@
-
-#ifdef CONFIG_DISKDB
-enum diskdb_options {
- O_DATABASE = O_DISKDB,
- O_ERROR_TRIGGER,
- O_DUMP_MEMORY,
- O_RESET_MEMORY,
- O_DROP_OLD_MEMORY,
-};
-
-void diskdb_resolve_addr(u64 addr);
-int diskdb_modifier(int opt);
-int diskdb_cmd(int opt, int ac, char **av);
-void diskdb_usage(void);
-
-#define DISKDB_OPTIONS \
- { "database", 1, NULL, O_DATABASE }, \
- { "error-trigger", 1, NULL, O_ERROR_TRIGGER }, \
- { "dump-memory", 2, NULL, O_DUMP_MEMORY }, \
- { "reset-memory", 2, NULL, O_RESET_MEMORY }, \
- { "drop-old-memory", 0, NULL, O_DROP_OLD_MEMORY },
-
-#else
-
-static inline void diskdb_resolve_addr(u64 addr) {}
-static inline int diskdb_modifier(int opt) { return 0; }
-static inline int diskdb_cmd(int opt, int ac, char **av) { return 0; }
-static inline void diskdb_usage(void) {}
-
-#define DISKDB_OPTIONS
-
-#endif
diff --git a/mcelog.c b/mcelog.c
index 892396d..1d79fa1 100644
--- a/mcelog.c
+++ b/mcelog.c
@@ -48,7 +48,6 @@
#include "tsc.h"
#include "version.h"
#include "config.h"
-#include "diskdb.h"
#include "memutil.h"
#include "eventloop.h"
#include "memdb.h"
@@ -454,9 +453,6 @@ static void dump_mce(struct mce *m, unsigned recordlen)
cputype != CPU_KNIGHTS_LANDING && cputype != CPU_SKYLAKE &&
cputype != CPU_SKYLAKE_XEON)
resolveaddr(m->addr);
- if (!ascii_mode && ismemerr && (m->status & MCI_STATUS_ADDRV)) {
- diskdb_resolve_addr(m->addr);
- }
}
static void dump_mce_raw_ascii(struct mce *m, unsigned recordlen)
@@ -977,7 +973,6 @@ void usage(void)
"--no-imc-log Disable extended iMC logging\n"
"--is-cpu-supported Exit with return code indicating whether the CPU is supported\n"
);
- diskdb_usage();
printf("\n");
print_cputypes();
exit(1);
@@ -1046,7 +1041,6 @@ static struct option options[] = {
{ "debug-numerrors", 0, NULL, O_DEBUG_NUMERRORS }, /* undocumented: for testing */
{ "no-imc-log", 0, NULL, O_NO_IMC_LOG },
{ "is-cpu-supported", 0, NULL, O_IS_CPU_SUPPORTED },
- DISKDB_OPTIONS
{}
};
@@ -1194,8 +1188,6 @@ void no_syslog(void)
static int combined_modifier(int opt)
{
int r = modifier(opt);
- if (r == 0)
- r = diskdb_modifier(opt);
return r;
}
@@ -1372,8 +1364,6 @@ int main(int ac, char **av)
noargs(ac, av);
fprintf(stderr, "mcelog %s\n", MCELOG_VERSION);
exit(0);
- } else if (diskdb_cmd(opt, ac, av)) {
- exit(0);
} else if (opt == 0)
break;
}