diff options
author | Tony Luck <tony.luck@intel.com> | 2022-10-19 11:51:28 -0700 |
---|---|---|
committer | Tony Luck <tony.luck@intel.com> | 2022-10-19 11:51:28 -0700 |
commit | 724899c8405f3723f1f3c67de7a5b4429a81910a (patch) | |
tree | 887452acacadc5eb6d2c5984dcc0996109e116bb | |
parent | 0353291ec4a1993532baba9d72701a99c12dcd40 (diff) | |
download | ras-tools-724899c8405f3723f1f3c67de7a5b4429a81910a.tar.gz |
einj_mem_uc: Better handling of "-c" and copy-on-write test
If the copy-on-write test passes, then the child process gets a
SIGBUS and longjmp's back to the main loop. If "-c" had specified
to repeat the test, both parent and child will go back around.
Later loops will also include the grand-children and cousins!
Set a flag to break out of the loop for the child of a copy-on-write
test.
Signed-off-by: Tony Luck <tony.luck@intel.com>
-rw-r--r-- | einj_mem_uc.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/einj_mem_uc.c b/einj_mem_uc.c index 17567de..e394cb5 100644 --- a/einj_mem_uc.c +++ b/einj_mem_uc.c @@ -46,6 +46,8 @@ static int all_flag; static int Sflag; static long pagesize; static int *apicmap; +static int child_process; + #define CACHE_LINE_SIZE 64 #define EINJ_ETYPE "/sys/kernel/debug/apei/einj/error_type" @@ -738,14 +740,19 @@ int trigger_copy_on_write(char *addr) fprintf(stderr, "%s: fork failed\n", progname); return -1; case 0: + child_process = 1; /* force kernel to copy this page */ + PRINT_TRIGGERING; *addr = '*'; exit(0); } + fprintf(stderr, "%s: COW parent waiting for pid=%d\n", progname, pid); while (wait(&status) != pid) ; - return 0; + + PRINT_TRIGGERING; + return addr[0]; } int trigger_patrol(char *addr) @@ -1186,6 +1193,8 @@ skip2: t = next_test(t); } #endif + if (child_process) + break; } printf("Test passed\n"); |