Re: [rtl] SMP mutex/scheduling problem ?
On Monday 01 October 2001 04:59 pm, Calin A. Culianu wrote: Hmm.. just playing around with pointers should not take that long (unless you are like on a 16 MHz 386sx or something). Here's one possible explanation that doesn't really account for the 5ms run-time of each thread, but does account for the observed phenomenon that 1 thread running 1 task will display significantly lower run times than 2 threads that share a mutex running the same task: 1) Thread A acquires lock 2) Thread B wants lock, but can't get it so sleeps 3) Thread A does work that takes time T 4) Thread A releases lock 5) Thread B is immediately awoken because it was next-in-line for the mutex 6) Thread B does work that takes roughly time T as well 7) Thread B releases lock 8) goto (1) As you can see, thread B did work that took time T, but ended up taking over 2T's work of time to do it. Now this is a sort of obvious example.. but could it be enough to explain your really long run times? Maybe if you posted some code I might be able to help better? Thanks... -Calin Thanks a lot for your help, here is the code: - Hardware : Bi processor PIII 1 GHz 512Mo - Software : Redhat 7.1 Kernel 2.4.4 from kernel.org RT-Linux 3.1 - pthread_attr_t attr1,attr2; struct sched_param sched_param1,sched_param2; pthread_t pthread_test1; pthread_t pthread_test2; intcounter1 = 0; intduration1= 0; intcpu1 = 100; intcounter2 = 0; intduration2= 0; intcpu2 = 100; extern struct mem_pool *mem; extern volatile char *shm; //-- void *thread_test1(void* notusedP) { //-- hrtime_t start, end, process; struct mem_block *mb; pthread_attr_getcpu_np(attr1, cpu1); pthread_make_periodic_np(pthread_self(), gethrtime(), 1000); while (1) { pthread_wait_np(); start = gethrtime(); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); end = gethrtime(); process = end - start; if (process 100) { counter1+=1; duration1 += process; } } } //-- void *thread_test2(void* notusedP) { //-- hrtime_t start, end,process; struct mem_block *mb; pthread_attr_getcpu_np(attr2, cpu2); pthread_make_periodic_np(pthread_self(), gethrtime(), 9900); while (1) { pthread_wait_np(); start = gethrtime(); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); end = gethrtime(); process = end - start; if (process 100) { counter2+=1; duration2 += process; } } } //-- int init_module(void) { //-- pthread_attr_t attr; struct sched_param sched_param; long int shm_size; intresult, i; intret, index; shm_size = sizeof(struct mem_pool); printk(shm size = %ld bytes\n, shm_size); shm_size = (shm_size ~((long int)0x)) + 0x1;// alloc by 64Kbytes printk(mbuff_alloc %ld Kbytes\n, shm_size10); shm = (volatile char*) mbuff_alloc(wcdma,shm_size); if(shm == NULL) { printk(mbuff_alloc failed\n); return(2); } printk(mbuff_alloc succeed mem_pool=%p\n, shm); mem = (struct mem_pool *)shm; /**/ /* discovering processor IDs */ /**/ nb_processors = 0; printk(Found processor IDs );
Re: [rtl] FW: Floating Point in Real-Time Kernel
On Monday 01 October 2001 17:44, you wrote: Does anyone know any more than I do about floating point? Any comments would be greatly appreciated. Hi, just .02$: if you use mmx-functions, don't forget to call emms(); at the end, to re-initialise the floating-point unit! ineiti -- [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/
[rtl] fp-how?
I am new to rtlinux and a present am trying my hardest to use floating point arithmetic. I have used the function pthread_setfp_np(pthread_self(), 1) within my thread to enable me to carry out floating point operations. But have had no success. I print out the result using rtl_printf. Is there something else I should be doing. I have read the gettingStarted.txt file and followed its instruction and I have tried running the fp example. Regarding the example I followed Phil Wilshire instructions as to how to compile and run the fp programme. However though this was successful he didn't explain what the programme was meant to do our how you new it was working. David Renishaw plc Scotland This email and any attachments are confidential and are for the use of the addressee only. If you are not the addressee, you must not use or disclose the contents to any other person. Please immediately notify the sender and delete the email. Statements and opinions expressed here may not represent those of the company. Email correspondence is monitored by the company. The parent company of the Renishaw Group is Renishaw plc, registered in England no. 1106260. Registered Office: New Mills, Wotton-under-Edge Gloucestershire, GL12 8JR, United Kingdom. Tel +44 (0) 1453 524524 --- -- [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/
RE: [rtl] RT-Linux patch proposal for RTF size queryage
On Mon, 1 Oct 2001, Norm Dresner wrote: - Original Message - Second, please don't interpret what I said as meaning that a FIFO-fullness function is worthless. I have myself hacked up an older version of RTLinux to make certain normally internal FIFO routine variables public so I could in fact do just that. What I was saying was that in the most general setting it's worthless because of the multi-tasking (or SMP) nature of the processing. I tried Just use spin-locks. To say its entirely worthles, might, in my opinions be a bit strongly dismissive. Spin-locks in user-space? Norm -- [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/
RE: [rtl] fp-how?
David, rtl_printf does not support floating point numbers. You have to pass the data to user space using a fifo or shared memory and print the value from there. Regards, Rich -Original Message- From: David Armstrong [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 02, 2001 1:58 AM To: '[EMAIL PROTECTED]' Subject: [rtl] fp-how? I am new to rtlinux and a present am trying my hardest to use floating point arithmetic. I have used the function pthread_setfp_np(pthread_self(), 1) within my thread to enable me to carry out floating point operations. But have had no success. I print out the result using rtl_printf. Is there something else I should be doing. I have read the gettingStarted.txt file and followed its instruction and I have tried running the fp example. Regarding the example I followed Phil Wilshire instructions as to how to compile and run the fp programme. However though this was successful he didn't explain what the programme was meant to do our how you new it was working. David Renishaw plc Scotland This email and any attachments are confidential and are for the use of the addressee only. If you are not the addressee, you must not use or disclose the contents to any other person. Please immediately notify the sender and delete the email. Statements and opinions expressed here may not represent those of the company. Email correspondence is monitored by the company. The parent company of the Renishaw Group is Renishaw plc, registered in England no. 1106260. Registered Office: New Mills, Wotton-under-Edge Gloucestershire, GL12 8JR, United Kingdom. Tel +44 (0) 1453 524524 --- -- [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/ -- [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/
RE: [rtl] rtl_sched.c: rtl_switch_to and floating point support
At a certain point in time I believed that the switch occurs when the ret instruction of the rtl_switch_to(). I don't think that the switch occurs when the register contents are restored though. The stack may be changed but the change will not take any effect until the ret instruction which return the IP register to the caller which now changes to the other tasks instructions. However, now, I am not so sure about that. It seems to me that the switch actually occurs after the rtl_schedule() returns. Although the rtl_switch_to() code suggests other wise. You can see this by turn on the tracer. You will see after the rtl_switch event there is schedule_out event which is occur at the end of the rtl_schedule() code. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] On Behalf Of Mario Taschwer Sent: Thursday, September 27, 2001 3:42 AM To: [EMAIL PROTECTED] Subject: Re: [rtl] rtl_sched.c: rtl_switch_to and floating point support On Wed, Sep 26, 2001 at 10:38:57AM +0200, Franz Hollerer wrote: Hi! I have some troubles understanding the scheduler source code. Maybe someone can give me some hints. Thx. Task switching -- Task switching is done in rtl_schedule by calling rtl_switch_to(). The switch occurs when the ret instruction of rtl_switch_to() is carried out. At this point a new task runs. The remainder of rtl_schedule is postponed until the previous task is activated again. Actually, the switch occurs when the register contents (including the stack pointer) of the new task are restored. This happens inside rtl_switch_to. Right? If so I have problems with the floating point support. Why are the floating point registers saved and restored after the call to rtl_switch_to(). Isn't it to late to do this here, because the switch to the task has already occurred and been carried out? RTLinux only switches the FP context if the new task needs the FPU. Note that the Linux task is always assumed to use the FPU. The FP switch is not too late, because the new task will not use the FP registers before control returns to the application module (or to Linux). Mario Taschwer -- [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/ -- [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/
Re: [rtl] virtual memory
On Mon, Oct 01, 2001 at 10:53:44AM -0400, Calin A. Culianu wrote: On Sat, 29 Sep 2001, Chunky Kibbles wrote: On Fri, Sep 28, 2001 at 01:14:46PM -0700, A V wrote: Hi, Does RTLinux uses virtual memory ? I hope not. Becaz real-time kernel should not use virtual memory. But in our RTLinux the module loading is taken care of by Linux kernel. Am i right ? Linux kernel uses virtual memory. How can Linux kernel know that it should not use virtual memory for RT-processes ? Please clear my doubt. Yes, the kernel support full virtual memory; there's no point in it not doing so. The memory, though comes in two varieties for this situation: kernel-space, and user-space. Kernel-space memory will never get swapped out, but user-space memory can be. RT Linux code actually runs as a kernel module [at least, the bit you code to be actual hard real-time]. This module runs in kernel-space, so will never get swapped out. Here's a bit of linux not-so-trivial trivia that I want clarified: Kernel memory doesn't get swapped out in linux, period.. right? I know some other OS kernels (especially microkernels) sometimes like to page out outter parts of the kernel If it's part of the kernel, it's not swapped. Full stop. Modules are considered part of the kernel Gary (-; -- [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/
RE: [rtl] FW: Floating Point in Real-Time Kernel
HI clould u pls tell me what is mmx-functions, thanks chandu -Original Message- From: Linus Gasser [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 02, 2001 2:56 PM To: [EMAIL PROTECTED] Subject: Re: [rtl] FW: Floating Point in Real-Time Kernel On Monday 01 October 2001 17:44, you wrote: Does anyone know any more than I do about floating point? Any comments would be greatly appreciated. Hi, just .02$: if you use mmx-functions, don't forget to call emms(); at the end, to re-initialise the floating-point unit! ineiti -- [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/ *** Disclaimer: This document is intended for transmission to the named recipient only. If you are not that person, you should note that legal rights reside in this document and you are not authorized to access, read, disclose, copy, use or otherwise deal with it and any such actions are prohibited and may be unlawful. The views expressed in this document are not necessarily those of HCL Technologies Ltd. Notice is hereby given that no representation, contract or other binding obligation shall be created by this e-mail, which must be interpreted accordingly. Any representations, contractual rights or obligations shall be separately communicated in writing and signed in the original by a duly authorized officer of the relevant company. *** -- [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/
[rtl] Problem compiling RTLinux kernel
Hello, I've downloaded several versions of RTLinux (2.2 and 3.0) and followed the installations carefully. However, the 'make bzImage' compilation always breaks down at file checksum.S error message checksum.S:231: badly punctuated parameter list in #define checksum.S:237: badly punctuated parameter list in #define These lines are Macro definitions in an assembler file, and I've no idea what could be wrong with them. My compiler is gcc version 2.96 2731 on Red Hat Linux 7.1 2.96-81, Kernel 2.4.2 The processor is an AMD K6. Whats going on? Surely, many people have compiled this successfully on similar machines. Please help, David -- [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/
Re: [rtl] SMP mutex/scheduling problem ?
Well, I can't see what the problem is. I was thinking maybe your use of locks left one CPU thread waiting for the other CPU for a while, but that doesn't seem like it would happen here. So each of these threads, when run alone, takes very little time to execute, but run concurrently (1 per cpu) they each take a very long time? Hmmm. One other possibility is overflow of the 'duration' variable.. but.. even if that happens you would probably get reported run times that are LOW not high... and at any rate I don't see why each of those loops should take even longer than 1ms to process. Very strange indeed! On Tue, 2 Oct 2001, Lionel Gauthier wrote: On Monday 01 October 2001 04:59 pm, Calin A. Culianu wrote: Hmm.. just playing around with pointers should not take that long (unless you are like on a 16 MHz 386sx or something). Here's one possible explanation that doesn't really account for the 5ms run-time of each thread, but does account for the observed phenomenon that 1 thread running 1 task will display significantly lower run times than 2 threads that share a mutex running the same task: 1) Thread A acquires lock 2) Thread B wants lock, but can't get it so sleeps 3) Thread A does work that takes time T 4) Thread A releases lock 5) Thread B is immediately awoken because it was next-in-line for the mutex 6) Thread B does work that takes roughly time T as well 7) Thread B releases lock 8) goto (1) As you can see, thread B did work that took time T, but ended up taking over 2T's work of time to do it. Now this is a sort of obvious example.. but could it be enough to explain your really long run times? Maybe if you posted some code I might be able to help better? Thanks... -Calin Thanks a lot for your help, here is the code: - Hardware : Bi processor PIII 1 GHz 512Mo - Software : Redhat 7.1 Kernel 2.4.4 from kernel.org RT-Linux 3.1 - pthread_attr_t attr1,attr2; struct sched_param sched_param1,sched_param2; pthread_t pthread_test1; pthread_t pthread_test2; intcounter1 = 0; intduration1= 0; intcpu1 = 100; intcounter2 = 0; intduration2= 0; intcpu2 = 100; extern struct mem_pool *mem; extern volatile char *shm; //-- void *thread_test1(void* notusedP) { //-- hrtime_t start, end, process; struct mem_block *mb; pthread_attr_getcpu_np(attr1, cpu1); pthread_make_periodic_np(pthread_self(), gethrtime(), 1000); while (1) { pthread_wait_np(); start = gethrtime(); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); end = gethrtime(); process = end - start; if (process 100) { counter1+=1; duration1 += process; } } } //-- void *thread_test2(void* notusedP) { //-- hrtime_t start, end,process; struct mem_block *mb; pthread_attr_getcpu_np(attr2, cpu2); pthread_make_periodic_np(pthread_self(), gethrtime(), 9900); while (1) { pthread_wait_np(); start = gethrtime(); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); mb = get_free_mem_block(200); free_mem_block(mb); end = gethrtime(); process = end - start; if (process 100) { counter2+=1; duration2 += process; } } } //-- int init_module(void) { //-- pthread_attr_t
Re: [rtl] fp-how?
Alternately, if you know the approximate range of the number -- you do know the approximate range of the number, don't you? -- you can do some integer math and compute the integer and fractional parts and create an ASCII representation that way. Norm - Original Message - From: Basham, Richard R [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Tuesday, October 02, 2001 9:44 AM Subject: RE: [rtl] fp-how? David, rtl_printf does not support floating point numbers. You have to pass the data to user space using a fifo or shared memory and print the value from there. Regards, Rich -Original Message- From: David Armstrong [mailto:[EMAIL PROTECTED]] Sent: Tuesday, October 02, 2001 1:58 AM To: '[EMAIL PROTECTED]' Subject: [rtl] fp-how? I am new to rtlinux and a present am trying my hardest to use floating point arithmetic. I have used the function pthread_setfp_np(pthread_self(), 1) within my thread to enable me to carry out floating point operations. But have had no success. I print out the result using rtl_printf. Is there something else I should be doing. I have read the gettingStarted.txt file and followed its instruction and I have tried running the fp example. Regarding the example I followed Phil Wilshire instructions as to how to compile and run the fp programme. However though this was successful he didn't explain what the programme was meant to do our how you new it was working. David Renishaw plc Scotland - --- This email and any attachments are confidential and are for the use of the addressee only. If you are not the addressee, you must not use or disclose the contents to any other person. Please immediately notify the sender and delete the email. Statements and opinions expressed here may not represent those of the company. Email correspondence is monitored by the company. The parent company of the Renishaw Group is Renishaw plc, registered in England no. 1106260. Registered Office: New Mills, Wotton-under-Edge Gloucestershire, GL12 8JR, United Kingdom. Tel +44 (0) 1453 524524 --- -- [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/ -- [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/ -- [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/
[rtl] Is there a v3.1?
What isversion 3.1 ... I've seen it mention on the mailing list and see it in the FTP site. But the web site still say 3.0 is the lastest. Is 3.1 for real? I been developing on 3.0 with rethat 6.2...But would like try RH7.1 and the newer 3.1. Is this recommended? Tony /-\ | Tony Denault| Internet: [EMAIL PROTECTED] | | NASA IRTF, Institute of Astronomy | Phone: (808) 974-4206 | | 1175 Manono St., Bldg 393 | Fax: (808) 974-4207 | | Hilo, Hawaii 96720 | | \-/ -- [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/
RE: [rtl] FW: Floating Point in Real-Time Kernel
-Original Message- From: Chandu Reddy K - CTD, Chennai. [mailto:[EMAIL PROTECTED]] Sent: Dienstag, 02. Oktober 2001 18:01 To: [EMAIL PROTECTED] Subject: RE: [rtl] FW: Floating Point in Real-Time Kernel HI clould u pls tell me what is mmx-functions, Have a look at http://developer.intel.com/design/intarch/techinfo/pentium/mmxprog.htm Regards, Bernd -- [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/
Re: [rtl] Problem compiling RTLinux kernel
You need to use the egcs-compat compiler provided with Redhat 7 to compile the Linux kernel. On Tue, Oct 02, 2001 at 04:35:06PM +0100, David Hamilton wrote: Hello, I've downloaded several versions of RTLinux (2.2 and 3.0) and followed the installations carefully. However, the 'make bzImage' compilation always breaks down at file checksum.S error message checksum.S:231: badly punctuated parameter list in #define checksum.S:237: badly punctuated parameter list in #define These lines are Macro definitions in an assembler file, and I've no idea what could be wrong with them. My compiler is gcc version 2.96 2731 on Red Hat Linux 7.1 2.96-81, Kernel 2.4.2 The processor is an AMD K6. Whats going on? Surely, many people have compiled this successfully on similar machines. Please help, David -- [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/ -- [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/