diff options
author | Qiuxu Zhuo <qiuxu.zhuo@intel.com> | 2019-06-18 09:19:40 +0800 |
---|---|---|
committer | Andi Kleen <ak@linux.intel.com> | 2019-07-16 17:15:50 -0700 |
commit | 08ee5962fadfad11a256edcd92d7a71d55db6890 (patch) | |
tree | 4ca788b982fec1a11ffa993cfdade99c615117df | |
parent | bf1584690549f59dbc98cc5278649a8dfd1b4aea (diff) | |
download | mce-test-08ee5962fadfad11a256edcd92d7a71d55db6890.tar.gz |
Avoid optimizing out the access to the injected location by compiler
The "SRAR DCU" test case failed on a CLX-AP server. It's root caused
that the gcc v8.2.1 optimized out the access to the injected location.
Move the "total" from being a local variable to a global to avoid the
optimization by the compiler. Consequently, it can make sure the poisoned
data is consumed to trigger the machine check recovery process.
Before applying the patch:
run : ./srar_recovery.sh -d
log : The poisoned process can't be killed by kernel automatically. Test fails!
After applying the patch:
run : ./srar_recovery.sh -d
log : ./srar_recovery.sh: line 80: 11650 Broken pipe tail -f trigger --pid=$$
11651 Bus error (core dumped) | victim $1 > log
SRAR/DCU test passes!
Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
Signed-off-by: Andi Kleen <ak@linux.intel.com>
-rw-r--r-- | tools/victim/victim.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/victim/victim.c b/tools/victim/victim.c index 31f868a..5aa8c1e 100644 --- a/tools/victim/victim.c +++ b/tools/victim/victim.c @@ -215,10 +215,19 @@ static int parse_addr_subopts(char *subopts, unsigned long long *virt, return 0; } +/* + * The "SRAR DCU" test case failed on a CLX-AP server. It's root caused + * that the gcc v8.2.1 optimized out the access to the injected location. + * + * If keep "total" as a local, even mark it "volatile", the gcc v8.2.1 + * still optimizes out the memory access. Therefore, move the "total" from + * being a local variable to a global to avoid such optimization. + */ +long total; + int main(int argc, char **argv) { unsigned long long virt, phys; - long total; char *buf; int c, i; int iflag = 0, dflag = 0; |