Remove unnecessary volatile qualifiers from test state variables.

Thread safety is ensured by the barriers.
This commit is contained in:
Martin Whitaker 2022-02-19 12:44:14 +00:00
parent e032df50d2
commit 02bcec2418
2 changed files with 39 additions and 39 deletions

View File

@ -62,29 +62,29 @@
// The following variables are written by the current "master" CPU, but may
// be read by all active CPUs.
static volatile int init_state = 0;
static volatile int init_state = 0;
static int num_enabled_cpus = 1;
static int num_enabled_cpus = 1;
static uintptr_t low_load_addr;
static uintptr_t high_load_addr;
static uintptr_t low_load_addr;
static uintptr_t high_load_addr;
static barrier_t *start_barrier = NULL;
static barrier_t *start_barrier = NULL;
static volatile bool start_run = false;
static volatile bool start_pass = false;
static volatile bool start_test = false;
static volatile bool rerun_test = false;
static bool start_run = false;
static bool start_pass = false;
static bool start_test = false;
static bool rerun_test = false;
static volatile bool dummy_run = false;
static bool dummy_run = false;
static volatile int window_num = 0;
static volatile uintptr_t window_start = 0;
static volatile uintptr_t window_end = 0;
static int window_num = 0;
static uintptr_t window_start = 0;
static uintptr_t window_end = 0;
static volatile size_t num_mapped_pages = 0;
static size_t num_mapped_pages = 0;
static volatile int test_stage = 0;
static int test_stage = 0;
//------------------------------------------------------------------------------
// Public Variables
@ -92,26 +92,26 @@ static volatile int test_stage = 0;
// These are exposed in test.h.
uint8_t chunk_index[MAX_CPUS];
uint8_t chunk_index[MAX_CPUS];
volatile int num_active_cpus = 1;
int num_active_cpus = 0;
volatile int master_cpu = 0;
int master_cpu = 0;
barrier_t *run_barrier = NULL;
barrier_t *run_barrier = NULL;
spinlock_t *error_mutex = NULL;
spinlock_t *error_mutex = NULL;
volatile vm_map_t vm_map[MAX_MEM_SEGMENTS];
volatile int vm_map_size = 0;
vm_map_t vm_map[MAX_MEM_SEGMENTS];
int vm_map_size = 0;
volatile int pass_num = 0;
volatile int test_num = 0;
int pass_num = 0;
int test_num = 0;
volatile bool restart = false;
volatile bool bail = false;
bool restart = false;
bool bail = false;
volatile uintptr_t test_addr[MAX_CPUS];
uintptr_t test_addr[MAX_CPUS];
//------------------------------------------------------------------------------
// Private Functions

View File

@ -27,12 +27,12 @@ extern uint8_t chunk_index[MAX_CPUS];
* The number of CPU cores being used for the current test. This is always
* either 1 or the full number of enabled CPU cores.
*/
extern volatile int num_active_cpus;
extern int num_active_cpus;
/*
* The current master CPU core.
*/
extern volatile int master_cpu;
extern int master_cpu;
/*
* A barrier used when running tests.
@ -67,42 +67,42 @@ typedef uintptr_t testword_t;
* A virtual memory segment descriptor.
*/
typedef struct {
uintptr_t pm_base_addr;
testword_t *start;
testword_t *end;
uintptr_t pm_base_addr;
testword_t *start;
testword_t *end;
} vm_map_t;
/*
* The list of memory segments currently mapped into virtual memory.
*/
extern volatile vm_map_t vm_map[MAX_MEM_SEGMENTS];
extern vm_map_t vm_map[MAX_MEM_SEGMENTS];
/*
* The number of memory segments currently mapped into virtual memory.
*/
extern volatile int vm_map_size;
extern int vm_map_size;
/*
* The number of completed test passes.
*/
extern volatile int pass_num;
extern int pass_num;
/*
* The current test number.
*/
extern volatile int test_num;
extern int test_num;
/*
* A flag indicating that testing should be restarted due to a configuration
* change.
*/
extern volatile bool restart;
extern bool restart;
/*
* A flag indicating that the current test should be aborted.
*/
extern volatile bool bail;
extern bool bail;
/*
* The base address of the block of memory currently being tested.
*/
extern volatile uintptr_t test_addr[MAX_CPUS];
extern uintptr_t test_addr[MAX_CPUS];
#endif // TEST_H