Index: include/asm-generic/syscall.h =================================================================== --- include/asm-generic/syscall.h (Revision 1252) +++ include/asm-generic/syscall.h (Arbeitskopie) @@ -30,6 +30,13 @@ #define __xn_sys_info 4 /* xnshadow_get_info(muxid,&info) */ #define __xn_sys_arch 5 /* r = xnarch_local_syscall(args) */ +#define __xn_sys_trace_begin 6 /* ipipe_trace_begin(v) */ +#define __xn_sys_trace_end 7 /* ipipe_trace_end(v) */ +#define __xn_sys_trace_freeze 8 /* ipipe_trace_freeze(v) */ +#define __xn_sys_trace_specl 9 /* ipipe_trace_special(special_id, v) */ +#define __xn_sys_trace_mreset 10 /* ipipe_trace_max_reset() */ +#define __xn_sys_trace_freset 11 /* ipipe_trace_frozen_reset() */ + #define XENOMAI_LINUX_DOMAIN 0 #define XENOMAI_XENO_DOMAIN 1 Index: include/rtdm/rttesting.h =================================================================== --- include/rtdm/rttesting.h (Revision 1252) +++ include/rtdm/rttesting.h (Arbeitskopie) @@ -1,6 +1,6 @@ /** * @file - * Real-Time Driver Model for Xenomai, benchmark device profile header + * Real-Time Driver Model for Xenomai, testing device profile header * * @note Copyright (C) 2005 Jan Kiszka * @@ -18,16 +18,16 @@ * along with Xenomai; if not, write to the Free Software Foundation, * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * @ingroup rtbenchmark + * @ingroup rttesting */ /*! * @ingroup profiles - * @defgroup rtbenchmark Timer benchmark Device + * @defgroup rttesting Testing Device * - * This group of devices is intended to provide in-kernel benchmark results. + * This group of devices is intended to provide in-kernel testing results. * Feel free to comment on this profile via the Xenomai mailing list - * (Xenomai-help@domain.hid) or directly to the author (jan.kiszka@domain.hid). @n + * (xenomai@xenomai.org) or directly to the author (jan.kiszka@domain.hid). @n * @n * * @par Device Characteristics @@ -91,11 +91,6 @@ typedef struct rtbnch_overall_result { long *histogram_max; } rtbnch_overall_result_t; -typedef struct rtbnch_trace_special { - unsigned char id; - long v; -} rtbnch_trace_special_t; - #define RTIOC_TYPE_BENCHMARK RTDM_CLASS_TESTING @@ -120,24 +115,6 @@ typedef struct rtbnch_trace_special { #define RTBNCH_RTIOC_STOP_TMTEST \ _IOWR(RTIOC_TYPE_BENCHMARK, 0x11, struct rtbnch_overall_result) - -#define RTBNCH_RTIOC_BEGIN_TRACE \ - _IOW(RTIOC_TYPE_BENCHMARK, 0x20, long) - -#define RTBNCH_RTIOC_END_TRACE \ - _IOW(RTIOC_TYPE_BENCHMARK, 0x21, long) - -#define RTBNCH_RTIOC_FREEZE_TRACE \ - _IOW(RTIOC_TYPE_BENCHMARK, 0x22, long) - -#define RTBNCH_RTIOC_REFREEZE_TRACE \ - _IOW(RTIOC_TYPE_BENCHMARK, 0x23, long) - -#define RTBNCH_RTIOC_SPECIAL_TRACE \ - _IOW(RTIOC_TYPE_BENCHMARK, 0x24, unsigned char) - -#define RTBNCH_RTIOC_SPECIAL_TRACE_EX \ - _IOW(RTIOC_TYPE_BENCHMARK, 0x25, struct rtbnch_trace_special) /** @} */ Index: include/nucleus/ipipe_trace.h =================================================================== --- include/nucleus/ipipe_trace.h (Revision 0) +++ include/nucleus/ipipe_trace.h (Revision 0) @@ -0,0 +1,82 @@ +/* + * Copyright (C) 2006 Jan Kiszka . + * + * Xenomai is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2 of the License, + * or (at your option) any later version. + * + * Xenomai is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Xenomai; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + * + * User space interface to the I-pipe tracer. + */ + +#ifndef _XENO_NUCLEUS_IPIPE_TRACE_H +#define _XENO_NUCLEUS_IPIPE_TRACE_H + +#ifndef __XENO_SIM__ +#include +#endif /* __XENO_SIM__ */ + +#ifdef __KERNEL__ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef CONFIG_IPIPE_TRACE +#include +#endif /* CONFIG_IPIPE_TRACE */ + +#ifdef __cplusplus +} +#endif + +#elif !defined(__XENO_SIM__) + +static inline void ipipe_trace_begin(unsigned long v) +{ + XENOMAI_SYSCALL1(__xn_sys_trace_begin, v); +} + +static inline void ipipe_trace_end(unsigned long v) +{ + XENOMAI_SYSCALL1(__xn_sys_trace_end, v); +} + +static inline void ipipe_trace_freeze(unsigned long v) +{ + XENOMAI_SYSCALL1(__xn_sys_trace_freeze, v); +} + +static inline void ipipe_trace_special(unsigned char special_id, unsigned long v) +{ + XENOMAI_SYSCALL2(__xn_sys_trace_specl, special_id, v); +} + +static inline int ipipe_trace_max_reset(void) +{ + return XENOMAI_SYSCALL0(__xn_sys_trace_mreset); +} + +static inline int ipipe_trace_frozen_reset(void) +{ + return XENOMAI_SYSCALL0(__xn_sys_trace_freset); +} + +#endif /* __KERNEL__ */ + +#define ipipe_trace_refreeze(v) do { \ + ipipe_trace_frozen_reset(); \ + ipipe_trace_freeze(v); \ +} while (0) + +#endif /* !_XENO_NUCLEUS_IPIPE_TRACE_H */ Index: src/testsuite/latency/latency.c =================================================================== --- src/testsuite/latency/latency.c (Revision 1252) +++ src/testsuite/latency/latency.c (Arbeitskopie) @@ -12,6 +12,7 @@ #include #include #include +#include RT_TASK latency_task, display_task; @@ -130,8 +131,7 @@ void latency (void *cookie) if (freeze_max && (dt > gmaxjitter) && !(finished || warmup)) { - rt_dev_ioctl(benchdev, RTBNCH_RTIOC_REFREEZE_TRACE, - rt_timer_tsc2ns(dt)); + ipipe_trace_refreeze(rt_timer_tsc2ns(dt)); gmaxjitter = dt; } @@ -545,7 +545,7 @@ int main (int argc, char **argv) mlockall(MCL_CURRENT|MCL_FUTURE); - if ((test_mode != USER_TASK) || freeze_max) + if (test_mode != USER_TASK) { char devname[RTDM_MAX_DEVNAME_LEN]; Index: src/testsuite/cyclic/cyclictest.c =================================================================== --- src/testsuite/cyclic/cyclictest.c (Revision 1252) +++ src/testsuite/cyclic/cyclictest.c (Arbeitskopie) @@ -36,7 +36,7 @@ #include #if IPIPE_TRACE -#include +#include #endif /* Ugly, but .... */ @@ -93,11 +93,6 @@ struct thread_stat { static int test_shutdown; static int tracelimit = 100000; static struct timespec start; -#if IPIPE_TRACE -static int benchdev = -1; -#else -#define benchdev -1 -#endif static inline void tsnorm(struct timespec *ts) { @@ -266,7 +261,7 @@ void *timerthread(void *param) stat->max = diff; #if IPIPE_TRACE if (stat->traced) - ioctl(benchdev, RTBNCH_RTIOC_REFREEZE_TRACE, diff); + ipipe_trace_refreeze(diff); #endif } @@ -411,9 +406,6 @@ static void process_options (int argc, c static void sighand(int sig) { -#if IPIPE_TRACE - close(benchdev); -#endif test_shutdown = 1; } @@ -469,10 +461,6 @@ int main(int argc, char **argv) if (!stat) goto outpar; -#if IPIPE_TRACE - benchdev = open("rtbenchmark0", O_RDWR); -#endif - clock_gettime(clocksources[clocksel], &start); for (i = 0; i < num_threads; i++) { @@ -500,7 +488,7 @@ int main(int argc, char **argv) pthread_attr_setstacksize(&thattr, 131072); pthread_create(&stat[i].thread, &thattr, timerthread, &par[i]); stat[i].threadstarted = 1; - stat[i].traced = (i == 0 && benchdev >= 0); + stat[i].traced = (i == 0 && IPIPE_TRACE > 0); } while (!test_shutdown) { Index: ksrc/drivers/testing/timerbench.c =================================================================== --- ksrc/drivers/testing/timerbench.c (Revision 1252) +++ ksrc/drivers/testing/timerbench.c (Arbeitskopie) @@ -232,55 +232,6 @@ int rt_tmbench_close(struct rtdm_dev_con } -#ifdef CONFIG_IPIPE_TRACE -int tracer_ioctl(int request, rtdm_user_info_t *user_info, void *arg) -{ - switch (request) { - case RTBNCH_RTIOC_BEGIN_TRACE: - ipipe_trace_begin((long)arg); - break; - - case RTBNCH_RTIOC_END_TRACE: - ipipe_trace_end((long)arg); - break; - - case RTBNCH_RTIOC_REFREEZE_TRACE: - ipipe_trace_frozen_reset(); - /* fall through */ - - case RTBNCH_RTIOC_FREEZE_TRACE: - ipipe_trace_freeze((long)arg); - break; - - case RTBNCH_RTIOC_SPECIAL_TRACE: - ipipe_trace_special((long)arg, 0); - break; - - case RTBNCH_RTIOC_SPECIAL_TRACE_EX: { - struct rtbnch_trace_special special; - - if (user_info) { - if (!rtdm_read_user_ok(user_info, arg, - sizeof(struct rtbnch_trace_special)) || - rtdm_copy_from_user(user_info, &special, arg, - sizeof(struct rtbnch_trace_special))) - return 0; - } else - special = *(struct rtbnch_trace_special *)arg; - ipipe_trace_special(special.id, special.v); - break; - } - - default: - return 0; - } - return 1; -} -#else /* !CONFIG_IPIPE_TRACE */ -#define tracer_ioctl(request, user_info, arg) (0) -#endif /* CONFIG_IPIPE_TRACE */ - - int rt_tmbench_ioctl_nrt(struct rtdm_dev_context *context, rtdm_user_info_t *user_info, int request, void *arg) { @@ -288,9 +239,6 @@ int rt_tmbench_ioctl_nrt(struct rtdm_dev int ret = 0; - if (tracer_ioctl(request, user_info, arg)) - return 0; - ctx = (struct rt_tmbench_context *)context->dev_private; switch (request) { @@ -475,9 +423,6 @@ int rt_tmbench_ioctl_rt(struct rtdm_dev_ int ret = 0; - if (tracer_ioctl(request, user_info, arg)) - return 0; - ctx = (struct rt_tmbench_context *)context->dev_private; switch (request) { Index: ksrc/nucleus/shadow.c =================================================================== --- ksrc/nucleus/shadow.c (Revision 1252) +++ ksrc/nucleus/shadow.c (Arbeitskopie) @@ -1261,6 +1261,48 @@ static int xnshadow_sys_barrier(struct t return xnshadow_wait_barrier(regs); } +#ifdef CONFIG_IPIPE_TRACE +static int notrace xnshadow_sys_trace_begin(struct task_struct *curr, + struct pt_regs *regs) +{ + ipipe_trace_begin(__xn_reg_arg1(regs)); + return 0; +} + +static int notrace xnshadow_sys_trace_end(struct task_struct *curr, + struct pt_regs *regs) +{ + ipipe_trace_end(__xn_reg_arg1(regs)); + return 0; +} + +static int notrace xnshadow_sys_trace_freeze(struct task_struct *curr, + struct pt_regs *regs) +{ + ipipe_trace_freeze(__xn_reg_arg1(regs)); + return 0; +} + +static int notrace xnshadow_sys_trace_special(struct task_struct *curr, + struct pt_regs *regs) +{ + ipipe_trace_special(__xn_reg_arg1(regs), __xn_reg_arg2(regs)); + return 0; +} + +static int notrace xnshadow_sys_trace_mreset(struct task_struct *curr, + struct pt_regs *regs) +{ + return ipipe_trace_max_reset(); +} + +static int notrace xnshadow_sys_trace_freset(struct task_struct *curr, + struct pt_regs *regs) +{ + return ipipe_trace_frozen_reset(); +} +#endif /* CONFIG_IPIPE_TRACE */ + static xnsysent_t xnshadow_systab[] = { [__xn_sys_migrate] = {&xnshadow_sys_migrate, __xn_exec_current}, [__xn_sys_arch] = {&xnshadow_sys_arch, __xn_exec_any}, @@ -1268,6 +1310,17 @@ static xnsysent_t xnshadow_systab[] = { [__xn_sys_info] = {&xnshadow_sys_info, __xn_exec_lostage}, [__xn_sys_completion] = {&xnshadow_sys_completion, __xn_exec_lostage}, [__xn_sys_barrier] = {&xnshadow_sys_barrier, __xn_exec_lostage}, +#ifdef CONFIG_IPIPE_TRACE + [__xn_sys_trace_begin] = {&xnshadow_sys_trace_begin, __xn_exec_any}, + [__xn_sys_trace_end] = {&xnshadow_sys_trace_end, __xn_exec_any}, + [__xn_sys_trace_freeze] = {&xnshadow_sys_trace_freeze, __xn_exec_any}, + [__xn_sys_trace_specl] = {&xnshadow_sys_trace_special, __xn_exec_any}, + [__xn_sys_trace_mreset] = {&xnshadow_sys_trace_mreset, __xn_exec_any}, + [__xn_sys_trace_freset] = {&xnshadow_sys_trace_freset, __xn_exec_any}, +#else /* !CONFIG_IPIPE_TRACE */ + /* has to be filled up with an ENOSYS returning handler once further + syscalls follow */ +#endif /* CONFIG_IPIPE_TRACE */ }; static inline int substitute_linux_syscall(struct task_struct *curr,