diff options
author | Andi Kleen <ak@linux.intel.com> | 2009-09-16 14:59:29 +0200 |
---|---|---|
committer | Andi Kleen <ak@linux.intel.com> | 2009-09-16 14:59:29 +0200 |
commit | 1f90632dfbb6b5b2467e6e5beba6476b7fe7f67c (patch) | |
tree | 966744f4bad4f67894a385a31e435cf08fb3ee05 | |
parent | ff41dfa081545e1ebf3d8ef9b1c9fdddb824aa31 (diff) | |
download | mce-test-1f90632dfbb6b5b2467e6e5beba6476b7fe7f67c.tar.gz |
Add option to injpage to enable sniper
Signed-off-by: Andi Kleen <ak@linux.intel.com>
-rw-r--r-- | tsrc/tinjpage.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/tsrc/tinjpage.c b/tsrc/tinjpage.c index 8dc44ab..043fbfc 100644 --- a/tsrc/tinjpage.c +++ b/tsrc/tinjpage.c @@ -391,6 +391,10 @@ static void nonlinear(void) close(fd); } +/* + * These tests are currently too racy to be enabled. + */ + /* * This is quite timing dependent. The sniper might hit the page * before it is dirtied. If that happens tweak the delay @@ -501,14 +505,41 @@ struct testcase { { file_clean_mlocked, "file clean mlocked", 1 }, { file_dirty_mlocked, "file dirty mlocked"}, { nonlinear, "nonlinear" }, - /* { under_io_dirty, "under io dirty" }, */ - /* { under_io_clean, "under io clean" }, */ + {}, /* dummy 1 for sniper */ + {}, /* dummy 2 for sniper */ {} }; +struct testcase snipercases[] = { + { under_io_dirty, "under io dirty" }, + { under_io_clean, "under io clean" }, +}; + +void usage(void) +{ + fprintf(stderr, "Usage: tinjpage [--sniper]\n" + "Test hwpoison injection on pages in various states\n" + "--sniper: Enable racy sniper tests (likely broken)\n"); + exit(1); +} + +void handle_opts(char **av) +{ + if (!strcmp(av[1], "--sniper")) { + struct testcase *t; + for (t = cases; t->f; t++) + ; + *t++ = snipercases[0]; + *t++ = snipercases[1]; + } else + usage(); +} -int main(void) +int main(int ac, char **av) { + if (av[1]) + handle_opts(av); + PS = getpagesize(); /* don't kill me at poison time, but possibly at page fault time */ |