public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: george anzinger <george@mvista.com>
To: Ingo Molnar <mingo@elte.hu>
Cc: Zwane Mwaikambo <zwane@linuxpower.ca>,
	Trond Myklebust <trond.myklebust@fys.uio.no>,
	Linus Torvalds <torvalds@transmeta.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>
Subject: Re: [patch] irqlock patch -G3. [was Re: odd memory corruption in  2.5.27?]
Date: Tue, 23 Jul 2002 16:53:49 -0700	[thread overview]
Message-ID: <3D3DEC8D.E2BD71CB@mvista.com> (raw)
In-Reply-To: Pine.LNX.4.44.0207240100150.2732-100000@localhost.localdomain

Ingo Molnar wrote:
> 
> On Tue, 23 Jul 2002, george anzinger wrote:
> 
> > I just spent a month tracking down this issue.  It comes
> > down to the slab allocater using per cpu data structures and
> > protecting them with a combination of interrupt disables and
> > spin_locks.  Preemption is allowed (incorrectly) if
> > interrupts are off and preempt_count goes to zero on the
> > spin_unlock. [...]
> 
> > The proposed fix is to catch the attempted preemption in
> > preempt_schedule() and just return if the interrupt system
> > is off. [...]
> 
> this is most definitely not the correct fix ...
> 
> i'm quite convinced that the fix is to avoid illegal preemption, not to
> work it around.

I like this.  The only change I would make is to enable
interrupts in exit.c and entry.S where they are only enabled
under the debug condition now, (mostly I try to avoid
Heisenberg).  I really do like the ability to track down
this problem by just turing on the debug option.
> 
> i've written debugging code that caught and reported this slab.c bug
> within minutes. 

Yeah, its easy when you know what to look for :)

> The code detects the irqs-off condition in schedule(). You
> can find it my latest irqlock patchset, at:
> 
>    http://redhat.com/~mingo/remove-irqlock-patches/remove-irqlock-2.5.27-G3
> 
> it fixes this and other related bugs as well.
> 
> Changes in -G3:
> 
>  - slab.c needs to spin_unlock_no_resched(), instead of spin_unlock(). (It
>    also has to check for preemption in the right spot.) This should fix
>    the memory corruption.
> 
>  - irq_exit() needs to run softirqs if interrupts not active - in the
>    previous patch it ran them when preempt_count() was 0, which is
>    incorrect.
> 
>  - spinlock macros are updated to enable preemption after enabling
>    interrupts. Besides avoiding false positive warnings, this also
> 
>  - fork.c has to call scheduler_tick() with preemption disabled -
>    otherwise scheduler_tick()'s spin_unlock can preempt!
> 
>  - irqs_disabled() macro introduced.
> 
>  - [ all other local_irq_enable() or sti instances conditional on
>      CONFIG_DEBUG_IRQ_SCHEDULE are to fix false positive warnings. ]
> 
> Changes in -G0:
> 
>  - fix buggy in_softirq(). Fortunately the bug made the test broader,
>    which didnt result in algorithmical breakage, just suboptimal
>    performance.
> 
>  - move do_softirq() processing into irq_exit() => this also fixes the
>    softirq processing bugs present in apic.c IRQ handlers that did not
>    test for softirqs after irq_exit().
> 
>  - simplify local_bh_enable().
> 
> Changes in -F9:
> 
>  - replace all instances of:
> 
>         local_save_flags(flags);
>         local_irq_disable();
> 
>    with the shorter form of:
> 
>         local_irq_save(flags);
> 
>   about 30 files are affected by this change.
> 
> Changes in -F8:
> 
>  - preempt/hardirq/softirq count separation, cleanups.
> 
>  - skbuff.c fix.
> 
>  - use irq_count() in scheduler_tick()
> 
> Changes in -F3:
> 
>  - the entry.S cleanups/speedups by Oleg Nesterov.
> 
>  - a rather critical synchronize_irq() bugfix: if a driver frees an
>    interrupt that is still being probed then synchronize_irq() locks up.
>    This bug has caused a spurious boot-lockup on one of my testsystems,
>    ifconfig would lock up trying to close eth0.
> 
>  - remove duplicate definitions from asm-i386/system.h, this fixes
>    compiler warnings.
> 
>         Ingo

-- 
George Anzinger   george@mvista.com
High-res-timers: 
http://sourceforge.net/projects/high-res-timers/
Real time sched:  http://sourceforge.net/projects/rtsched/
Preemption patch:
http://www.kernel.org/pub/linux/kernel/people/rml

  reply	other threads:[~2002-07-23 23:51 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-07-23  6:23 odd memory corruption in 2.5.27? Zwane Mwaikambo
2002-07-23  6:24 ` Zwane Mwaikambo
2002-07-23  6:26   ` Zwane Mwaikambo
2002-07-23  7:57     ` Trond Myklebust
2002-07-23  8:54       ` Zwane Mwaikambo
2002-07-23 20:32         ` george anzinger
2002-07-23 20:47           ` William Lee Irwin III
2002-07-23 23:28           ` [patch] irqlock patch -G3. [was Re: odd memory corruption in 2.5.27?] Ingo Molnar
2002-07-23 23:53             ` george anzinger [this message]
2002-07-23 23:56             ` Linus Torvalds
2002-07-24  0:07               ` Ingo Molnar
2002-07-24  2:15                 ` Linus Torvalds
2002-07-24  8:59                   ` [patch] irqlock patch 2.5.27-H3 Ingo Molnar
2002-07-24  1:08             ` [patch] irqlock patch -G3. [was Re: odd memory corruption in 2.5.27?] Robert Love
2002-07-24  3:13               ` [patch] irqlock patch -G3. [was Re: odd memory corruption in2.5.27?] Andrew Morton
2002-07-24  3:18                 ` Linus Torvalds
2002-07-24  7:13                   ` Ingo Molnar
2002-07-24  7:34                 ` Ingo Molnar
2002-07-24  8:00                   ` [patch] irqlock patch -G3. [was Re: odd memory corruptionin2.5.27?] Andrew Morton
2002-07-24  7:54                     ` Ingo Molnar
2002-07-24  8:03                     ` William Lee Irwin III
2002-07-24  8:06                       ` Ingo Molnar
2002-07-24  8:15                         ` William Lee Irwin III
2002-07-24  8:17                           ` Ingo Molnar
2002-07-24 16:40                     ` Linus Torvalds
2002-07-24 16:49                       ` Robert Love
2002-07-24 20:56                         ` [patch] irqlock patch -G3. [was Re: odd memorycorruptionin2.5.27?] george anzinger
2002-07-24  7:37                 ` [patch] irqlock patch -G3. [was Re: odd memory corruption in2.5.27?] Ingo Molnar
2002-07-24  6:52           ` odd memory corruption in 2.5.27? Zwane Mwaikambo

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=3D3DEC8D.E2BD71CB@mvista.com \
    --to=george@mvista.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=torvalds@transmeta.com \
    --cc=trond.myklebust@fys.uio.no \
    --cc=zwane@linuxpower.ca \
    /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