mirror of
https://github.com/memtest86plus/memtest86plus.git
synced 2025-02-25 18:55:23 -06:00
Support more than 32 CPU cores in main display.
Either one core is active or all enabled cores are active, so we don't really need a separate spinner for each core.
This commit is contained in:
parent
4791206bbd
commit
09890bf0cd
@ -1,5 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
// Copyright (C) 2020-2021 Martin Whitaker.
|
||||
// Copyright (C) 2020-2022 Martin Whitaker.
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
@ -38,7 +38,7 @@ static const char spin_state[NUM_SPIN_STATES] = { '|', '/', '-', '\\' };
|
||||
static bool scroll_lock = false;
|
||||
static bool scroll_wait = false;
|
||||
|
||||
static int spin_idx[MAX_VCPUS]; // current spinner position
|
||||
static int spin_idx = 0; // current spinner position
|
||||
|
||||
static int pass_ticks = 0; // current value (ticks_per_pass is final value)
|
||||
static int test_ticks = 0; // current value (ticks_per_test is final value)
|
||||
@ -81,15 +81,14 @@ void display_init(void)
|
||||
prints(4, 0, "L3 Cache: N/A | Testing: ");
|
||||
prints(5, 0, "Memory : N/A | Pattern: ");
|
||||
prints(6, 0, "-------------------------------------------------------------------------------");
|
||||
prints( 7, 0, "vCPU#: | Time: Temperature: N/A ");
|
||||
prints( 8, 0, "State: | ");
|
||||
prints( 9, 0, "Cores: Active / Total (Run: All) | Pass: Errors: ");
|
||||
prints(10, 0, "-------------------------------------------------------------------------------");
|
||||
prints(7, 0, "CPU cores: available, enabled | Time: Temperature: N/A ");
|
||||
prints(8, 0, "Run mode : PAR Active: | Pass: Errors: ");
|
||||
prints(9, 0, "-------------------------------------------------------------------------------");
|
||||
|
||||
// Redraw lines using box drawing characters.
|
||||
for (int i = 0;i < 80; i++) {
|
||||
print_char(6, i, 0xc4);
|
||||
print_char(10, i, 0xc4);
|
||||
print_char(9, i, 0xc4);
|
||||
}
|
||||
for (int i = 0; i < 6; i++) {
|
||||
print_char(i, 28, 0xb3);
|
||||
@ -99,7 +98,7 @@ void display_init(void)
|
||||
}
|
||||
print_char(6, 28, 0xc1);
|
||||
print_char(6, 39, 0xc2);
|
||||
print_char(10, 39, 0xc1);
|
||||
print_char(9, 39, 0xc1);
|
||||
|
||||
set_foreground_colour(BLUE);
|
||||
set_background_colour(WHITE);
|
||||
@ -141,9 +140,9 @@ void display_start_run(void)
|
||||
if (!enable_trace) {
|
||||
clear_message_area();
|
||||
}
|
||||
clear_screen_region(7, 47, 9, 57); // run time
|
||||
clear_screen_region(9, 47, 9, 57); // pass number
|
||||
clear_screen_region(9, 66, 9, SCREEN_WIDTH - 1); // error count
|
||||
clear_screen_region(7, 47, 7, 57); // run time
|
||||
clear_screen_region(8, 47, 8, 57); // pass number
|
||||
clear_screen_region(8, 66, 8, SCREEN_WIDTH - 1); // error count
|
||||
display_pass_count(0);
|
||||
display_error_count(0);
|
||||
run_start_time = get_tsc();
|
||||
@ -224,9 +223,6 @@ void scroll(void)
|
||||
|
||||
void do_tick(int my_vcpu)
|
||||
{
|
||||
spin_idx[my_vcpu] = (spin_idx[my_vcpu] + 1) % NUM_SPIN_STATES;
|
||||
display_spinner(my_vcpu, spin_state[spin_idx[my_vcpu]]);
|
||||
|
||||
barrier_wait(run_barrier);
|
||||
if (master_vcpu == my_vcpu) {
|
||||
check_input();
|
||||
@ -239,6 +235,9 @@ void do_tick(int my_vcpu)
|
||||
return;
|
||||
}
|
||||
|
||||
spin_idx = (spin_idx + 1) % NUM_SPIN_STATES;
|
||||
display_spinner(spin_state[spin_idx]);
|
||||
|
||||
test_ticks++;
|
||||
pass_ticks++;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
* Provides (macro) functions that implement the UI display.
|
||||
* All knowledge about the display layout is encapsulated here.
|
||||
*
|
||||
* Copyright (C) 2020-2021 Martin Whitaker.
|
||||
* Copyright (C) 2020-2022 Martin Whitaker.
|
||||
*/
|
||||
|
||||
#include <stdbool.h>
|
||||
@ -17,7 +17,7 @@
|
||||
|
||||
#include "test.h"
|
||||
|
||||
#define ROW_MESSAGE_T 11
|
||||
#define ROW_MESSAGE_T 10
|
||||
#define ROW_MESSAGE_B (SCREEN_HEIGHT - 2)
|
||||
|
||||
#define ROW_SCROLL_T (ROW_MESSAGE_T + 2)
|
||||
@ -50,20 +50,23 @@
|
||||
#define display_memory_size(size) \
|
||||
printf(5, 10, "%kB", (uintptr_t)(size))
|
||||
|
||||
#define display_cpu_num(me) \
|
||||
printc(7, 7 + (me), '0' + ((me) % 10))
|
||||
#define display_available_cpus(count) \
|
||||
printi(7, 10, count, 4, false, false)
|
||||
|
||||
#define display_spinner(me, spin_state) \
|
||||
printc(8, 7 + (me), spin_state)
|
||||
|
||||
#define display_active_cpus(count) \
|
||||
printi(9, 7, count, 2, false, false)
|
||||
|
||||
#define display_total_cpus(count) \
|
||||
printi(9, 19, count, 2, false, false)
|
||||
#define display_enabled_cpus(count) \
|
||||
printi(7, 25, count, 4, false, false)
|
||||
|
||||
#define display_cpu_mode(str) \
|
||||
prints(9, 34, str)
|
||||
prints(8, 11, str)
|
||||
|
||||
#define display_active_cpu(pcpu_num) \
|
||||
printf(8, 25, "core #%i", pcpu_num)
|
||||
|
||||
#define display_all_active \
|
||||
prints(8, 25, "all cores")
|
||||
|
||||
#define display_spinner(spin_state) \
|
||||
printc(8, 36, spin_state)
|
||||
|
||||
#define display_pass_percentage(pct) \
|
||||
printi(1, 34, pct, 3, false, false)
|
||||
@ -126,10 +129,10 @@
|
||||
printf(7, 71, "%2i%cC ", temp, 0xf8)
|
||||
|
||||
#define display_pass_count(count) \
|
||||
printi(9, 47, count, 0, false, true)
|
||||
printi(8, 47, count, 0, false, true)
|
||||
|
||||
#define display_error_count(count) \
|
||||
printi(9, 66, count, 0, false, true)
|
||||
printi(8, 66, count, 0, false, true)
|
||||
|
||||
#define clear_message_area() \
|
||||
{ \
|
||||
|
40
app/main.c
40
app/main.c
@ -1,5 +1,5 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
// Copyright (C) 2020-2021 Martin Whitaker.
|
||||
// Copyright (C) 2020-2022 Martin Whitaker.
|
||||
//
|
||||
// Derived from memtest86+ main.c:
|
||||
//
|
||||
@ -161,18 +161,17 @@ static void global_init(void)
|
||||
|
||||
clear_message_area();
|
||||
|
||||
display_active_cpus(1);
|
||||
display_total_cpus(num_pcpus);
|
||||
display_available_cpus(num_pcpus);
|
||||
|
||||
num_vcpus = 0;
|
||||
for (int i = 0; i < num_pcpus; i++) {
|
||||
if (enable_pcpu[i]) {
|
||||
pcpu_num_to_vcpu_num[i] = num_vcpus;
|
||||
display_cpu_num(num_vcpus);
|
||||
display_spinner(num_vcpus, 'S');
|
||||
num_vcpus++;
|
||||
}
|
||||
}
|
||||
display_enabled_cpus(num_vcpus);
|
||||
|
||||
master_vcpu = 0;
|
||||
|
||||
if (enable_temperature) {
|
||||
@ -252,17 +251,22 @@ static void setup_vm_map(uintptr_t win_start, uintptr_t win_end)
|
||||
static void test_all_windows(int my_pcpu, int my_vcpu)
|
||||
{
|
||||
int active_cpus = 1;
|
||||
bool i_am_active = (my_vcpu == master_vcpu);
|
||||
bool i_am_master = (my_vcpu == master_vcpu);
|
||||
bool i_am_active = i_am_master;
|
||||
if (!dummy_run) {
|
||||
if (cpu_mode == PAR && test_list[test_num].cpu_mode == PAR) {
|
||||
active_cpus = num_vcpus;
|
||||
i_am_active = true;
|
||||
}
|
||||
}
|
||||
if (my_vcpu == master_vcpu) {
|
||||
if (i_am_master) {
|
||||
barrier_init(run_barrier, active_cpus);
|
||||
if (!dummy_run) {
|
||||
display_active_cpus(active_cpus);
|
||||
if (active_cpus == 1) {
|
||||
display_active_cpu(my_pcpu);
|
||||
} else {
|
||||
display_all_active;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -274,15 +278,12 @@ static void test_all_windows(int my_pcpu, int my_vcpu)
|
||||
|
||||
// Loop through all possible windows.
|
||||
do {
|
||||
if (!dummy_run) {
|
||||
display_spinner(my_vcpu, 'W');
|
||||
}
|
||||
BARRIER;
|
||||
if (bail) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (my_vcpu == master_vcpu) {
|
||||
if (i_am_master) {
|
||||
if (window_num == 0 && test_list[test_num].stages > 1) {
|
||||
// A multi-stage test runs through all the windows at each stage.
|
||||
// Relocation may disrupt the test.
|
||||
@ -306,7 +307,7 @@ static void test_all_windows(int my_pcpu, int my_vcpu)
|
||||
}
|
||||
}
|
||||
|
||||
if (my_vcpu == master_vcpu) {
|
||||
if (i_am_master) {
|
||||
switch (window_num) {
|
||||
case 0:
|
||||
window_start = 0;
|
||||
@ -330,18 +331,14 @@ static void test_all_windows(int my_pcpu, int my_vcpu)
|
||||
|
||||
if (vm_map_size == 0) {
|
||||
// No memory to test in this window.
|
||||
if (my_vcpu == master_vcpu) {
|
||||
if (i_am_master) {
|
||||
window_num++;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!dummy_run) {
|
||||
display_spinner(my_vcpu, '-');
|
||||
}
|
||||
|
||||
if (dummy_run) {
|
||||
if (my_vcpu == master_vcpu) {
|
||||
if (i_am_master) {
|
||||
ticks_per_test[pass_num][test_num] += run_test(-1, test_num, test_stage, iterations);
|
||||
}
|
||||
} else {
|
||||
@ -349,10 +346,13 @@ static void test_all_windows(int my_pcpu, int my_vcpu)
|
||||
// Either there is no PAE or we are at the PAE limit.
|
||||
break;
|
||||
}
|
||||
if (i_am_master) {
|
||||
display_spinner('-');
|
||||
}
|
||||
run_test(my_vcpu, test_num, test_stage, iterations);
|
||||
}
|
||||
|
||||
if (my_vcpu == master_vcpu) {
|
||||
if (i_am_master) {
|
||||
window_num++;
|
||||
}
|
||||
} while (window_end < pm_map[pm_map_size - 1].end);
|
||||
|
Loading…
Reference in New Issue
Block a user