From: Ingo Molnar <mingo@elte.hu>
To: Mark_H_Johnson@raytheon.com
Cc: "K.R. Foley" <kr@cybsft.com>,
linux-kernel <linux-kernel@vger.kernel.org>,
Felipe Alfaro Solana <lkml@felipe-alfaro.com>,
Daniel Schmitt <pnambic@unu.nu>,
Lee Revell <rlrevell@joe-job.com>
Subject: Re: [patch] voluntary-preempt-2.6.9-rc1-bk4-Q5
Date: Tue, 31 Aug 2004 10:49:28 +0200 [thread overview]
Message-ID: <20040831084928.GA10299@elte.hu> (raw)
In-Reply-To: <OF04883085.9C3535D2-ON86256F00.0065652B@raytheon.com>
[-- Attachment #1: Type: text/plain, Size: 2144 bytes --]
* Mark_H_Johnson@raytheon.com <Mark_H_Johnson@raytheon.com> wrote:
> VARYING SYSTEM CALL TIMES
> =========================
>
> In 2.4, it appears that the duration of the write system call is
> basically fixed and dependent on the duration of the audio fragment.
> In 2.6, this behavior is now different. If I look at the chart in
> detail, it appears the system is queueing up several write operations
> during the first few seconds of testing. You can see this by
> consistently low elapsed times for the write system call. Then the
> elapsed time for the write bounces up / down in a sawtooth pattern
> over a 1 msec range. Could someone explain the cause of this new
> behavior and if there is a setting to restore the old behavior? I am
> concerned that this queueing adds latency to audio operations (when
> trying to synchronize audio with other real time behavior).
since the latency tracer does not trigger, we need a modified tracer to
find out what's happening during such long delays. I've attached the
'user-latency-tracer' patch ontop of -Q5, which is a modification of the
latency tracer. This patch enables free-running tracing which includes
all kernel functions not just critical sections. To activate this, two
things have to be done. Firstly:
echo 2 > /proc/sys/kernel/trace_enabled
this turns off the normal latency tracer and turns on the 'user tracer'.
Traces can be generated by userspace via a hack done to
sys_gettimeofday():
gettimeofday(0,1); // enable the tracer
gettimeofday(0,0); // save current trace and disable the tracer
this way the tracing can be limited to the suspected codepaths only.
could you try to insert gettimeofday(0,1) into your testsuite just
before the write() call is done, and right after the write() call, and
save a couple of representative traces? The patch also ups the # of
latency entries to 8000 - if that is still insufficient then please
increase it as needed.
NOTE: on SMP the tracing on/off is strictly per-CPU. So do the enabling
and disabling of the trace on the same CPU. (doing otherwise wont cause
problems, but the generated traces will be less useful.)
Ingo
[-- Attachment #2: user-latency-2.6.9-rc1-bk4-Q5-A0 --]
[-- Type: text/plain, Size: 3598 bytes --]
--- linux/kernel/latency.c.orig
+++ linux/kernel/latency.c
@@ -27,7 +27,7 @@ static DECLARE_MUTEX(max_mutex);
#ifdef CONFIG_LATENCY_TRACE
-#define MAX_TRACE 4000UL
+#define MAX_TRACE 8000UL
struct trace_entry {
unsigned long preempt_count;
@@ -63,14 +63,13 @@ static unsigned long max_nice;
static unsigned long max_policy;
static unsigned long max_rt_priority;
-inline void notrace
+static inline void notrace
____trace(struct cpu_trace *tr, unsigned long eip, unsigned long parent_eip)
{
struct trace_entry *entry;
- BUG_ON(!irqs_disabled());
-
- if (tr->trace_idx < MAX_TRACE) {
+ if ((tr->critical_start || (trace_enabled == 2)) &&
+ (tr->trace_idx < MAX_TRACE)) {
entry = tr->trace + tr->trace_idx;
entry->eip = eip;
entry->parent_eip = parent_eip;
@@ -80,7 +79,7 @@ ____trace(struct cpu_trace *tr, unsigned
tr->trace_idx++;
}
-inline void notrace
+static inline void notrace
___trace(unsigned long eip, unsigned long parent_eip)
{
unsigned long flags;
@@ -266,6 +265,18 @@ static int setup_preempt_thresh(char *s)
}
__setup("preempt_thresh=", setup_preempt_thresh);
+static void update_max_trace(struct cpu_trace *tr)
+{
+ memcpy(&max_trace, tr, sizeof (max_trace));
+
+ memcpy(max_comm, current->comm, 16);
+ max_pid = current->pid;
+ max_uid = current->uid;
+ max_nice = current->static_prio - 20 - MAX_RT_PRIO;
+ max_policy = current->policy;
+ max_rt_priority = current->rt_priority;
+}
+
static void notrace check_preempt_timing(struct cpu_trace *tr)
{
#ifdef CONFIG_LATENCY_TRACE
@@ -274,6 +285,10 @@ static void notrace check_preempt_timing
unsigned long parent_eip = (unsigned long)__builtin_return_address(1);
unsigned long latency;
+#ifdef CONFIG_LATENCY_TRACE
+ if (trace_enabled == 2)
+ return;
+#endif
atomic_inc(&tr->disabled);
latency = cycles_to_usecs(get_cycles() - tr->preempt_timestamp);
@@ -293,14 +308,7 @@ static void notrace check_preempt_timing
#ifdef CONFIG_LATENCY_TRACE
____trace(tr, eip, parent_eip);
- memcpy(&max_trace, tr, sizeof (max_trace));
-
- memcpy(max_comm, current->comm, 16);
- max_pid = current->pid;
- max_uid = current->uid;
- max_nice = current->static_prio - 20 - MAX_RT_PRIO;
- max_policy = current->policy;
- max_rt_priority = current->rt_priority;
+ update_max_trace(tr);
#endif
if (preempt_thresh)
@@ -354,6 +362,10 @@ void notrace add_preempt_count(int val)
#endif
preempt_count() += val;
+#ifdef CONFIG_LATENCY_TRACE
+ if (trace_enabled == 2)
+ return;
+#endif
if (preempt_count() == val) {
struct cpu_trace *tr = &__get_cpu_var(trace);
@@ -383,3 +395,27 @@ void notrace sub_preempt_count(int val)
preempt_count() -= val;
}
EXPORT_SYMBOL(sub_preempt_count);
+
+void user_trace_start(void)
+{
+ struct cpu_trace *tr;
+
+ if (trace_enabled != 2)
+ return;
+ tr = &get_cpu_var(trace);
+ tr->trace_idx = 0;
+ mcount();
+ put_cpu_var(trace);
+}
+
+void user_trace_stop(void)
+{
+ struct cpu_trace *tr;
+
+ if (trace_enabled != 2)
+ return;
+ tr = &get_cpu_var(trace);
+ mcount();
+ update_max_trace(tr);
+ put_cpu_var(trace);
+}
--- linux/kernel/time.c.orig2
+++ linux/kernel/time.c
@@ -90,8 +90,17 @@ asmlinkage long sys_stime(time_t __user
#endif /* __ARCH_WANT_SYS_TIME */
+extern void user_trace_start(void);
+extern void user_trace_stop(void);
+
asmlinkage long sys_gettimeofday(struct timeval __user *tv, struct timezone __user *tz)
{
+#ifdef CONFIG_LATENCY_TRACE
+ if (!tv && ((int)tz == 1))
+ user_trace_start();
+ if (!tv && !tz)
+ user_trace_stop();
+#endif
if (likely(tv != NULL)) {
struct timeval ktv;
do_gettimeofday(&ktv);
next prev parent reply other threads:[~2004-08-31 8:51 UTC|newest]
Thread overview: 126+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-08-30 19:13 [patch] voluntary-preempt-2.6.9-rc1-bk4-Q5 Mark_H_Johnson
2004-08-30 19:21 ` Ingo Molnar
2004-09-01 12:31 ` [patch] voluntary-preempt-2.6.9-rc1-bk4-Q5 - netdev_max_back_log is too small P.O. Gaillard
2004-09-01 13:05 ` Ingo Molnar
2004-09-02 11:24 ` [patch] voluntary-preempt-2.6.9-rc1-bk4-Q6 - network is no longer smooth P.O. Gaillard
2004-09-02 11:28 ` Ingo Molnar
2004-09-02 15:26 ` P.O. Gaillard
2004-08-31 8:49 ` Ingo Molnar [this message]
2004-09-02 6:33 ` [patch] voluntary-preempt-2.6.9-rc1-bk4-Q5 Ingo Molnar
2004-09-02 6:55 ` [patch] voluntary-preempt-2.6.9-rc1-bk4-Q8 Ingo Molnar
2004-09-02 7:04 ` Lee Revell
2004-09-02 7:15 ` Ingo Molnar
2004-09-02 7:31 ` Lee Revell
2004-09-02 7:46 ` Ingo Molnar
2004-09-03 1:10 ` Rusty Russell
2004-09-02 23:25 ` Lee Revell
2004-09-02 23:28 ` Ingo Molnar
2004-09-02 23:32 ` Lee Revell
2004-09-02 7:17 ` Ingo Molnar
2004-09-02 8:23 ` Ingo Molnar
2004-09-02 11:10 ` [patch] voluntary-preempt-2.6.9-rc1-bk4-Q9 Ingo Molnar
2004-09-02 12:14 ` Thomas Charbonnel
2004-09-02 13:16 ` Thomas Charbonnel
2004-09-02 13:23 ` Ingo Molnar
2004-09-02 14:38 ` Thomas Charbonnel
2004-09-02 21:57 ` [patch] voluntary-preempt-2.6.9-rc1-bk4-R0 Ingo Molnar
2004-09-02 22:06 ` Lee Revell
2004-09-02 22:14 ` Ingo Molnar
2004-09-02 22:15 ` Lee Revell
2004-09-03 0:24 ` Lee Revell
2004-09-03 3:17 ` Eric St-Laurent
2004-09-03 6:26 ` Lee Revell
2004-09-03 6:36 ` Ingo Molnar
2004-09-03 6:49 ` Lee Revell
2004-09-03 7:01 ` Ingo Molnar
2004-09-03 7:05 ` Ingo Molnar
2004-09-03 7:40 ` Lee Revell
2004-09-03 7:50 ` Free Ekanayaka
2004-09-03 8:05 ` Lee Revell
2004-09-03 9:05 ` Free Ekanayaka
2004-09-03 9:25 ` [patch] voluntary-preempt-2.6.9-rc1-bk4-R1 Ingo Molnar
2004-09-03 9:50 ` Luke Yelavich
2004-09-03 10:29 ` Ingo Molnar
2004-09-03 10:43 ` Luke Yelavich
2004-09-03 11:33 ` Thomas Charbonnel
2004-09-03 11:49 ` Ingo Molnar
2004-09-03 12:05 ` Thomas Charbonnel
2004-09-03 16:14 ` Thomas Charbonnel
2004-09-03 17:36 ` Thomas Charbonnel
2004-09-03 11:36 ` [patch] voluntary-preempt-2.6.9-rc1-bk4-R2 Ingo Molnar
2004-09-03 8:09 ` [patch] voluntary-preempt-2.6.9-rc1-bk4-R0 Luke Yelavich
2004-09-03 8:13 ` Lee Revell
2004-09-03 8:21 ` Luke Yelavich
2004-09-03 12:52 ` Luke Yelavich
2004-09-03 18:09 ` K.R. Foley
2004-09-03 11:04 ` K.R. Foley
2004-09-03 17:02 ` K.R. Foley
2004-09-03 20:40 ` Lee Revell
2004-09-03 17:10 ` K.R. Foley
2004-09-03 18:17 ` Ingo Molnar
2004-09-03 18:36 ` K.R. Foley
2004-09-03 19:30 ` [patch] voluntary-preempt-2.6.9-rc1-bk4-R3 Ingo Molnar
2004-09-03 19:49 ` K.R. Foley
2004-09-04 3:39 ` K.R. Foley
2004-09-04 3:43 ` K.R. Foley
2004-09-04 6:41 ` Ingo Molnar
2004-09-04 12:28 ` K.R. Foley
2004-09-04 8:57 ` Ingo Molnar
2004-09-04 10:16 ` Lee Revell
2004-09-04 14:35 ` K.R. Foley
2004-09-04 20:05 ` Ingo Molnar
2004-09-03 18:39 ` [patch] voluntary-preempt-2.6.9-rc1-bk4-R0 Ingo Molnar
2004-09-03 18:41 ` K.R. Foley
[not found] <OFD220F58F.002C5901-ON86256F02.005C2FB1-86256F02.005C2FD5@raytheon.com>
2004-09-01 17:09 ` [patch] voluntary-preempt-2.6.9-rc1-bk4-Q5 Ingo Molnar
-- strict thread matches above, loose matches on Subject: below --
2004-09-01 15:21 Mark_H_Johnson
2004-09-02 22:24 ` Ingo Molnar
2004-09-01 14:37 Mark_H_Johnson
2004-09-01 19:31 ` Takashi Iwai
[not found] <2yiVZ-IZ-15@gated-at.bofh.it>
[not found] ` <2ylhi-2hg-3@gated-at.bofh.it>
[not found] ` <2ynLU-42D-7@gated-at.bofh.it>
[not found] ` <2yqJJ-5ZL-1@gated-at.bofh.it>
[not found] ` <2yQkS-6Zh-13@gated-at.bofh.it>
[not found] ` <2zaCV-4FE-3@gated-at.bofh.it>
[not found] ` <2zaWk-4Yj-9@gated-at.bofh.it>
[not found] ` <2zmE8-4Zz-11@gated-at.bofh.it>
[not found] ` <2zngP-5wD-9@gated-at.bofh.it>
[not found] ` <2zngP-5wD-7@gated-at.bofh.it>
[not found] ` <2znJS-5Pm-25@gated-at.bofh.it>
2004-08-31 23:06 ` Andi Kleen
[not found] ` <2znJS-5Pm-27@gated-at.bofh.it>
[not found] ` <2znJS-5Pm-29@gated-at.bofh.it>
[not found] ` <2znJS-5Pm-31@gated-at.bofh.it>
[not found] ` <2znJS-5Pm-33@gated-at.bofh.it>
2004-08-31 23:10 ` Andi Kleen
2004-09-01 7:05 ` Ingo Molnar
2004-08-31 20:10 Mark_H_Johnson
2004-08-31 20:37 ` Ingo Molnar
2004-08-31 15:17 Mark_H_Johnson
2004-08-31 17:20 ` Lee Revell
2004-08-31 18:09 ` Lee Revell
2004-08-31 18:53 ` Takashi Iwai
2004-08-31 18:56 ` Ingo Molnar
2004-09-02 16:59 ` Jaroslav Kysela
2004-09-02 17:50 ` Lee Revell
2004-08-31 18:19 ` Takashi Iwai
2004-08-31 18:48 ` Ingo Molnar
2004-08-31 19:02 ` Takashi Iwai
2004-08-31 18:50 ` Ingo Molnar
2004-08-31 12:46 Mark_H_Johnson
2004-08-30 22:04 Mark_H_Johnson
2004-08-31 6:31 ` Ingo Molnar
2004-09-01 7:30 ` Ingo Molnar
2004-08-28 17:52 [patch] voluntary-preempt-2.6.9-rc1-bk4-Q0 Lee Revell
2004-08-28 19:44 ` [patch] voluntary-preempt-2.6.9-rc1-bk4-Q2 Ingo Molnar
2004-08-28 20:10 ` Daniel Schmitt
2004-08-28 20:31 ` [patch] voluntary-preempt-2.6.9-rc1-bk4-Q3 Ingo Molnar
2004-08-28 21:10 ` Lee Revell
2004-08-28 21:13 ` Ingo Molnar
2004-08-28 21:16 ` Lee Revell
2004-08-28 23:51 ` Lee Revell
2004-08-29 2:35 ` Lee Revell
2004-08-29 5:43 ` [patch] voluntary-preempt-2.6.9-rc1-bk4-Q4 Ingo Molnar
2004-08-30 9:06 ` [patch] voluntary-preempt-2.6.9-rc1-bk4-Q5 Ingo Molnar
2004-08-30 14:25 ` Thomas Charbonnel
2004-08-30 18:00 ` Ingo Molnar
2004-08-31 19:23 ` Thomas Charbonnel
2004-08-31 19:30 ` Ingo Molnar
2004-08-31 19:45 ` Thomas Charbonnel
2004-08-31 6:40 ` Lee Revell
2004-08-31 6:53 ` Ingo Molnar
2004-08-31 23:03 ` Lee Revell
2004-09-01 15:52 ` Martin Josefsson
2004-09-01 21:15 ` Lee Revell
2004-09-01 21:30 ` Lee Revell
2004-08-31 7:06 ` Ingo Molnar
2004-08-31 19:21 ` Lee Revell
2004-08-31 19:37 ` Ingo Molnar
2004-08-31 19:47 ` Lee Revell
2004-08-31 19:51 ` Ingo Molnar
2004-08-31 20:09 ` Ingo Molnar
2004-08-31 20:10 ` Lee Revell
2004-08-31 20:14 ` Ingo Molnar
2004-08-31 20:20 ` Ingo Molnar
2004-08-31 20:34 ` Lee Revell
2004-08-31 20:39 ` Ingo Molnar
2004-08-31 20:41 ` Lee Revell
2004-08-31 17:40 ` Peter Zijlstra
2004-09-01 1:43 ` Lee Revell
2004-09-01 2:30 ` Lee Revell
2004-09-01 7:27 ` Lee Revell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040831084928.GA10299@elte.hu \
--to=mingo@elte.hu \
--cc=Mark_H_Johnson@raytheon.com \
--cc=kr@cybsft.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkml@felipe-alfaro.com \
--cc=pnambic@unu.nu \
--cc=rlrevell@joe-job.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox