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>
1 file changed