diff options
Diffstat (limited to 'libdde_linux26/examples/bug_timersleep/.svn')
7 files changed, 386 insertions, 0 deletions
diff --git a/libdde_linux26/examples/bug_timersleep/.svn/all-wcprops b/libdde_linux26/examples/bug_timersleep/.svn/all-wcprops new file mode 100644 index 00000000..e0897b47 --- /dev/null +++ b/libdde_linux26/examples/bug_timersleep/.svn/all-wcprops @@ -0,0 +1,29 @@ +K 25 +svn:wc:ra_dav:version-url +V 74 +/repos/tudos/!svn/ver/455/trunk/l4/pkg/dde/linux26/examples/bug_timersleep +END +main.c +K 25 +svn:wc:ra_dav:version-url +V 81 +/repos/tudos/!svn/ver/455/trunk/l4/pkg/dde/linux26/examples/bug_timersleep/main.c +END +WhatIsThis +K 25 +svn:wc:ra_dav:version-url +V 85 +/repos/tudos/!svn/ver/443/trunk/l4/pkg/dde/linux26/examples/bug_timersleep/WhatIsThis +END +Makeconf.local +K 25 +svn:wc:ra_dav:version-url +V 89 +/repos/tudos/!svn/ver/455/trunk/l4/pkg/dde/linux26/examples/bug_timersleep/Makeconf.local +END +Makefile +K 25 +svn:wc:ra_dav:version-url +V 83 +/repos/tudos/!svn/ver/455/trunk/l4/pkg/dde/linux26/examples/bug_timersleep/Makefile +END diff --git a/libdde_linux26/examples/bug_timersleep/.svn/entries b/libdde_linux26/examples/bug_timersleep/.svn/entries new file mode 100644 index 00000000..4475ed37 --- /dev/null +++ b/libdde_linux26/examples/bug_timersleep/.svn/entries @@ -0,0 +1,164 @@ +9 + +dir +465 +http://svn.tudos.org/repos/tudos/trunk/l4/pkg/dde/linux26/examples/bug_timersleep +http://svn.tudos.org/repos/tudos + + + +2009-05-20T14:32:55.606606Z +455 +l4check + + +svn:special svn:externals svn:needs-lock + + + + + + + + + + + +a704ac0b-3a55-4d43-a2a9-7be6f07c34fb + +main.c +file + + + + +2009-11-15T17:17:14.000000Z +9ef2d314e37201c0d6813c088a9bdf9b +2009-05-20T14:32:55.606606Z +455 +l4check + + + + + + + + + + + + + + + + + + + + + +3348 + +WhatIsThis +file + + + + +2009-11-15T17:17:14.000000Z +b3d846298a511fba776c557db5645ad7 +2009-03-26T03:50:31.959106Z +443 +l4check + + + + + + + + + + + + + + + + + + + + + +504 + +Makeconf.local +file + + + + +2009-11-15T17:17:14.000000Z +075b1f05a72c4dc89dcd7e4e97e3da21 +2009-05-20T14:32:55.606606Z +455 +l4check + + + + + + + + + + + + + + + + + + + + + +108 + +Makefile +file + + + + +2009-11-15T17:17:14.000000Z +896d9d28b3e9e8626a8229ba171f9890 +2009-05-20T14:32:55.606606Z +455 +l4check + + + + + + + + + + + + + + + + + + + + + +585 + diff --git a/libdde_linux26/examples/bug_timersleep/.svn/format b/libdde_linux26/examples/bug_timersleep/.svn/format new file mode 100644 index 00000000..ec635144 --- /dev/null +++ b/libdde_linux26/examples/bug_timersleep/.svn/format @@ -0,0 +1 @@ +9 diff --git a/libdde_linux26/examples/bug_timersleep/.svn/text-base/Makeconf.local.svn-base b/libdde_linux26/examples/bug_timersleep/.svn/text-base/Makeconf.local.svn-base new file mode 100644 index 00000000..28ebade5 --- /dev/null +++ b/libdde_linux26/examples/bug_timersleep/.svn/text-base/Makeconf.local.svn-base @@ -0,0 +1 @@ +#LIBS += -lferret_client -lferret_producer -lferret_util -lferret_comm -lferret_fpages -lferret_local_names diff --git a/libdde_linux26/examples/bug_timersleep/.svn/text-base/Makefile.svn-base b/libdde_linux26/examples/bug_timersleep/.svn/text-base/Makefile.svn-base new file mode 100644 index 00000000..a1f39f00 --- /dev/null +++ b/libdde_linux26/examples/bug_timersleep/.svn/text-base/Makefile.svn-base @@ -0,0 +1,25 @@ +PKGDIR ?= ../../.. +L4DIR ?= $(PKGDIR)/../.. + +SYSTEMS = x86-l4v2 + +DEFAULT_RELOC = 0x00a00000 + +-include $(PKGDIR_OBJ)/Makeconf + +TARGET = dde26_bug_timersleep + +SRC_C = main.c + +LIBS += -ldde_linux26.o -lddekit -lio -lomega0 -llist_alloc + +PRIVATE_INCDIR = $(PKGDIR_ABS)/linux26/include $(MY_DDE_INCDIR) $(MY_LINUX26_INCDIR) \ + $(OBJ_BASE)/include/uclibc + +LIBCINCDIR = -nostdinc $(I_GCCINCDIR) +DEFINES = -D__KERNEL__ -DDDE_LINUX $(KBUILD_DEFINES) +CPPFLAGS += $(KBUILD_CPPFLAGS) + +include $(PKGDIR)/linux26/Makeconf + +include $(L4DIR)/mk/prog.mk diff --git a/libdde_linux26/examples/bug_timersleep/.svn/text-base/WhatIsThis.svn-base b/libdde_linux26/examples/bug_timersleep/.svn/text-base/WhatIsThis.svn-base new file mode 100644 index 00000000..3fb57408 --- /dev/null +++ b/libdde_linux26/examples/bug_timersleep/.svn/text-base/WhatIsThis.svn-base @@ -0,0 +1,16 @@ +=== Bug reported by Andre Puschmann === + +main.c contains Linux kernel code that triggers 2 problems: + +1) list order violation in the list alloc lib +2) threads hang after scheduling a very short timer, because + the timer thread seems to miss some events + + +Fixes +===== +1) correct locking for ddekit's memory allocation functions + solves the problem +2) fixed DDEKit's timer implementation to not use IPC for + notifications (because some got lost for atomicity reasons) + but use a counting semaphore diff --git a/libdde_linux26/examples/bug_timersleep/.svn/text-base/main.c.svn-base b/libdde_linux26/examples/bug_timersleep/.svn/text-base/main.c.svn-base new file mode 100644 index 00000000..a02e6841 --- /dev/null +++ b/libdde_linux26/examples/bug_timersleep/.svn/text-base/main.c.svn-base @@ -0,0 +1,150 @@ +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/string.h> +#include <linux/slab.h> +#include <linux/delay.h> +#include <linux/device.h> +#include <linux/version.h> +#include <linux/kthread.h> + +//BEER for L4 +#include <l4/sys/kdebug.h> +#include <l4/util/util.h> +#include <l4/dde/linux26/dde26.h> + +#if 0 +#include <l4/ferret/client.h> +#include <l4/ferret/clock.h> +#include <l4/ferret/types.h> +#include <l4/ferret/util.h> +#include <l4/ferret/sensors/list_producer.h> +#include <l4/ferret/sensors/list_producer_wrap.h> +#endif + +static int idle_thread(void *); +int __init init_module(void); +void __exit cleanup_module(void); +#if 0 +ferret_list_local_t *sensor; +#endif + +enum Events +{ + DDE_INIT = 10, + DDE_INITCALLS = 11, + INIT_MODULE = 12, + START_THREAD = 13, + THREAD_INIT = 14, + THREAD_SLEEP_START = 15, + THREAD_SLEEP_END = 16 +}; + +atomic_t val = ATOMIC_INIT(0); + +static int idle_thread(void *priv_data) +{ + int master_thread_counter = 0; +#if 0 + ferret_list_post_1t1wc(1, sensor, 42, 1, 0, me,THREAD_INIT); +#endif + + while (1) + { + master_thread_counter++; + if ((master_thread_counter % 100) == 0) + atomic_inc(&val); +#if 0 + printk(KERN_INFO "master_thread_counter: %d jiffies: %d\n", + master_thread_counter, jiffies); +#endif + + // do something interesting + + // wait for 10ms assuming HZ=100 + set_current_state(TASK_INTERRUPTIBLE); +// ferret_list_post_1t1wc(1, sensor, 42, 1, 0, me,THREAD_SLEEP_START); + schedule_timeout(1); +// ferret_list_post_1t1wc(1, sensor, 42, 1, 0, me,THREAD_SLEEP_END); + //msleep(10); + } +} + +int __init init_module(void) +{ + int i; + printk(KERN_INFO "init module\n"); + + for (i = 0; i < 10; i++) + { +// ferret_list_post_1t1wc(1, sensor, 42, 1, 0, l4_myself(),START_THREAD); + kthread_run(idle_thread, NULL, "IDLE THREAD"); + udelay(1000); + } + // no error check + return 0; +} + +void __exit cleanup_module(void) +{ + printk(KERN_INFO "exit module\n"); + // kill thread +} + +MODULE_AUTHOR("test"); +MODULE_DESCRIPTION("test"); +MODULE_LICENSE("GPL"); + +static void *kmalloc_wrap(size_t sz) +{ return kmalloc(sz,GFP_KERNEL); } + +int main(void) +{ + int old, v = 12000; + printk("Initializing Ferret\n"); +#if 0 + int ret = ferret_create(42, 1, 0, FERRET_LIST, 0, + "64:100000", sensor, &kmalloc_wrap); + printk("Created sensor: %d\n", ret); + + ferret_list_post_1t1wc(1, sensor, 42, 1, 0, l4_myself(),DDE_INIT); +#endif + printk("Initializing DDE base system.\n"); + +#if 0 + ferret_list_post_1t1wc(1, sensor, 42, 1, 0, l4_myself(),DDE_INITCALLS); +#endif + +#if 0 + ferret_list_post_1t1wc(1, sensor, 42, 1, 0, l4_myself(),INIT_MODULE); +#endif + init_module(); + + while (1) + { + l4_sleep(3000); + old = v; + v = atomic_read(&val); + printk("%d - %d = %d\n", v, old, v-old); + if (v - old == 0) + { + printk("System halt!? %d\n", v); + //enter_kdebug(".."); +#if 0 + ferret_list_entry_common_t * elc; + + int idx = ferret_list_dequeue(sensor); + elc = (ferret_list_entry_common_t *)ferret_list_e4i(sensor->glob, idx); + elc->major = FERRET_MONCON_MAJOR; + elc->minor = FERRET_MONCON_SERSEND; + strncpy(elc->data8, "foobar", 7); + ferret_list_commit(sensor, idx); + printk("Dumped %d\n", idx); + l4_sleep(10000); +#endif + enter_kdebug(""); + } + } + + l4_sleep_forever(); + return -1; +} |