All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] voluntary-preempt-2.6.9-rc1-bk4-Q8
  2004-09-02  6:33 ` Ingo Molnar
@ 2004-09-02  6:55   ` Ingo Molnar
  2004-09-02  7:04     ` Lee Revell
  2004-09-02  8:23     ` Ingo Molnar
  0 siblings, 2 replies; 15+ messages in thread
From: Ingo Molnar @ 2004-09-02  6:55 UTC (permalink / raw)
  To: Mark_H_Johnson
  Cc: K.R. Foley, linux-kernel, Felipe Alfaro Solana, Daniel Schmitt,
	Lee Revell, alsa-devel


i've released the -Q8 patch:

  http://redhat.com/~mingo/voluntary-preempt/voluntary-preempt-2.6.9-rc1-bk4-Q8

ontop of:

  http://redhat.com/~mingo/voluntary-preempt/diff-bk-040828-2.6.8.1.bz2

this release fixes an artificial 0-1msec delay between hardirq arrival
and softirq invocation. This should solve some of the ALSA artifacts
reported by Mark H Johnson. It should also solve the rtl8139 problems -
i've put such a card into a testbox and with -Q7 i had similar packet
latency problems while with -Q8 it works just fine.

So netdev_backlog_granularity is still a value of 1 in -Q8, please check
whether the networking problems (bootup and service startup and latency)
problems are resolved. (and increase this value in case there are still
problems.)

	Ingo

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [patch] voluntary-preempt-2.6.9-rc1-bk4-Q8
  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:17       ` Ingo Molnar
  2004-09-02  8:23     ` Ingo Molnar
  1 sibling, 2 replies; 15+ messages in thread
From: Lee Revell @ 2004-09-02  7:04 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Mark_H_Johnson, K.R. Foley, linux-kernel, Felipe Alfaro Solana,
	Daniel Schmitt, alsa-devel

On Thu, 2004-09-02 at 02:55, Ingo Molnar wrote:
> i've released the -Q8 patch:
> 
>   http://redhat.com/~mingo/voluntary-preempt/voluntary-preempt-2.6.9-rc1-bk4-Q8
> 
> ontop of:
> 
>   http://redhat.com/~mingo/voluntary-preempt/diff-bk-040828-2.6.8.1.bz2
> 

Here are traces of a 145, 190, and 217 usec latencies in
netif_receive_skb:

http://krustophenia.net/testresults.php?dataset=2.6.9-rc1-Q6#/var/www/2.6.9-rc1-Q6/trace2.txt
http://krustophenia.net/testresults.php?dataset=2.6.9-rc1-Q6#/var/www/2.6.9-rc1-Q6/trace3.txt
http://krustophenia.net/testresults.php?dataset=2.6.9-rc1-Q6#/var/www/2.6.9-rc1-Q6/trace4.txt

Some of these are with ip_conntrack enabled, at the request of another
poster, this does not make much of a difference, it increases the worst
case latency by 20 usec or so.

Also there is the rt_garbage_collect issue, previously reported.  I have
not seen this lately but I do not remember seeing that it was fixed.

Lee

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [patch] voluntary-preempt-2.6.9-rc1-bk4-Q8
  2004-09-02  7:04     ` Lee Revell
@ 2004-09-02  7:15       ` Ingo Molnar
  2004-09-02  7:31         ` Lee Revell
  2004-09-02 23:25         ` Lee Revell
  2004-09-02  7:17       ` Ingo Molnar
  1 sibling, 2 replies; 15+ messages in thread
From: Ingo Molnar @ 2004-09-02  7:15 UTC (permalink / raw)
  To: Lee Revell
  Cc: Mark_H_Johnson, K.R. Foley, linux-kernel, Felipe Alfaro Solana,
	Daniel Schmitt, alsa-devel


* Lee Revell <rlrevell@joe-job.com> wrote:

> Here are traces of a 145, 190, and 217 usec latencies in
> netif_receive_skb:
> 
> http://krustophenia.net/testresults.php?dataset=2.6.9-rc1-Q6#/var/www/2.6.9-rc1-Q6/trace2.txt
> http://krustophenia.net/testresults.php?dataset=2.6.9-rc1-Q6#/var/www/2.6.9-rc1-Q6/trace3.txt
> http://krustophenia.net/testresults.php?dataset=2.6.9-rc1-Q6#/var/www/2.6.9-rc1-Q6/trace4.txt

these all seem to be single-packet processing latencies - it would be
quite hard to make those codepaths preemptible.

i'd suggest to turn off things like netfilter and ip_conntrack (and
other optional networking features that show up in the trace), they can
only increase latency:

 00000001 0.016ms (+0.000ms): ip_rcv (netif_receive_skb)
 00000001 0.019ms (+0.002ms): nf_hook_slow (ip_rcv)
 00000002 0.019ms (+0.000ms): nf_iterate (nf_hook_slow)
 00000002 0.021ms (+0.001ms): ip_conntrack_defrag (nf_iterate)
 00000002 0.022ms (+0.000ms): ip_conntrack_in (nf_iterate)
 00000002 0.022ms (+0.000ms): ip_ct_find_proto (ip_conntrack_in)
 00000103 0.023ms (+0.000ms): __ip_ct_find_proto (ip_ct_find_proto)
 00000102 0.024ms (+0.000ms): local_bh_enable (ip_ct_find_proto)
 00000002 0.025ms (+0.001ms): tcp_error (ip_conntrack_in)

	Ingo

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [patch] voluntary-preempt-2.6.9-rc1-bk4-Q8
  2004-09-02  7:04     ` Lee Revell
  2004-09-02  7:15       ` Ingo Molnar
@ 2004-09-02  7:17       ` Ingo Molnar
  1 sibling, 0 replies; 15+ messages in thread
From: Ingo Molnar @ 2004-09-02  7:17 UTC (permalink / raw)
  To: Lee Revell
  Cc: Mark_H_Johnson, K.R. Foley, linux-kernel, Felipe Alfaro Solana,
	Daniel Schmitt


* Lee Revell <rlrevell@joe-job.com> wrote:

> Also there is the rt_garbage_collect issue, previously reported.  I
> have not seen this lately but I do not remember seeing that it was
> fixed.

i dont think it's fixed, please re-report it if it occurs again, there
have been many changes.

	Ingo

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [patch] voluntary-preempt-2.6.9-rc1-bk4-Q8
  2004-09-02  7:15       ` Ingo Molnar
@ 2004-09-02  7:31         ` Lee Revell
  2004-09-02  7:46           ` Ingo Molnar
  2004-09-02 23:25         ` Lee Revell
  1 sibling, 1 reply; 15+ messages in thread
From: Lee Revell @ 2004-09-02  7:31 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Mark_H_Johnson, K.R. Foley, linux-kernel, Felipe Alfaro Solana,
	Daniel Schmitt, alsa-devel

On Thu, 2004-09-02 at 03:15, Ingo Molnar wrote:
> * Lee Revell <rlrevell@joe-job.com> wrote:
> 
> > Here are traces of a 145, 190, and 217 usec latencies in
> > netif_receive_skb:
> > 
> > http://krustophenia.net/testresults.php?dataset=2.6.9-rc1-Q6#/var/www/2.6.9-rc1-Q6/trace2.txt
> > http://krustophenia.net/testresults.php?dataset=2.6.9-rc1-Q6#/var/www/2.6.9-rc1-Q6/trace3.txt
> > http://krustophenia.net/testresults.php?dataset=2.6.9-rc1-Q6#/var/www/2.6.9-rc1-Q6/trace4.txt
> 
> these all seem to be single-packet processing latencies - it would be
> quite hard to make those codepaths preemptible.
> 

I suspected as much, these are not a problem.  The large latencies from
reading the /proc filesystem are a bit worrisome (trace1.txt), I will
report these again if they still happen with Q8.

Lee 

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [patch] voluntary-preempt-2.6.9-rc1-bk4-Q8
  2004-09-02  7:31         ` Lee Revell
@ 2004-09-02  7:46           ` Ingo Molnar
  2004-09-03  1:10               ` Rusty Russell
  0 siblings, 1 reply; 15+ messages in thread
From: Ingo Molnar @ 2004-09-02  7:46 UTC (permalink / raw)
  To: Lee Revell
  Cc: Mark_H_Johnson, K.R. Foley, linux-kernel, Felipe Alfaro Solana,
	Daniel Schmitt, alsa-devel, Rusty Russell, netfilter-devel


* Lee Revell <rlrevell@joe-job.com> wrote:

> > these all seem to be single-packet processing latencies - it would be
> > quite hard to make those codepaths preemptible.
> 
> I suspected as much, these are not a problem.  The large latencies
> from reading the /proc filesystem are a bit worrisome (trace1.txt), I
> will report these again if they still happen with Q8.

conntrack's ct_seq ops indeed seems to have latency problems - the quick
workaround is to disable conntrack.

The reason for the latency is that ct_seq_start() does a read_lock() on
ip_conntrack_lock and only ct_seq_stop() releases it - possibly
milliseconds later. But the whole conntrack /proc code is quite flawed:

        READ_LOCK(&ip_conntrack_lock);

        if (*pos >= ip_conntrack_htable_size)
                return NULL;

        bucket = kmalloc(sizeof(unsigned int), GFP_KERNEL);
        if (!bucket) {
                return ERR_PTR(-ENOMEM);
        }
        *bucket = *pos;
        return bucket;

#1: we kmalloc(GFP_KERNEL) with a spinlock held and softirqs off - ouch!

#2: why does it do the kmalloc() anyway? It could store the position in
    the seq pointer just fine. No need to alloc an integer pointer to
    store the value in ...

#3: to fix the latency, ct_seq_show() could take the ip_conntrack_lock 
    and could check the current index against ip_conntrack_htable_size. 
    There's not much point in making this non-preemptible, there's 
    a 4K granularity anyway.

Rusty, what's going on in this code?

	Ingo

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [patch] voluntary-preempt-2.6.9-rc1-bk4-Q8
@ 2004-09-02  7:57 mika.penttila
  2004-09-02  8:32 ` Ingo Molnar
  0 siblings, 1 reply; 15+ messages in thread
From: mika.penttila @ 2004-09-02  7:57 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: linux-kernel

Ingo,

I think there might be a problem with voluntary-preempt's hadling of softirqs. Namely, in cond_resched_softirq(), you do __local_bh_enable() and local_bh_disable(). But it may be the case that the softirq is handled from ksoftirqd, and then the preempt_count isn't elevated with SOFTIRQ_OFFSET (only PF_SOFTIRQ is set). So the __local_bh_enable() actually makes preempt_count negative, which might have bad effects. Or am I missing something?

Mika



^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [patch] voluntary-preempt-2.6.9-rc1-bk4-Q8
  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  8:23     ` Ingo Molnar
  1 sibling, 0 replies; 15+ messages in thread
From: Ingo Molnar @ 2004-09-02  8:23 UTC (permalink / raw)
  To: Mark_H_Johnson
  Cc: K.R. Foley, linux-kernel, Felipe Alfaro Solana, Daniel Schmitt,
	Lee Revell, alsa-devel


* Ingo Molnar <mingo@elte.hu> wrote:

> this release fixes an artificial 0-1msec delay between hardirq arrival
> and softirq invocation. This should solve some of the ALSA artifacts
> reported by Mark H Johnson. It should also solve the rtl8139 problems
> - i've put such a card into a testbox and with -Q7 i had similar
> packet latency problems while with -Q8 it works just fine.

the rtl8139 problems are not fixed yet - i can still reproduce the
delayed packet issues.

	Ingo

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [patch] voluntary-preempt-2.6.9-rc1-bk4-Q8
  2004-09-02  7:57 [patch] voluntary-preempt-2.6.9-rc1-bk4-Q8 mika.penttila
@ 2004-09-02  8:32 ` Ingo Molnar
  2004-09-02  9:06   ` Peter Zijlstra
  0 siblings, 1 reply; 15+ messages in thread
From: Ingo Molnar @ 2004-09-02  8:32 UTC (permalink / raw)
  To: mika.penttila; +Cc: linux-kernel


* mika.penttila@kolumbus.fi <mika.penttila@kolumbus.fi> wrote:

> Ingo,
> 
> I think there might be a problem with voluntary-preempt's hadling of
> softirqs. Namely, in cond_resched_softirq(), you do
> __local_bh_enable() and local_bh_disable(). But it may be the case
> that the softirq is handled from ksoftirqd, and then the preempt_count
> isn't elevated with SOFTIRQ_OFFSET (only PF_SOFTIRQ is set). So the
> __local_bh_enable() actually makes preempt_count negative, which might
> have bad effects. Or am I missing something?

you are right. Fortunately the main use of cond_resched_softirq() is via
cond_resched_all() - which is safe because it uses softirq_count(). But
the kernel/timer.c explicit call to cond_resched_softirq() is unsafe.
I've fixed this in my tree and i've added an assert to catch the
underflow when it happens.

	Ingo

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [patch] voluntary-preempt-2.6.9-rc1-bk4-Q8
  2004-09-02  8:32 ` Ingo Molnar
@ 2004-09-02  9:06   ` Peter Zijlstra
  0 siblings, 0 replies; 15+ messages in thread
From: Peter Zijlstra @ 2004-09-02  9:06 UTC (permalink / raw)
  To: Ingo Molnar; +Cc: mika.penttila, linux-kernel

On Thu, 2004-09-02 at 10:32, Ingo Molnar wrote:
> * mika.penttila@kolumbus.fi <mika.penttila@kolumbus.fi> wrote:
> 
> > Ingo,
> > 
> > I think there might be a problem with voluntary-preempt's hadling of
> > softirqs. Namely, in cond_resched_softirq(), you do
> > __local_bh_enable() and local_bh_disable(). But it may be the case
> > that the softirq is handled from ksoftirqd, and then the preempt_count
> > isn't elevated with SOFTIRQ_OFFSET (only PF_SOFTIRQ is set). So the
> > __local_bh_enable() actually makes preempt_count negative, which might
> > have bad effects. Or am I missing something?
> 
> you are right. Fortunately the main use of cond_resched_softirq() is via
> cond_resched_all() - which is safe because it uses softirq_count(). But
> the kernel/timer.c explicit call to cond_resched_softirq() is unsafe.
> I've fixed this in my tree and i've added an assert to catch the
> underflow when it happens.
> 
> 	Ingo

I've had linux-2.6.9-rc1-bk8-Q7 lock up on me this morning not long
after starting a glibc compile resulting from: emerge -uo gnome
although it did survive a make World on xorg-cvs.

Could this have been caused by the bug under discussion?

Unfortunatly I don't have much testing time before I go on hollidays,
so for now I went back to linux-2.6.9-rc1-bk6-Q5 which on my machine is
rock solid.

Peter


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [patch] voluntary-preempt-2.6.9-rc1-bk4-Q8
  2004-09-02  7:15       ` Ingo Molnar
  2004-09-02  7:31         ` Lee Revell
@ 2004-09-02 23:25         ` Lee Revell
  2004-09-02 23:28           ` Ingo Molnar
  1 sibling, 1 reply; 15+ messages in thread
From: Lee Revell @ 2004-09-02 23:25 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Mark_H_Johnson, K.R. Foley, linux-kernel, Felipe Alfaro Solana,
	Daniel Schmitt, alsa-devel

On Thu, 2004-09-02 at 03:15, Ingo Molnar wrote:
> * Lee Revell <rlrevell@joe-job.com> wrote:
> 
> > Here are traces of a 145, 190, and 217 usec latencies in
> > netif_receive_skb:
> > 
> > http://krustophenia.net/testresults.php?dataset=2.6.9-rc1-Q6#/var/www/2.6.9-rc1-Q6/trace2.txt
> > http://krustophenia.net/testresults.php?dataset=2.6.9-rc1-Q6#/var/www/2.6.9-rc1-Q6/trace3.txt
> > http://krustophenia.net/testresults.php?dataset=2.6.9-rc1-Q6#/var/www/2.6.9-rc1-Q6/trace4.txt
> 
> these all seem to be single-packet processing latencies - it would be
> quite hard to make those codepaths preemptible.
> 
> i'd suggest to turn off things like netfilter and ip_conntrack (and
> other optional networking features that show up in the trace), they can
> only increase latency:
> 

Do you see any optional networking features in the trace (other than
ip_conntrack)?  I was under the impression that I had everything
optional disabled.

Lee  

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [patch] voluntary-preempt-2.6.9-rc1-bk4-Q8
  2004-09-02 23:25         ` Lee Revell
@ 2004-09-02 23:28           ` Ingo Molnar
  2004-09-02 23:32             ` Lee Revell
  0 siblings, 1 reply; 15+ messages in thread
From: Ingo Molnar @ 2004-09-02 23:28 UTC (permalink / raw)
  To: Lee Revell
  Cc: Mark_H_Johnson, K.R. Foley, linux-kernel, Felipe Alfaro Solana,
	Daniel Schmitt, alsa-devel


* Lee Revell <rlrevell@joe-job.com> wrote:

> Do you see any optional networking features in the trace (other than
> ip_conntrack)?  I was under the impression that I had everything
> optional disabled.

yeah, it seems to be only ip_conntrack and netfilter (which conntrack
relies on).

	Ingo

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [patch] voluntary-preempt-2.6.9-rc1-bk4-Q8
  2004-09-02 23:28           ` Ingo Molnar
@ 2004-09-02 23:32             ` Lee Revell
  0 siblings, 0 replies; 15+ messages in thread
From: Lee Revell @ 2004-09-02 23:32 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Mark_H_Johnson, K.R. Foley, linux-kernel, Felipe Alfaro Solana,
	Daniel Schmitt, alsa-devel

On Thu, 2004-09-02 at 19:28, Ingo Molnar wrote:
> * Lee Revell <rlrevell@joe-job.com> wrote:
> 
> > Do you see any optional networking features in the trace (other than
> > ip_conntrack)?  I was under the impression that I had everything
> > optional disabled.
> 
> yeah, it seems to be only ip_conntrack and netfilter (which conntrack
> relies on).
> 

FWIW these seem to only slow down the single packet path by about 10%. 
This is pretty good.

Lee

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [patch] voluntary-preempt-2.6.9-rc1-bk4-Q8
  2004-09-02  7:46           ` Ingo Molnar
@ 2004-09-03  1:10               ` Rusty Russell
  0 siblings, 0 replies; 15+ messages in thread
From: Rusty Russell @ 2004-09-03  1:10 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Daniel Schmitt, netfilter-devel, linux-kernel, K.R. Foley,
	Lee Revell, Mark_H_Johnson, alsa-devel, Felipe Alfaro Solana

On Thu, 2004-09-02 at 17:46, Ingo Molnar wrote:
> Rusty, what's going on in this code?

Good question!  Not my code, fortunately...

> #1: we kmalloc(GFP_KERNEL) with a spinlock held and softirqs off - ouch!
> 
> #2: why does it do the kmalloc() anyway? It could store the position in
>     the seq pointer just fine. No need to alloc an integer pointer to
>     store the value in ...
> 
> #3: to fix the latency, ct_seq_show() could take the ip_conntrack_lock 
>     and could check the current index against ip_conntrack_htable_size. 
>     There's not much point in making this non-preemptible, there's 
>     a 4K granularity anyway.

The code tries to put an entire hash bucket into a single seq_read(). 
That's not going to work if the hash is really deep.  On the other hand,
not much will, and it's simple.

The lock is only needed on traversing: htable_size can't change after
init anyway, so it should be done in ct_seq_show.

Fix should be fairly simple...
Rusty.
-- 
Anyone who quotes me in their signature is an idiot -- Rusty Russell

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [patch] voluntary-preempt-2.6.9-rc1-bk4-Q8
@ 2004-09-03  1:10               ` Rusty Russell
  0 siblings, 0 replies; 15+ messages in thread
From: Rusty Russell @ 2004-09-03  1:10 UTC (permalink / raw)
  To: Ingo Molnar
  Cc: Lee Revell, Mark_H_Johnson, K.R. Foley, linux-kernel,
	Felipe Alfaro Solana, Daniel Schmitt, alsa-devel, netfilter-devel

On Thu, 2004-09-02 at 17:46, Ingo Molnar wrote:
> Rusty, what's going on in this code?

Good question!  Not my code, fortunately...

> #1: we kmalloc(GFP_KERNEL) with a spinlock held and softirqs off - ouch!
> 
> #2: why does it do the kmalloc() anyway? It could store the position in
>     the seq pointer just fine. No need to alloc an integer pointer to
>     store the value in ...
> 
> #3: to fix the latency, ct_seq_show() could take the ip_conntrack_lock 
>     and could check the current index against ip_conntrack_htable_size. 
>     There's not much point in making this non-preemptible, there's 
>     a 4K granularity anyway.

The code tries to put an entire hash bucket into a single seq_read(). 
That's not going to work if the hash is really deep.  On the other hand,
not much will, and it's simple.

The lock is only needed on traversing: htable_size can't change after
init anyway, so it should be done in ct_seq_show.

Fix should be fairly simple...
Rusty.
-- 
Anyone who quotes me in their signature is an idiot -- Rusty Russell


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2004-09-03  1:23 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-09-02  7:57 [patch] voluntary-preempt-2.6.9-rc1-bk4-Q8 mika.penttila
2004-09-02  8:32 ` Ingo Molnar
2004-09-02  9:06   ` Peter Zijlstra
  -- strict thread matches above, loose matches on Subject: below --
2004-08-30 19:13 [patch] voluntary-preempt-2.6.9-rc1-bk4-Q5 Mark_H_Johnson
2004-09-02  6:33 ` 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-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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.