<feed xmlns='http://www.w3.org/2005/Atom'>
<title>litmus-rt.git/kernel, branch wip-extra-debug</title>
<subtitle>The LITMUS^RT kernel.</subtitle>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/litmus-rt.git/'/>
<entry>
<title>DBG: add additional tracing</title>
<updated>2011-01-05T13:13:18+00:00</updated>
<author>
<name>Bjoern B. Brandenburg</name>
<email>bbb@cs.unc.edu</email>
</author>
<published>2010-11-11T07:31:38+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/litmus-rt.git/commit/?id=69d8772cb575fe71cfb6a7fbc07ca21acfbb4665'/>
<id>69d8772cb575fe71cfb6a7fbc07ca21acfbb4665</id>
<content type='text'>
This is not meant to be merged into master...
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is not meant to be merged into master...
</pre>
</div>
</content>
</entry>
<entry>
<title>DBG: enable additional debug tracing</title>
<updated>2011-01-05T13:13:18+00:00</updated>
<author>
<name>Bjoern B. Brandenburg</name>
<email>bbb@cs.unc.edu</email>
</author>
<published>2010-11-10T17:19:35+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/litmus-rt.git/commit/?id=a698e30c15dc3ce113f7f7c0c821a38f4f8cbab0'/>
<id>a698e30c15dc3ce113f7f7c0c821a38f4f8cbab0</id>
<content type='text'>
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
</pre>
</div>
</content>
</entry>
<entry>
<title>Workaround: do not set rq-&gt;skip_clock_update</title>
<updated>2010-11-11T23:00:33+00:00</updated>
<author>
<name>Bjoern B. Brandenburg</name>
<email>bbb@cs.unc.edu</email>
</author>
<published>2010-11-11T21:54:20+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/litmus-rt.git/commit/?id=6fbc3b495cccf2e4ab7d4ab674b5c576e9946bed'/>
<id>6fbc3b495cccf2e4ab7d4ab674b5c576e9946bed</id>
<content type='text'>
Disabling the clock update seems to be causing problems even in normal
Linux, and causes major bugs under LITMUS^RT. As a workaround, just
disable this "optimization" for now.

Details: the idle load balancer causes tasks that suspsend to be
marked with set_tsk_need_resched(). When such a task resumes, it may
wrongly trigger the setting of skip_clock_update. However, a
corresponding rescheduling event may not happen immediately, such that
the currently-scheduled task is no longer charged for its execution
time.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Disabling the clock update seems to be causing problems even in normal
Linux, and causes major bugs under LITMUS^RT. As a workaround, just
disable this "optimization" for now.

Details: the idle load balancer causes tasks that suspsend to be
marked with set_tsk_need_resched(). When such a task resumes, it may
wrongly trigger the setting of skip_clock_update. However, a
corresponding rescheduling event may not happen immediately, such that
the currently-scheduled task is no longer charged for its execution
time.
</pre>
</div>
</content>
</entry>
<entry>
<title>Implement proper remote preemption support</title>
<updated>2010-11-11T22:57:44+00:00</updated>
<author>
<name>Bjoern B. Brandenburg</name>
<email>bbb@cs.unc.edu</email>
</author>
<published>2010-11-10T17:10:49+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/litmus-rt.git/commit/?id=fb3df2ec261d8cd6bcb8206d9d985355214d7767'/>
<id>fb3df2ec261d8cd6bcb8206d9d985355214d7767</id>
<content type='text'>
To date, Litmus has just hooked into the smp_send_reschedule() IPI
handler and marked tasks as having to reschedule to implement remote
preemptions. This was never particularly clean, but so far we got away
with it. However, changes in the underlying Linux, and peculartities
of the ARM code (interrupts enabled before context switch) break this
naive approach. This patch introduces new state-machine based remote
preemption support. By examining the local state before calling
set_tsk_need_resched(), we avoid confusing the underlying Linux
scheduler. Further, this patch avoids sending unncessary IPIs.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
To date, Litmus has just hooked into the smp_send_reschedule() IPI
handler and marked tasks as having to reschedule to implement remote
preemptions. This was never particularly clean, but so far we got away
with it. However, changes in the underlying Linux, and peculartities
of the ARM code (interrupts enabled before context switch) break this
naive approach. This patch introduces new state-machine based remote
preemption support. By examining the local state before calling
set_tsk_need_resched(), we avoid confusing the underlying Linux
scheduler. Further, this patch avoids sending unncessary IPIs.
</pre>
</div>
</content>
</entry>
<entry>
<title>hook litmus tick function into hrtimer-driven ticks</title>
<updated>2010-11-11T22:57:43+00:00</updated>
<author>
<name>Bjoern B. Brandenburg</name>
<email>bbb@cs.unc.edu</email>
</author>
<published>2010-11-09T01:21:35+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/litmus-rt.git/commit/?id=516b6601bb5f71035e8859735a25dea0da4a0211'/>
<id>516b6601bb5f71035e8859735a25dea0da4a0211</id>
<content type='text'>
Litmus plugins should also be activated if ticks are triggered by
hrtimer.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Litmus plugins should also be activated if ticks are triggered by
hrtimer.
</pre>
</div>
</content>
</entry>
<entry>
<title>Merge commit 'v2.6.36' into wip-merge-2.6.36</title>
<updated>2010-10-23T05:01:49+00:00</updated>
<author>
<name>Andrea Bastoni</name>
<email>bastoni@cs.unc.edu</email>
</author>
<published>2010-10-23T05:01:49+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/litmus-rt.git/commit/?id=3dd41424090a0ca3a660218d06afe6ff4441bad3'/>
<id>3dd41424090a0ca3a660218d06afe6ff4441bad3</id>
<content type='text'>
Conflicts:
	Makefile
	arch/x86/include/asm/unistd_32.h
	arch/x86/kernel/syscall_table_32.S
	kernel/sched.c
	kernel/time/tick-sched.c

Relevant API and functions changes (solved in this commit):
- (API) .enqueue_task() (enqueue_task_litmus),
  dequeue_task() (dequeue_task_litmus),
  [litmus/sched_litmus.c]
- (API) .select_task_rq() (select_task_rq_litmus)
  [litmus/sched_litmus.c]
- (API) sysrq_dump_trace_buffer() and sysrq_handle_kill_rt_tasks()
  [litmus/sched_trace.c]
- struct kfifo internal buffer name changed (buffer -&gt; buf)
  [litmus/sched_trace.c]
- add_wait_queue_exclusive_locked -&gt; __add_wait_queue_tail_exclusive
  [litmus/fmlp.c]
- syscall numbers for both x86_32 and x86_64
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Conflicts:
	Makefile
	arch/x86/include/asm/unistd_32.h
	arch/x86/kernel/syscall_table_32.S
	kernel/sched.c
	kernel/time/tick-sched.c

Relevant API and functions changes (solved in this commit):
- (API) .enqueue_task() (enqueue_task_litmus),
  dequeue_task() (dequeue_task_litmus),
  [litmus/sched_litmus.c]
- (API) .select_task_rq() (select_task_rq_litmus)
  [litmus/sched_litmus.c]
- (API) sysrq_dump_trace_buffer() and sysrq_handle_kill_rt_tasks()
  [litmus/sched_trace.c]
- struct kfifo internal buffer name changed (buffer -&gt; buf)
  [litmus/sched_trace.c]
- add_wait_queue_exclusive_locked -&gt; __add_wait_queue_tail_exclusive
  [litmus/fmlp.c]
- syscall numbers for both x86_32 and x86_64
</pre>
</div>
</content>
</entry>
<entry>
<title>hrtimer: add init function to properly set hrtimer_start_on_info params</title>
<updated>2010-10-19T13:40:38+00:00</updated>
<author>
<name>Andrea Bastoni</name>
<email>bastoni@cs.unc.edu</email>
</author>
<published>2010-09-28T15:08:17+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/litmus-rt.git/commit/?id=bd6d5f1dd586a27c2082ad4d95ee58913b471f5c'/>
<id>bd6d5f1dd586a27c2082ad4d95ee58913b471f5c</id>
<content type='text'>
This helper function is also useful to remind us that if we use
hrtimer_pull outside the scope of triggering remote releases, we need to
take care of properly set the "state" field of hrtimer_start_on_info
structure.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This helper function is also useful to remind us that if we use
hrtimer_pull outside the scope of triggering remote releases, we need to
take care of properly set the "state" field of hrtimer_start_on_info
structure.
</pre>
</div>
</content>
</entry>
<entry>
<title>sysctl: min/max bounds are optional</title>
<updated>2010-10-15T21:42:24+00:00</updated>
<author>
<name>Eric Dumazet</name>
<email>eric.dumazet@gmail.com</email>
</author>
<published>2010-10-15T21:34:12+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/litmus-rt.git/commit/?id=a9febbb4bd1302b6f01aa1203b0a804e4e5c9e25'/>
<id>a9febbb4bd1302b6f01aa1203b0a804e4e5c9e25</id>
<content type='text'>
sysctl check complains with a WARN() when proc_doulongvec_minmax() or
proc_doulongvec_ms_jiffies_minmax() are used by a vector of longs (with
more than one element), with no min or max value specified.

This is unexpected, given we had a bug on this min/max handling :)

Reported-by: Jiri Slaby &lt;jirislaby@gmail.com&gt;
Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Cc: David Miller &lt;davem@davemloft.net&gt;
Acked-by: WANG Cong &lt;xiyou.wangcong@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
sysctl check complains with a WARN() when proc_doulongvec_minmax() or
proc_doulongvec_ms_jiffies_minmax() are used by a vector of longs (with
more than one element), with no min or max value specified.

This is unexpected, given we had a bug on this min/max handling :)

Reported-by: Jiri Slaby &lt;jirislaby@gmail.com&gt;
Signed-off-by: Eric Dumazet &lt;eric.dumazet@gmail.com&gt;
Cc: "Eric W. Biederman" &lt;ebiederm@xmission.com&gt;
Cc: David Miller &lt;davem@davemloft.net&gt;
Acked-by: WANG Cong &lt;xiyou.wangcong@gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>hrtimer: Preserve timer state in remove_hrtimer()</title>
<updated>2010-10-14T11:29:59+00:00</updated>
<author>
<name>Salman Qazi</name>
<email>sqazi@google.com</email>
</author>
<published>2010-10-12T14:25:19+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/litmus-rt.git/commit/?id=f13d4f979c518119bba5439dd2364d76d31dcd3f'/>
<id>f13d4f979c518119bba5439dd2364d76d31dcd3f</id>
<content type='text'>
The race is described as follows:

CPU X                                 CPU Y
remove_hrtimer
// state &amp; QUEUED == 0
timer-&gt;state = CALLBACK
unlock timer base
timer-&gt;f(n) //very long
                                  hrtimer_start
                                    lock timer base
                                    remove_hrtimer // no effect
                                    hrtimer_enqueue
                                    timer-&gt;state = CALLBACK |
                                                   QUEUED
                                    unlock timer base
                                  hrtimer_start
                                    lock timer base
                                    remove_hrtimer
                                        mode = INACTIVE
                                        // CALLBACK bit lost!
                                    switch_hrtimer_base
                                            CALLBACK bit not set:
                                                    timer-&gt;base
                                                    changes to a
                                                    different CPU.
lock this CPU's timer base

The bug was introduced with commit ca109491f (hrtimer: removing all ur
callback modes) in 2.6.29

[ tglx: Feed new state via local variable and add a comment. ]

Signed-off-by: Salman Qazi &lt;sqazi@google.com&gt;
Cc: akpm@linux-foundation.org
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
LKML-Reference: &lt;20101012142351.8485.21823.stgit@dungbeetle.mtv.corp.google.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: stable@kernel.org
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The race is described as follows:

CPU X                                 CPU Y
remove_hrtimer
// state &amp; QUEUED == 0
timer-&gt;state = CALLBACK
unlock timer base
timer-&gt;f(n) //very long
                                  hrtimer_start
                                    lock timer base
                                    remove_hrtimer // no effect
                                    hrtimer_enqueue
                                    timer-&gt;state = CALLBACK |
                                                   QUEUED
                                    unlock timer base
                                  hrtimer_start
                                    lock timer base
                                    remove_hrtimer
                                        mode = INACTIVE
                                        // CALLBACK bit lost!
                                    switch_hrtimer_base
                                            CALLBACK bit not set:
                                                    timer-&gt;base
                                                    changes to a
                                                    different CPU.
lock this CPU's timer base

The bug was introduced with commit ca109491f (hrtimer: removing all ur
callback modes) in 2.6.29

[ tglx: Feed new state via local variable and add a comment. ]

Signed-off-by: Salman Qazi &lt;sqazi@google.com&gt;
Cc: akpm@linux-foundation.org
Cc: Peter Zijlstra &lt;peterz@infradead.org&gt;
LKML-Reference: &lt;20101012142351.8485.21823.stgit@dungbeetle.mtv.corp.google.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: stable@kernel.org
</pre>
</div>
</content>
</entry>
<entry>
<title>ring-buffer: Fix typo of time extends per page</title>
<updated>2010-10-12T16:06:43+00:00</updated>
<author>
<name>Steven Rostedt</name>
<email>srostedt@redhat.com</email>
</author>
<published>2010-10-12T16:06:43+00:00</published>
<link rel='alternate' type='text/html' href='http://rtsrv.cs.unc.edu/cgit/cgit.cgi/litmus-rt.git/commit/?id=d01343244abdedd18303d0323b518ed9cdcb1988'/>
<id>d01343244abdedd18303d0323b518ed9cdcb1988</id>
<content type='text'>
Time stamps for the ring buffer are created by the difference between
two events. Each page of the ring buffer holds a full 64 bit timestamp.
Each event has a 27 bit delta stamp from the last event. The unit of time
is nanoseconds, so 27 bits can hold ~134 milliseconds. If two events
happen more than 134 milliseconds apart, a time extend is inserted
to add more bits for the delta. The time extend has 59 bits, which
is good for ~18 years.

Currently the time extend is committed separately from the event.
If an event is discarded before it is committed, due to filtering,
the time extend still exists. If all events are being filtered, then
after ~134 milliseconds a new time extend will be added to the buffer.

This can only happen till the end of the page. Since each page holds
a full timestamp, there is no reason to add a time extend to the
beginning of a page. Time extends can only fill a page that has actual
data at the beginning, so there is no fear that time extends will fill
more than a page without any data.

When reading an event, a loop is made to skip over time extends
since they are only used to maintain the time stamp and are never
given to the caller. As a paranoid check to prevent the loop running
forever, with the knowledge that time extends may only fill a page,
a check is made that tests the iteration of the loop, and if the
iteration is more than the number of time extends that can fit in a page
a warning is printed and the ring buffer is disabled (all of ftrace
is also disabled with it).

There is another event type that is called a TIMESTAMP which can
hold 64 bits of data in the theoretical case that two events happen
18 years apart. This code has not been implemented, but the name
of this event exists, as well as the structure for it. The
size of a TIMESTAMP is 16 bytes, where as a time extend is only
8 bytes. The macro used to calculate how many time extends can fit on
a page used the TIMESTAMP size instead of the time extend size
cutting the amount in half.

The following test case can easily trigger the warning since we only
need to have half the page filled with time extends to trigger the
warning:

 # cd /sys/kernel/debug/tracing/
 # echo function &gt; current_tracer
 # echo 'common_pid &lt; 0' &gt; events/ftrace/function/filter
 # echo &gt; trace
 # echo 1 &gt; trace_marker
 # sleep 120
 # cat trace

Enabling the function tracer and then setting the filter to only trace
functions where the process id is negative (no events), then clearing
the trace buffer to ensure that we have nothing in the buffer,
then write to trace_marker to add an event to the beginning of a page,
sleep for 2 minutes (only 35 seconds is probably needed, but this
guarantees the bug), and then finally reading the trace which will
trigger the bug.

This patch fixes the typo and prevents the false positive of that warning.

Reported-by: Hans J. Koch &lt;hjk@linutronix.de&gt;
Tested-by: Hans J. Koch &lt;hjk@linutronix.de&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Stable Kernel &lt;stable@kernel.org&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Time stamps for the ring buffer are created by the difference between
two events. Each page of the ring buffer holds a full 64 bit timestamp.
Each event has a 27 bit delta stamp from the last event. The unit of time
is nanoseconds, so 27 bits can hold ~134 milliseconds. If two events
happen more than 134 milliseconds apart, a time extend is inserted
to add more bits for the delta. The time extend has 59 bits, which
is good for ~18 years.

Currently the time extend is committed separately from the event.
If an event is discarded before it is committed, due to filtering,
the time extend still exists. If all events are being filtered, then
after ~134 milliseconds a new time extend will be added to the buffer.

This can only happen till the end of the page. Since each page holds
a full timestamp, there is no reason to add a time extend to the
beginning of a page. Time extends can only fill a page that has actual
data at the beginning, so there is no fear that time extends will fill
more than a page without any data.

When reading an event, a loop is made to skip over time extends
since they are only used to maintain the time stamp and are never
given to the caller. As a paranoid check to prevent the loop running
forever, with the knowledge that time extends may only fill a page,
a check is made that tests the iteration of the loop, and if the
iteration is more than the number of time extends that can fit in a page
a warning is printed and the ring buffer is disabled (all of ftrace
is also disabled with it).

There is another event type that is called a TIMESTAMP which can
hold 64 bits of data in the theoretical case that two events happen
18 years apart. This code has not been implemented, but the name
of this event exists, as well as the structure for it. The
size of a TIMESTAMP is 16 bytes, where as a time extend is only
8 bytes. The macro used to calculate how many time extends can fit on
a page used the TIMESTAMP size instead of the time extend size
cutting the amount in half.

The following test case can easily trigger the warning since we only
need to have half the page filled with time extends to trigger the
warning:

 # cd /sys/kernel/debug/tracing/
 # echo function &gt; current_tracer
 # echo 'common_pid &lt; 0' &gt; events/ftrace/function/filter
 # echo &gt; trace
 # echo 1 &gt; trace_marker
 # sleep 120
 # cat trace

Enabling the function tracer and then setting the filter to only trace
functions where the process id is negative (no events), then clearing
the trace buffer to ensure that we have nothing in the buffer,
then write to trace_marker to add an event to the beginning of a page,
sleep for 2 minutes (only 35 seconds is probably needed, but this
guarantees the bug), and then finally reading the trace which will
trigger the bug.

This patch fixes the typo and prevents the false positive of that warning.

Reported-by: Hans J. Koch &lt;hjk@linutronix.de&gt;
Tested-by: Hans J. Koch &lt;hjk@linutronix.de&gt;
Cc: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Cc: Stable Kernel &lt;stable@kernel.org&gt;
Signed-off-by: Steven Rostedt &lt;rostedt@goodmis.org&gt;
</pre>
</div>
</content>
</entry>
</feed>
