summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorRasmus Villemoes <[email protected]>2025-08-22 20:18:46 +0200
committerTom Rini <[email protected]>2025-09-02 14:11:36 -0600
commit86c5c25b6ca99025ac8ebcbe5c53ea0f398d1f44 (patch)
tree05485ec20890e6f1cccadcc32283bbd83cf7a6f3 /cmd
parent185aa00a4f5d6fee2c023d8fc459db45b91846d0 (diff)
memtest: don't volatile-qualify local variables
It is obviously important that the addr pointer used to access the memory region being tested is volatile-qualified, to prevent the compiler from optimizing out the "write this value, read it back, check that it is what we expect". However, none of these auxiliary variables have any such need for, effectively, being forced to live on the stack and cause each and every reference to them to do a memory access. This makes the memtest about 15% faster on a beagleboneblack. Before: => dcache off => time mtest 0x81000000 0x81100000 0 1 Testing 81000000 ... 81100000: Iteration: 1 Tested 1 iteration(s) with 0 errors. time: 10.868 seconds After: => dcache off => time mtest 0x81000000 0x81100000 0 1 Testing 81000000 ... 81100000: Iteration: 1 Tested 1 iteration(s) with 0 errors. time: 9.209 seconds [Without the 'dcache off', there's no difference in the time, about 0.6s, but the memtest cannot usefully be done with dcache enabled.] Signed-off-by: Rasmus Villemoes <[email protected]> Tested-by: Anshul Dalal <[email protected]>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/mem.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/cmd/mem.c b/cmd/mem.c
index b8afe62e474..3bba46ad7da 100644
--- a/cmd/mem.c
+++ b/cmd/mem.c
@@ -719,12 +719,9 @@ static ulong mem_test_alt(vu_long *buf, ulong start_addr, ulong end_addr,
ulong errs = 0;
ulong val, readback;
int j;
- vu_long offset;
- vu_long test_offset;
- vu_long pattern;
- vu_long temp;
- vu_long anti_pattern;
- vu_long num_words;
+ ulong offset, test_offset;
+ ulong pattern, anti_pattern;
+ ulong temp, num_words;
static const ulong bitpattern[] = {
0x00000001, /* single bit */
0x00000003, /* two adjacent bits */