[ltp] APM suspend with 2.6 kernel [long]

Thomas Hood linux-thinkpad@linux-thinkpad.org
Sun, 04 Jan 2004 17:19:59 +0100


On Sun, 2004-01-04 at 16:09, Michael Hagemann wrote in part:
> Version		Suspend working?
> 
> 2.5.16		yes
> 2.5.24		yes
> 2.5.26		yes
> 2.5.27		yes (gcc-3.3.3)
> 2.5.28		no  (gcc-3.3.3)
> 2.5.28		no  (gcc-2.95.4)
> 2.5.30		no
> 2.5.31		no
> 2.6.1-rc1	no
>
> A first look at the ChangeLog and the patch shows a slightly different IRQ
> handling in the i386/kernel and apm routines.  I will try to apply some of
> the patches in order to isolate the bad guy...

IRQ handling was changed throughout the kernel in 2.5.28 in order to
eliminate global cli() / sti().  There was also a big change to the
serial driver which just *might* be relevant.  Here is the ChangeLog,
sorted and stripped of everything that I don't think could be the cause:

<mingo@elte.hu>
  [PATCH] "big IRQ lock" removal, IRQ cleanups
  
  This is a massive cleanup of the IRQ subsystem.  It's losely based on
  Linus' original idea and DaveM's original implementation, to fold our
  various irq, softirq and bh counters into the preemption counter.
  
  with this approach it was possible:

   - to remove the 'big IRQ lock' on SMP - on which sti() and cli()
     relied.
   - to streamline/simplify arch/i386/kernel/irq.c significantly.
   - to simplify the softirq code.
   - to remove the preemption count increase/decrease code from the
     lowlevel IRQ assembly code.
   - to speed up schedule() a bit.
  
  Global sti() and cli() is gone forever on SMP, there is no more
  globally synchronizing irq-disabling capability.  All code that
  relied on sti() and cli() and restore_flags() must use other locking
  mechanisms from now on (spinlocks and __cli()/__sti()).
  
  obviously this patch breaks massive amounts of code, so only limited
  .configs are working at the moment (UP is expected to be unaffected,
  but SMP will require various driver updates).
  
  The patch was developed and tested on SMP systems, and while the code
  is still a bit rough in places, the base IRQ code appears to be pretty
  robust and clean.
  
  while it boots already so the worst is over, there is lots of work
  left: eg. to fix the serial layer to not use cli()/sti() and bhs ...

<mingo@elte.hu>
  [PATCH] "big IRQ lock" removal docs
  
  i've done a minor comment update in softirq.c, plus i've written a
  cli-sti-removal.txt guide to help driver writers do the transition.

<mingo@elte.hu>
  [PATCH] Re: [patch] cli()/sti() cleanup
  
  Make people use the proper cli/sti replacements

<mingo@elte.hu>
  [PATCH] irqlock patch 2.5.27-H6
  
   - init thread needs to have preempt_count of 1 until sched_init().
     (William Lee Irwin III)
   - clean up the irq-mask macros. (Linus)
   - add barrier() to irq_enter() and irq_exit(). (based on Oleg
     Nesterov's comment.)
   - move the irqs-off check into preempt_schedule() and remove
     CONFIG_DEBUG_IRQ_SCHEDULE.
   - remove spin_unlock_no_resched() and comment the affected places
     more agressively.
   - 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. ]
   - 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().

<torvalds@home.transmeta.com>
  Update ensoniq sound driver to new irq serialization

<rml@tech9.net>
  [PATCH] Re: "big IRQ lock" removal docs
  
  One more doc correction while we are at it...

<torvalds@penguin.transmeta.com>
  Ingo Molnar's update to remove irqlock (documentation and fixing
  a number of drivers)

<dalecki@evision.ag>
  [PATCH] IDE-101
  
  Here is a quick fix.  I would like to synchronize with the irq handler
  changes as well.  Becouse right now I know that preemption is killing
  the disk subsystem when moving data between disks using different
  request queues...  In esp.  It get's me in to do_request() with a
  queue in unplugged state.  (Not everything is my fault, after all
  :-).

<torvalds@home.transmeta.com>
  Fix up irqlock removal patch, avoid compiler warnings

<rmk@arm.linux.org.uk>
  [PATCH] Serial driver stuff
  
  The serial layer is restructured to allow less code duplication (and
  hence bug duplication) across various serial drivers.  Since ARM adds
  six extra serial drivers, maintaining six copies of serial.c was not
  my idea of fun.
  
  Therefore, we've ended up with a core serial driver, which knows about
  the interactions with the tty layer, and low-level hardware drivers,
  which know all about the hardware.  The interface between the two is
  described in "Documentation/serial/driver".
  
  This patch completely removes the old serial.c driver and its
  associated configuration options, as you requested at KS2002.
  We keep a certain amount of configuration compatibility with the
  per-architecture serial.h file for the moment; this *will* be killed
  in the next round of patches.   The biggest user of this is x86, and
  since I don't have an x86 box to test this stuff on, I think the
  changes are best kept separate.

<rmk@flint.arm.linux.org.uk>
  [SERIAL] Rename files to remove serial_ prefix.

<rmk@flint.arm.linux.org.uk>
  [SERIAL] Fix up various filenames, etc, from Ingo's merge of serial.

<rmk@flint.arm.linux.org.uk>
  [SERIAL] Fix deadlock in __uart_start introduced in previous cset
  Thanks to Zwane Mwaikambo for finding this.

<rmk@flint.arm.linux.org.uk>
  [SERIAL] Fix sa1100 serial driver stop function parameters.


-- 
Thomas Hood <jdthood2@yahoo.co.uk>