Martin Schwidefsky <schwidefsky@de.ibm.com> reported "Bug with shared
memory" to LKML 14 May: hang due to schedule in truncate_list_pages
called from .... shm_destroy holding shm_lock spinlock. shm_destroy
needs that lock for shm_rmid, but it can be safely unlocked once link
from id to shp has been removed.
Martin Dalecki [Wed, 24 Jul 2002 03:12:13 +0000 (20:12 -0700)]
[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 :-).
- 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().
Amiga Zorro bus updates
- Bring APUS Zorro bus announcement in sync with the m68k version
- Fix typo in Zorro device generator name
- Kill duplicate ] in Zorro device ID database
- Include <asm/io.h> instead of duplicating definitions from <asm/io.h>
M68k VT updates:
- Include <linux/vt_kern.h> instead of copying the kd_mksound() prototype
- Lots of stuff depends on CONFIG_VT:
o SYSRQ_KEY
o kd_mksound()
o mach_keyb_init()
o mach_kbdrate()
o mach_kbd_leds()
o mach_kbd_translate()
o mach_sysrq_xlate()
o Atari keyboard and joystick drivers
- There's no need to provide dummy routines for kbd{rate,_leds}()
- dummy_con depends on CONFIG_DUMMY_CONSOLE
M68k parport updates
- Remove workaround code for parport bug (parport without FIFO)
- ->dma_buf is used in FIFO mode only
- Add missing prototype for parport_atari_init()
- Initialize uninitialized variable
Mac/m68k Nubus updates
- Use nubus_{read,write}[bwl]()
- Fix /proc/bus/nubus
- Fix type and linkage of nubus_init()
- Use nubus_{read,write}[bwl]()
- Kill some address assignment warnings
- Include <asm/nubus.h>
- nubus_init() is an initcall, hence static
Update ISA space code on m68k (from 2.4.x)
- Add support for multiple types of ISA busses in one kernel image (e.g. an
image for both Q40 and Amiga with PCMCIA)
- Allow port operations on m68k if CONFIG_ISA is defined
M68k I/O core updates
- Use memory mapped I/O access routines for non-ISA/PCI/PCMCIA m68k devices
- Don't use writel() and friends on m68k memory mapped I/O
- Fix typo in definition of writew()
- Add missing definitions for {in,out}_le{16,32}()
The old form of designated initializers are obsolete: we need to replace them
with the ISO C forms before 2.6. Gcc has always supported both forms anyway.
(from Rusty Russell <rusty@rustcorp.com.au>, with some mods by me)
Linux/m68k configuration updates
- Unify serial console questions
- Move serial driver config questions together
- The Atari mouse driver depends on the Atari keyboard driver, hence on
CONFIG_VT
- Don't hardcode CONFIG_VT=n on VME, you may want it for a multi-machine
kernel
- The IRQ_* definitions are not used on Amiga, but we need them if we
build a multi-machine kernel, too
Atari frame buffer device updates
- Move static function definition before usage
- Fix breakage caused by recent fbdev changes
- Make some setup parameter parsing separate routines (strsep() must be able
to modify the passed pointers)
- On Atari the ATI Mach64 registers are memory mapped, but it's not on
the PCI bus, so we cannot use writel() and friends.
- Kill warnings by protecting unused data with the appropriate #ifdef
- On Atari the ATI Mach64 registers are memory mapped, but it's not on the
PCI bus, so we cannot use writel() and friends.
- Fix assignment of addresses for Atari
Mac/m68k ADB updates (from 2.4.x)
- Add support for m68k Macs
- Add missing call to VIA CUDA initialization routine
- Update Mac II VIA support
- Make local functions static and add their prototypes
- Add missing defines for Mac/m68k PMUs
It turns out there was a subtle bug in Craig Kulesa's port of
the rmap patch to 2.5, which is only apparent on non-x86 machines
where pfn 0 isn't valid.
The problem was that zap_pte_range() would clear the pte before
page_remove_rmap() would get called. This means that on these
machines the pte chain would never be removed and the machine
would oops at page_alloc.c line 98...
Thanks to Russell King for helping track down this bug.
Kai Mäkisara [Tue, 23 Jul 2002 02:12:51 +0000 (19:12 -0700)]
[PATCH] SCSI tape driver fixes for 2.5.27
This patch contains the following changes to the SCSI tape driver:
- fixes EOM bug in large transfer in fixed block mode
- enables writing trailers by alternating error with ENOSPC and
attempting a new write
- the write loop cleaned and simplified
- set the scatter/gather list element lengths to sum up to the
desired transfer length
- MTERASE to use the short erase SCSI command if argument is zero
- set the can-bsr flag for drives with SCSI level >= 3
- C99 structure initializations
- some janitorial changes
Alexander Viro [Mon, 22 Jul 2002 03:01:53 +0000 (20:01 -0700)]
[PATCH] Fix dcache deadlock introduced by previous fix
So the fix for our problems is:
a) in fs/namei.c replace d_unhash() with a safe version.
b) in fs/nfs/dir.c replace d_drop(dentry) in beginning of nfs_unlink()
with list_del_init(&dentry->d_hash);
Alexander Viro [Sun, 21 Jul 2002 13:26:17 +0000 (06:26 -0700)]
[PATCH] fix for nfs_unlink and vfs_unlink
Ugh. nfs_unlink() is actually racy as hell - look what happens if
we enter it with ->d_count == 1, see that nfs_sillyrename() doesn't
need to do anything and call nfs_safe_remove(). In the meanwhile
somebody does dcache lookup (without going into NFS code - plain
and simple cache hit) and increments ->d_count. nfs_safe_remove()
decides that something is very rotten and fails.
AFAICS we should take the test for ->d_count + d_drop if it's 1
under dcache_lock (and in one place). Comments?
Proposed fix follows:
* dget/dput killed in vfs_unlink() (safely)
* nfs_unlink() starts with check for ->d_count (under dcache_lock)
* if it's > 1 - sillyrename
* if it is 1 - immediately unhash, then drop dcache_lock.
after that we do as in old variant, except that
rehashing is done in nfs_unlink() and only if there
was an error - if there was none we simply leave
d_delete() to vfs_unlink().
Russell King [Sun, 21 Jul 2002 09:39:46 +0000 (02:39 -0700)]
[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.
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 ...
Alexander Viro [Sun, 21 Jul 2002 03:49:31 +0000 (20:49 -0700)]
[PATCH] jffs kdev_t cleanups
In the /proc/fs/jffs/* code we switch to passing number of mtd device
(as an integer) instead of messing with kdev_t (which would always be
mk_kdev(MTD_BLOCK_MAJOR, device_number) anyway).