Hi all; Below is my modified version of reserve_cpu.c from examples/misc in the rtlinux distribution. This version only introduces the allocation of memory via vmalloc (8 MB) and the creation of a 2nd thread which is bound to processor 0. The original thread is bound to processor 1. This code is running under Linux 2.4.1 (smp enabled) with RTL 3.0 on a dual processor, 400 MHZ P-II system (256 MB of RAM and 1 GB of swap). The motherboard is an Intel Nightshade. I have commented out the do_mlock code. So it should generate the page fault exception (i.e., case 14). I was attempting to pin the pages into memory using the do_mlock kernel call -- on my system do_mlock is located at address 0xc0128538. Unfortunately, this hack does not appear to work -- the program seems to lock up -- but the kernel is fine (i.e., you will not crash your system if you try this). Also, please notice, I am touching each element of the array so as to cause each memory page of the array to be paged in prior to turning off the RTLinux pthreads (see for loop in init_module) . The page fault exception actually occurs on the first for loop in the start_routine prior to turning off the RTLinux pthread. I believe only processor 0 catches the exception. Any help on solving this page fault problem would be most appreciated. Thank you!!, Chris /************************************************************************************/ /* reserve_cpu.c *****************************************************************/ /************************************************************************************/ #include <linux/slab.h> #include <rtl.h> #include <pthread.h> #include <linux/vmalloc.h> #include <rtl_conf.h> #ifndef CONFIG_RTL_SUSPEND_LINUX #error CONFIG_RTL_SUSPEND_LINUX not enabled #endif pthread_t thread0; pthread_t thread1; #define NUMBER_OF_WAITS 10000 #define HEAP_SIZE 1024*1024 volatile long long *heap=NULL; // typedef int (*do_mlock_fpt0r_t)( unsigned long start, size_t len, int on); // do_mlock_fptr_t do_mlock = (do_mlock_fptr_t)0xc0128538; void * start_routine(void *arg) { unsigned int i=0; unsigned int j=0; hrtime_t start=0; hrtime_t finish=0; rtl_printf("RTLinux Reserve_cpu thread starts on cpu %d\n", hw_smp_processor_id()); for( i = 0; i < HEAP_SIZE; i++ ) { rtl_printf("Processor %d: Accessing Element %d, Address is %x \n", hw_smp_processor_id(), i, &(heap[i]) ); nanosleep(hrt2ts(5000000UL), NULL); heap[i] = 31459; } rtl_printf("Thread %d Completed Init of HEAP\n", hw_smp_processor_id()); pthread_kill(pthread_linux(), RTL_SIG_SUSPEND_LINUX);/* off */ for(i=0; i < NUMBER_OF_WAITS; i++) { nanosleep(hrt2ts(5000000UL), NULL); } rtl_printf("RTLinux Reserve_cpu demo (%d): Linux is asleep numcpus=%d\n", hw_smp_processor_id(), smp_num_cpus); start = clock_gethrtime(CLOCK_RTL_SCHED); finish = clock_gethrtime(CLOCK_RTL_SCHED); while( finish < start + (hrtime_t)100000000000 ) { finish = clock_gethrtime(CLOCK_RTL_SCHED); for( j = 0; j < HEAP_SIZE; j++ ) heap[j] = 31459; } rtl_printf("RESERVE Test (%d): Completed Epoch %d \n", hw_smp_processor_id(), i); pthread_kill(pthread_linux(), RTL_SIG_RESTART_LINUX);/* on */ rtl_printf("RTLinux RESERVE DEMO: end numcpus=%d\n",smp_num_cpus); return 0; } int init_module(void) { int i; pthread_attr_t attr; heap = (long long *) vmalloc( (sizeof( long long) * HEAP_SIZE) ); // if( do_mlock( heap, (sizeof( long long) * HEAP_SIZE), 1) == 0 ) // { // rtl_printf("do_mlock: failed \n"); // return 0; // } if( heap == NULL ) { rtl_printf("kmalloc(%d) failed to provide memory space %d \n", hw_smp_processor_id(), (sizeof( long long) * HEAP_SIZE)); return 0; } for( i = 0; i < HEAP_SIZE; i++ ) { // rtl_printf("E %d, Addr %x \n", i, &(heap[i]) ); heap[i] = 31459; } pthread_attr_init (&attr); pthread_attr_setcpu_np(&attr, 1); pthread_create (&thread1, &attr, start_routine, 0); pthread_attr_setcpu_np(&attr, 0); return pthread_create (&thread0, &attr, start_routine, 0); // return 0; } void cleanup_module(void) { pthread_delete_np (thread1); pthread_delete_np (thread0); // vmfree( heap ); pthread_kill(pthread_linux(), RTL_SIG_RESTART_LINUX);/* on */ printk("RTLinux RESERVE DEMO: cleanup numcpus=%d\n",smp_num_cpus); } -- [rtl] --- To unsubscribe: echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED] -- For more information on Real-Time Linux see: http://www.rtlinux.org/rtlinux/