lkml.org 
[lkml]   [2002]   [Jan]   [7]   [last100]   RSS Feed
Views: [more markup]   [less markup]   [headers]   [forward]  
 
Messages in this thread
/
DateMon, 7 Jan 2002 06:49:44 -0500
SubjectRe: CONFIG_HIMEM instability?
FromAnthony DeRobertis <>
On Sunday, January 6, 2002, at 11:57 , Tony Hoyle wrote:
>
> Unfortunately memtest86 is incompatible with this mobo, but the 
> memory checks out on another machine I tried it on, so I expect 
> it's OK.

I've had DIMMs not get along. So have other people. This little 
tester seems to find that fairly well, stunningly --- even when 
Memtest86 can't find them at all. It found mine in about 30min 
(512mb box); another persons in an hour or two.

Adjust the defines up top.

PS: You did report the failure to the memtest86 people, right?

#include <iostream>
#include <cstdlib>
#include <ctime>
#ifdef TWO_PROCESSOR
#	include <unistd.h>
#	include <cstdio>
#endif

#define BLOCK_TYPE  int
#define BLOCK_SIZE	(32*1024*1024/sizeof(BLOCK_TYPE))	/* = 32MB  */
#define BLOCK_COUNT	(15)							/* = 480MB */
using namespace std;

void FillBlock(BLOCK_TYPE *ptr);
void CheckBlock(BLOCK_TYPE *ptr, int seed, int ident, int proc);

int main() {
	BLOCK_TYPE *block[BLOCK_COUNT];
	int seed[BLOCK_COUNT];
	cerr << "Allocating Blocks...\n";
	for (int x = 0; x < BLOCK_COUNT; ++x)
		block[x] = new BLOCK_TYPE[BLOCK_SIZE];
	cerr << "Done allocating blocks.\n";

	cerr << "Filling blocks...\n";
	for (int x = 0; x < BLOCK_COUNT; ++x) {
		int rnd = rand();
		srand(rnd);
		seed[x] = rnd;
		FillBlock(block[x]);
	};
	cerr << "Done filling blocks.\n";
#ifdef TWO_PROCESSOR
	int proc_ident;
	{
		int res = fork();
		if (res == 0) {
			srand(time(NULL));
			proc_ident = 1;
		} else if (res == -1) {
			perror("fork");
			exit(1);
		} else
			proc_ident = 0;
	}
#else
	int proc_ident = 0;
#endif
	cerr << "Running test. This will take forever.\n";
	while (1) {
		int which = (rand() %  BLOCK_COUNT);
		CheckBlock(block[which], seed[which], which, proc_ident);
	}
	return 0;
}
void FillBlock(BLOCK_TYPE *ptr) {
	for (BLOCK_TYPE *stop = ptr+BLOCK_SIZE-1; ptr < stop; ++ptr)
		*ptr = rand();
}
void CheckBlock(BLOCK_TYPE *ptr, int seed, int ident, int proc) {
	int old = rand();
	srand(seed);
	for (BLOCK_TYPE *stop = ptr+BLOCK_SIZE-1; ptr < stop; ++ptr) {
		BLOCK_TYPE got = *ptr;
		BLOCK_TYPE want = rand();
		if (got != want)
			cerr << "Block #" << ident << " (" << proc << ") not OK; *"
				 << ptr << " = " << got << ", not " << want << "!\n";
	}
	srand(old);
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 11:15    [W:0.214 / U:0.060 seconds]
©2003-2008 Jasper Spaans