Re: SMP driver core lock real-time driver
Paolo Mantegazza <[email protected]> Tue, 21 Nov 2017 12:24:22 +0100
| Newsgroups | gmane.linux.real-time.rtai |
|---|---|
| Message-ID | <[email protected]> |
I beg you pardon but, since I do not see where RTAI has a place in all of this, I'm a bit confused. When I want to set aside cpus dedicated to RTAI, I'll do it by setting the needed cpumask while insmoding rtai_hal.ko In such a case there still remains some linux stuff, e.g, dynamically created workqs and timers interrupts, but it helps RTAI jitter and latency anyhow. Morevor if I want to keep my dedicated cpus awake, always, I simple bind an idle (user space) "while(1)" task to my dedicated cpus. Old style idel task getting read of all the troublesome energy savings. I experimented also with a more aggressive policy, i.e. try to move/kill any task still remaining on the reserved cpus, but, even if RTAI hard stuff kept running, it caused troubles to Linux. Perhaps I'm likely missing something. Is it possible I missed a previous email of yours? Paolo. On 11/21/2017 09:19 AM, Asier wrote: > > *Hi Doug,* > > ** > > *maybe you could try to somehow tell Linux that the core is no longer > available/online. Could you try one of the following alternatives?* > > ** > > *1- while the task is on the busy wait execute something like this: > (where * is the desired cpu core)* > > ** > > *echo 0 > /sys/devices/system/cpu/cpu*/online* > > ** > > *2- Another alternative could be to call this function * > > ** > > *int cpu_down(unsigned int cpu);* > > ** > > *cheers,* > > *Asier.* > > > On Tue, Nov 21, 2017 at 3:40 AM, Doug Renton <[email protected] > <mailto:[email protected]>> wrote: > > > I cut and pasted a kernel module, and made it do busy work, until > the kernel decided it had found a bug. While the busy work was > going on, everything seemed fine, could not tell one core was busy. > > Everything seems to run fine with one core doing my made up task, > until eventually the kernel decides it has found a bug. > With the loops at something reasonable like 999, everything runs > fine and my task ends. Once turned up to 999999, the kernel > eventually gives my module the boot. Looks like this could be > tricky. I still can't see why we cant just simplify everything and > dedicate one/two core(s) to RTAI, and busy wait. > > > [ 189.566739] Timer module installing > [ 189.566743] Starting timer to fire in 200ms (4294939693) > [ 189.763714] my_timer_callback called (4294939743). > [ 216.060934] NMI watchdog: BUG: soft lockup - CPU#1 stuck for > 23s! [swapper/1:0] > [ 216.060945] Modules linked in: hello_2(O) Bla Bla Bla... > > > /* > * hello-2.c - Demonstrating the module_init() and module_exit() > macros. > * This is preferred over using init_module() and cleanup_module(). > */ > #include <linux/module.h> /* Needed by all modules */ > #include <linux/kernel.h> /* Needed for KERN_INFO */ > #include <linux/init.h> /* Needed for the macros */ > #include <linux/timer.h> > > MODULE_LICENSE("GPL"); > > static struct timer_list my_timer; > > void my_timer_callback( unsigned long data ) > { > int delay = 0; > int delay2; > int delay3; > int delay4; > volatile int glob_test; > > glob_test = 1000000; > > > printk( "my_timer_callback called (%ld).\n", jiffies ); > for ( delay4 = 0; delay4 < 99; delay4 += 1) > { > for ( delay3 = 0; delay3 < 99; delay3 += 1) > { > for ( delay2 = 0; delay2 < 99; delay2 += 1) > { > //printk( "my_timer_callback loop %d.\n",delay2); > for( delay = 0; delay < 99; delay += 1) > { > if (delay > glob_test) { printk("What??\n");} > } > } > } > } > printk( "my_timer_callback done.\n" ); > } > > > static int __init hello_2_init(void) > { > int ret; > printk("Timer module installing\n"); > > // my_timer.function, my_timer.data > setup_timer( &my_timer, my_timer_callback, 0 ); > > printk( "Starting timer to fire in 200ms (%ld)\n", jiffies ); > ret = mod_timer( &my_timer, jiffies + msecs_to_jiffies(200) ); > if (ret) printk("Error in mod_timer\n"); > return 0; > } > > static void __exit hello_2_exit(void) > { > // printk(KERN_INFO "Goodbye, world 2\n"); > int ret; > ret = del_timer( &my_timer ); > if (ret) printk("The timer is still in use...\n"); > > printk("Timer module uninstalling\n"); > > } > > module_init(hello_2_init); > module_exit(hello_2_exit); > > > _______________________________________________ > Rtai mailing list > [email protected] <mailto:[email protected]> > https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai > <https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai> > > > > > _______________________________________________ > Rtai mailing list > [email protected] > https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai _______________________________________________ Rtai mailing list [email protected] https://mail.rtai.org/cgi-bin/mailman/listinfo/rtai