aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/litmus/rt_param.h22
-rw-r--r--include/litmus/trace_irq.h12
-rw-r--r--litmus/ctrldev.c11
-rw-r--r--litmus/litmus.c2
-rw-r--r--litmus/trace.c9
5 files changed, 38 insertions, 18 deletions
diff --git a/include/litmus/rt_param.h b/include/litmus/rt_param.h
index 6456ed04fddb..8d9aa07cf324 100644
--- a/include/litmus/rt_param.h
+++ b/include/litmus/rt_param.h
@@ -65,12 +65,12 @@ struct rt_task {
65}; 65};
66 66
67union np_flag { 67union np_flag {
68 uint32_t raw; 68 uint64_t raw;
69 struct { 69 struct {
70 /* Is the task currently in a non-preemptive section? */ 70 /* Is the task currently in a non-preemptive section? */
71 uint32_t flag:31; 71 uint64_t flag:31;
72 /* Should the task call into the scheduler? */ 72 /* Should the task call into the scheduler? */
73 uint32_t preempt:1; 73 uint64_t preempt:1;
74 } np; 74 } np;
75}; 75};
76 76
@@ -93,13 +93,25 @@ struct control_page {
93 * sections. */ 93 * sections. */
94 volatile union np_flag sched; 94 volatile union np_flag sched;
95 95
96 volatile uint64_t irq_count; /* Incremented by the kernel each time an IRQ is
97 * handled. */
98
96 /* Locking overhead tracing: userspace records here the time stamp 99 /* Locking overhead tracing: userspace records here the time stamp
97 * prior to starting the system call. */ 100 * and IRQ counter prior to starting the system call. */
98 uint64_t ts_syscall_start; /* Feather-Trace cycles */ 101 uint64_t ts_syscall_start; /* Feather-Trace cycles */
102 uint64_t irq_syscall_start; /* Snapshot of irq_count when the syscall
103 * started. */
99 104
100 /* to be extended */ 105 /* to be extended */
101}; 106};
102 107
108/* Expected offsets within the control page. */
109
110#define LITMUS_CP_OFFSET_SCHED 0
111#define LITMUS_CP_OFFSET_IRQ_COUNT 8
112#define LITMUS_CP_OFFSET_TS_SC_START 16
113#define LITMUS_CP_OFFSET_IRQ_SC_START 24
114
103/* don't export internal data structures to user space (liblitmus) */ 115/* don't export internal data structures to user space (liblitmus) */
104#ifdef __KERNEL__ 116#ifdef __KERNEL__
105 117
diff --git a/include/litmus/trace_irq.h b/include/litmus/trace_irq.h
index 01e4b98fc3e0..0d0c042ba9c3 100644
--- a/include/litmus/trace_irq.h
+++ b/include/litmus/trace_irq.h
@@ -3,17 +3,7 @@
3 3
4#ifdef CONFIG_SCHED_OVERHEAD_TRACE 4#ifdef CONFIG_SCHED_OVERHEAD_TRACE
5 5
6#include <asm/atomic.h> 6void ft_irq_fired(void);
7#include <linux/percpu.h>
8
9extern DEFINE_PER_CPU(atomic_t, irq_fired_count);
10
11static inline void ft_irq_fired(void)
12{
13 /* Only called with preemptions disabled. */
14 atomic_inc(&__get_cpu_var(irq_fired_count));
15}
16
17 7
18#else 8#else
19 9
diff --git a/litmus/ctrldev.c b/litmus/ctrldev.c
index 9969ab17c190..41919b2714cb 100644
--- a/litmus/ctrldev.c
+++ b/litmus/ctrldev.c
@@ -133,6 +133,17 @@ static int __init init_litmus_ctrl_dev(void)
133 133
134 BUILD_BUG_ON(sizeof(struct control_page) > PAGE_SIZE); 134 BUILD_BUG_ON(sizeof(struct control_page) > PAGE_SIZE);
135 135
136 BUILD_BUG_ON(sizeof(union np_flag) != sizeof(uint64_t));
137
138 BUILD_BUG_ON(offsetof(struct control_page, sched.raw)
139 != LITMUS_CP_OFFSET_SCHED);
140 BUILD_BUG_ON(offsetof(struct control_page, irq_count)
141 != LITMUS_CP_OFFSET_IRQ_COUNT);
142 BUILD_BUG_ON(offsetof(struct control_page, ts_syscall_start)
143 != LITMUS_CP_OFFSET_TS_SC_START);
144 BUILD_BUG_ON(offsetof(struct control_page, irq_syscall_start)
145 != LITMUS_CP_OFFSET_IRQ_SC_START);
146
136 printk("Initializing LITMUS^RT control device.\n"); 147 printk("Initializing LITMUS^RT control device.\n");
137 err = misc_register(&litmus_ctrl_dev); 148 err = misc_register(&litmus_ctrl_dev);
138 if (err) 149 if (err)
diff --git a/litmus/litmus.c b/litmus/litmus.c
index 81384327e850..c842de46587b 100644
--- a/litmus/litmus.c
+++ b/litmus/litmus.c
@@ -536,8 +536,6 @@ static int __init _init_litmus(void)
536 */ 536 */
537 printk("Starting LITMUS^RT kernel\n"); 537 printk("Starting LITMUS^RT kernel\n");
538 538
539 BUILD_BUG_ON(sizeof(union np_flag) != sizeof(uint32_t));
540
541 register_sched_plugin(&linux_sched_plugin); 539 register_sched_plugin(&linux_sched_plugin);
542 540
543 bheap_node_cache = KMEM_CACHE(bheap_node, SLAB_PANIC); 541 bheap_node_cache = KMEM_CACHE(bheap_node, SLAB_PANIC);
diff --git a/litmus/trace.c b/litmus/trace.c
index fc1d03f35d39..c511003ea911 100644
--- a/litmus/trace.c
+++ b/litmus/trace.c
@@ -18,6 +18,15 @@ static unsigned int ts_seq_no = 0;
18 18
19DEFINE_PER_CPU(atomic_t, irq_fired_count); 19DEFINE_PER_CPU(atomic_t, irq_fired_count);
20 20
21void ft_irq_fired(void)
22{
23 /* Only called with preemptions disabled. */
24 atomic_inc(&__get_cpu_var(irq_fired_count));
25
26 if (has_control_page(current))
27 get_control_page(current)->irq_count++;
28}
29
21static inline void clear_irq_fired(void) 30static inline void clear_irq_fired(void)
22{ 31{
23 atomic_set(&__raw_get_cpu_var(irq_fired_count), 0); 32 atomic_set(&__raw_get_cpu_var(irq_fired_count), 0);