POSIX timers interface for IA64
Subsystems (3)
Hello,
Here is a patch to have the POSIX timer interface completly integrated in ia64 (2.5.64). The programs in userland can now access the siginfo structure. With that patch the test programs of the high resolution timers pass without error but one which seems to also be triggered on
ix86: nanosleeps too short.
I did the same modifications to the ia32 support but I wasn't able to test them.
A (modified) patch of George Anzinger cleaning up long/int confusion in idr.c is also included.
Hoping you will find this useful.
Eric
Makefile +1 -1
@@ -1,7 +1,7 @@ VERSION = 2 PATCHLEVEL = 5 SUBLEVEL = 64 -EXTRAVERSION = +EXTRAVERSION = eric-posix-timers-2 # *DOCUMENTATION* # To see a list of typical targets execute "make help"
arch/ia64/ia32/ia32_signal.c +5 -0
@@ -148,6 +148,11 @@ err |=__put_user (from->si_band, &to->si_band); err |=__put_user (from->si_fd, &to->si_fd);break ; +case __SI_TIMER >>16 : + err |=__put_user (from->si_tid, &to->si_tid); + err |=__put_user (from->si_overrun, &to->si_overrun); + err |=__put_user (from->si_ptr, &to->si_ptr);/*XXX eric: not sure the size is correct because it contains pointer*/ +break ;/* case __SI_RT: This is not generated by the kernel as of now. */ } }
arch/ia64/kernel/fsys.S +9 -9
@@ -533,15 +533,15 @@ data8 fsys_fallback_syscall // epoll_wait // 1245 data8 fsys_fallback_syscall // restart_syscall data8 fsys_fallback_syscall // semtimedop - data8 fsys_fallback_syscall - data8 fsys_fallback_syscall - data8 fsys_fallback_syscall // 1250 - data8 fsys_fallback_syscall - data8 fsys_fallback_syscall - data8 fsys_fallback_syscall - data8 fsys_fallback_syscall - data8 fsys_fallback_syscall // 1255 - data8 fsys_fallback_syscall + data8 fsys_fallback_syscall // timer_create + data8 fsys_fallback_syscall // timer_settime + data8 fsys_fallback_syscall // timer_gettime // 1250 + data8 fsys_fallback_syscall // timer_getoverrun + data8 fsys_fallback_syscall // timer_delete + data8 fsys_fallback_syscall // clock_settime + data8 fsys_fallback_syscall // clock_gettime + data8 fsys_fallback_syscall // clock_getres // 1255 + data8 fsys_fallback_syscall // clock_nanosleep data8 fsys_fallback_syscall data8 fsys_fallback_syscall data8 fsys_fallback_syscall
arch/ia64/kernel/signal.c +4 -0
@@ -191,6 +191,10 @@ err |=__put_user (from->si_pfm_ovfl[2 ], &to->si_pfm_ovfl[2 ]); err |=__put_user (from->si_pfm_ovfl[3 ], &to->si_pfm_ovfl[3 ]); } +case __SI_TIMER >>16 : + err |=__put_user (from->si_tid, &to->si_tid); + err |=__put_user (from->si_overrun, &to->si_overrun); + err |=__put_user (from->si_value, &to->si_value);break ;default : err |=__put_user (from->si_uid, &to->si_uid);
arch/ia64/kernel/time.c +1 -0
@@ -110,6 +110,7 @@ time_esterror =NTP_PHASE_LIMIT ; }write_sequnlock_irq (&xtime_lock); +clock_was_set (); }void
include/asm-ia64/ia32.h +5 -2
@@ -214,8 +214,11 @@/* POSIX.1b timers */ struct { -unsigned int _timer1; -unsigned int _timer2; +timer_t _tid;/* timer id */ +int _overrun;/* overrun count */ +char _pad[sizeof (unsigned int ) -sizeof (int )]; +sigval_t32 _sigval;/* same as below */ +int _sys_private;/* not to be passed to user */ } _timer;/* POSIX.1b signals */
Binary files linux-2.5.64-ia64.orig/include/linux/.idr.h.swp and linux-2.5.64-ia64-timer-030307.diff/include/linux/.idr.h.swp differ
include/linux/idr.h +11 -7
@@ -25,26 +25,30 @@#define IDR_MASK ((1 << IDR_BITS)-1) -/* Leave the possibility of an incomplete final layer */ -#define MAX_LEVEL (BITS_PER_LONG - RESERVED_ID_BITS + IDR_BITS - 1) / IDR_BITS -#define MAX_ID_SHIFT (BITS_PER_LONG - RESERVED_ID_BITS) -#define MAX_ID_BIT (1L << MAX_ID_SHIFT) +/* Define the size of the id's */ +#define BITS_PER_INT (sizeof(int)*8) + +#define MAX_ID_SHIFT (BITS_PER_INT - RESERVED_ID_BITS) +#define MAX_ID_BIT (1 << MAX_ID_SHIFT)#define MAX_ID_MASK (MAX_ID_BIT - 1) +/* Leave the possibility of an incomplete final layer */ +#define MAX_LEVEL (MAX_ID_SHIFT + IDR_BITS - 1) / IDR_BITS +/* Number of id_layer structs to leave in free list */ #define IDR_FREE_MAX MAX_LEVEL + MAX_LEVELstruct idr_layer {unsigned long bitmap;// A zero bit means "space here" -int count;// When zero, we can release it struct idr_layer *ary[1 <<IDR_BITS ]; +int count;// When zero, we can release it };struct idr {struct idr_layer *top; -int layers; -long count;struct idr_layer *id_free; +long count; +int layers;int id_free_cnt;spinlock_t lock; };
Binary files linux-2.5.64-ia64.orig/kernel/.posix-timers.c.swp and linux-2.5.64-ia64-timer-030307.diff/kernel/.posix-timers.c.swp differ Binary files linux-2.5.64-ia64.orig/lib/.idr.c.swp and linux-2.5.64-ia64-timer-030307.diff/lib/.idr.c.swp differ
lib/idr.c +2 -2
@@ -150,7 +150,7 @@static inline int sub_alloc (struct idr *idp,int shift,void *ptr) { -long n, v =0 ; +int n, v =0 ;struct idr_layer *p;struct idr_layer **pa[MAX_LEVEL ];struct idr_layer ***paa = &pa[0 ];
@@ -211,7 +211,7 @@int idr_get_new (struct idr *idp,void *ptr) { -long v; +int v;if (idp->id_free_cnt < idp->layers +1 )return (-1 );
usr/initramfs_data.S +17 -0
@@ -0,0 +1,17 @@ +.section ".init.ramfs", "a" +.byte 0x1f,0x8b,0x08,0x00,0xf6,0x71,0x68,0x3e +.byte 0x02,0x03,0x33,0x30,0x37,0x30,0x37,0x30 +.byte 0x34,0x00,0x01,0x23,0x17,0x30,0x6d,0x62 +.byte 0xe8,0x6c,0x80,0x03,0x18,0x19,0xbb,0x9a +.byte 0x59,0x98,0x1b,0xba,0x99,0xa1,0x89,0x1b +.byte 0x43,0x69,0x43,0x1c,0xfa,0x4c,0x61,0x0c +.byte 0xfd,0x94,0xd4,0x32,0x06,0x06,0x03,0x64 +.byte 0x3b,0x8d,0xc0,0x94,0xa1,0x05,0x2e,0x3b +.byte 0x0d,0x89,0xb4,0xd3,0x14,0x8d,0xef,0x82 +.byte 0x6c,0xa7,0x7e,0x72,0x7e,0x5e,0x71,0x7e +.byte 0x4e,0x2a,0x9a,0xdd,0xc6,0x34,0xf2,0x2f +.byte 0x5c,0xbd,0x7e,0x51,0x7e,0x7e,0x09,0xb2 +.byte 0x9d,0x84,0x01,0xb1,0xea,0xd0,0x81,0x13 +.byte 0x8c,0x11,0x12,0xe4,0xe8,0xe9,0xe3,0x1a +.byte 0xa4,0xa8,0xa8,0xc8,0x40,0x04,0x00,0x00 +.byte 0x0e,0x7c,0x69,0xf7,0x00,0x02,0x00,0x00