Public bug reported: The testing result of mbw tool installed by running “apt install mbw” is shown below.
(tf2) bruce@P800002:~/tools/memtest/mbw_original$ mbw -a -n 1 1024 Long uses 8 bytes. Allocating 2*134217728 elements = 2147483648 bytes of memory. Using 262144 bytes as blocks for memcpy block copy test. Getting down to business... Doing 1 runs per test. 0 Method: MEMCPY Elapsed: 0.20496 MiB: 1024.00000 Copy: 4996.097 MiB/s 0 Method: DUMB Elapsed: 0.11309 MiB: 1024.00000 Copy: 9055.136 MiB/s 0 Method: MCBLOCK Elapsed: 0.18077 MiB: 1024.00000 Copy: 5664.625 MiB/s But the testing result from newest version of mbw which is downloaded from github and built by myself is totally different with the former one. (tf2) bruce@P800002:~/tools/memtest/mbw_original$ ./mbw -a -n 1 1024 Long uses 8 bytes. Allocating 2*134217728 elements = 2147483648 bytes of memory. Using 262144 bytes as blocks for memcpy block copy test. Getting down to business... Doing 1 runs per test. 0 Method: MEMCPY Elapsed: 0.11314 MiB: 1024.00000 Copy: 9050.334 MiB/s 0 Method: DUMB Elapsed: 0.20412 MiB: 1024.00000 Copy: 5016.632 MiB/s 0 Method: MCBLOCK Elapsed: 0.22396 MiB: 1024.00000 Copy: 4572.225 MiB/s From the output of self-built mbw, you can see the speed of MEMCPY is about 9050.334 MiB/s (much higher than the case of DUMB), but it is only 4996.097 MiB/s in the output of apt-installed mbw (much lower than the case of DUMB). After reading output of “git log -p mbw.c”, I believe apt repository is still using a very old version of mbw, and unfortunately this version involves a seriously issue which was fixed in the following changeset. In this changeset, the code “if(type==1)” was changed to “if(type==TEST_MEMCPY)” and the micro TEST_MEMCPY is 0. That means when the “help” information(“-t1: dumb (b[i]=a[i] style) test”) shows number 1 case is DUMB, what it really did is MEMCPY. Looking forward to fix this problem in apt repository by updating to newest mbw in github. diff --git a/mbw.c b/mbw.c index 6251ea9..06a9d09 100644 --- a/mbw.c +++ b/mbw.c @@ -23,6 +23,11 @@ /* default block size for test 2, in bytes */ #define DEFAULT_BLOCK_SIZE 262144 +/* test types */ +#define TEST_MEMCPY 0 +#define TEST_DUMB 1 +#define TEST_MCBLOCK 2 + /* * MBW memory bandwidth benchmark * @@ -50,9 +55,9 @@ void usage() printf("Options:\n"); printf(" -n: number of runs per test\n"); printf(" -a: Don't display average\n"); - printf(" -t0: memcpy test\n"); - printf(" -t1: dumb (b[i]=a[i] style) test\n"); - printf(" -t2 : memcpy test with fixed block size\n"); + printf(" -t%d: memcpy test\n", TEST_MEMCPY); + printf(" -t%d: dumb (b[i]=a[i] style) test\n", TEST_DUMB); + printf(" -t%d: memcpy test with fixed block size\n", TEST_MCBLOCK); printf(" -b <size>: block size in bytes for -t2 (default: %d)\n", DEFAULT_BLOCK_SIZE); printf(" -q: quiet (print statistics only)\n"); printf("(will then use two arrays, watch out for swapping)\n"); @@ -100,13 +105,13 @@ double worker(unsigned long long asize, long *a, long *b, int type, unsigned lon /* array size in bytes */ unsigned long long array_bytes=asize*long_size; - if(type==1) { /* memcpy test */ + if(type==TEST_MEMCPY) { /* memcpy test */ /* timer starts */ gettimeofday(&starttime, NULL); memcpy(b, a, array_bytes); /* timer stops */ gettimeofday(&endtime, NULL); - } else if(type==2) { /* memcpy block test */ + } else if(type==TEST_MCBLOCK) { /* memcpy block test */ char* aa = (char*)a; char* bb = (char*)b; gettimeofday(&starttime, NULL); @@ -117,7 +122,7 @@ double worker(unsigned long long asize, long *a, long *b, int type, unsigned lon bb=mempcpy(bb, aa, t); } gettimeofday(&endtime, NULL); - } else { /* dumb test */ + } else if(type==TEST_DUMB) { /* dumb test */ gettimeofday(&starttime, NULL); for(t=0; t<asize; t++) { b[t]=a[t]; @@ -142,13 +147,13 @@ double worker(unsigned long long asize, long *a, long *b, int type, unsigned lon void printout(double te, double mt, int type) { switch(type) { - case 0: + case TEST_MEMCPY: printf("Method: MEMCPY\t"); break; - case 1: + case TEST_DUMB: printf("Method: DUMB\t"); break; - case 2: + case TEST_MCBLOCK: printf("Method: MCBLOCK\t"); break; } ProblemType: Bug DistroRelease: Ubuntu 18.04 Package: mbw 1.2.2-1build1 Uname: Linux 5.8.1inspurp8000 x86_64 ApportVersion: 2.20.9-0ubuntu7.24 Architecture: amd64 Date: Fri Jul 23 14:15:17 2021 Dependencies: gcc-8-base 8.4.0-1ubuntu1~18.04 libc6 2.27-3ubuntu1.4 libgcc1 1:8.4.0-1ubuntu1~18.04 InstallationDate: Installed on 2021-07-07 (15 days ago) InstallationMedia: Ubuntu 18.04.5 LTS "Bionic Beaver" - Release amd64 (20200806.1) SourcePackage: mbw UpgradeStatus: No upgrade log present (probably fresh install) ** Affects: mbw (Ubuntu) Importance: Undecided Status: New ** Tags: amd64 apport-bug bionic -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1937338 Title: wrong testing result of mbw To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/mbw/+bug/1937338/+subscriptions -- ubuntu-bugs mailing list ubuntu-bugs@lists.ubuntu.com https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs