Alexander Viro [Thu, 5 Feb 2004 01:11:09 +0000 (17:11 -0800)]
[PATCH] paride cleanup and fixes (12/25)
Equivalent transformation:
* calls of pi_disconnect() in phase functions expanded.
* since both do_pd_read_start() and do_pd_write_start()
are always called claimed (as the matter of fact,
all phase functions except do_pd_io() are), we can
replace call of pi_connect() with direct method call -
pi_claim() is no-op there.
Alexander Viro [Thu, 5 Feb 2004 01:09:53 +0000 (17:09 -0800)]
[PATCH] paride cleanup and fixes (11/25)
Equivalent transformation:
* new type - enum action. phase functions return it now.
run_fsm() looks at the result of phase() and does the
corresponding action - next_request(), pi_do_claimed()
or ps_set_intr().
Alexander Viro [Thu, 5 Feb 2004 01:08:47 +0000 (17:08 -0800)]
[PATCH] paride cleanup and fixes (10/25)
Equivalent transformation:
* ps_continuation renamed - it's "phase" now.
* run_fsm() does what ps_tq_int() used to do
* calls of pi_do_claimed(..., func) replaced with
phase = func; pi_do_claimed(..., run_fsm);
Now all phase functions are called from run_fsm() and we
can start pulling the common code into it.
Alexander Viro [Thu, 5 Feb 2004 01:07:39 +0000 (17:07 -0800)]
[PATCH] paride cleanup and fixes (9/25)
Equivalent transformation:
do_pd_reqeust1() calls lambda-expanded, function killed.
resulting call of ps_set_intr() in next_request() has been
moved past dropping pd_lock.
Alexander Viro [Thu, 5 Feb 2004 01:06:25 +0000 (17:06 -0800)]
[PATCH] paride cleanup and fixes (8/25)
Equivalent transformation:
instead of having do_pd_request1() calling do_pd_io() via
pi_do_claimed() and do_pd_io() calling do_pd_io_start() via
ps_set_intr(), do it the other way round.
Alexander Viro [Thu, 5 Feb 2004 01:05:25 +0000 (17:05 -0800)]
[PATCH] paride cleanup and fixes (7/25)
Equivalent transformation:
Handling of bogus requests taken into do_pd_io_start() - we
call next_request(0) as we would for any other error. We
need to call pi_unclaim() before that - on other paths that
would happen as a side effect of pi_disconnect().
Setting variables moved into do_pd_io_start() - they don't
need pd_lock being held, so we can shift that outside.
Alexander Viro [Thu, 5 Feb 2004 01:04:29 +0000 (17:04 -0800)]
[PATCH] paride cleanup and fixes (6/25)
Equivalent transformation:
* new function: do_pd_io_start(). Checks pd_cmd and calls
do_pd_read_start() or do_pd_write_start().
* do_pd_read() and do_pd_write() merged into do_pd_io(), which
schedules execution of do_pd_io_start().
Alexander Viro [Thu, 5 Feb 2004 01:01:27 +0000 (17:01 -0800)]
[PATCH] paride cleanup and fixes (2/25)
Preparation to crapectomy - expanded include of pseudo.h, split
the part of pd_do_request() into pd_do_request1(), leaving in pd_do_request()
only the check that FSM is not running and call of pd_do_request1().
Added locking analysis - it's in drivers/block/paride/Transition-notes
and it will be used on the next step. Even though the subsequent steps are
small, they rely on properties of the damn thing and proof of these properties
is hairy. Amazing perversions people manage to produce when writing a trivial
FSM - the code is very convoluted for no good reason...
Alexander Viro [Thu, 5 Feb 2004 01:00:52 +0000 (17:00 -0800)]
[PATCH] paride cleanup and fixes (1/25)
* new helper: pi_schedule_claimed() - pi_do_claimed() sans the call
of continuation if we don't have to wait; returns 1 if we don't
have to wait and 0 otherwise.
Alexander Viro [Thu, 5 Feb 2004 01:00:21 +0000 (17:00 -0800)]
[PATCH] parport fixes (6/6)
daisy.c used to access the topology list with no locking whatsoever.
Protected by spinlock, fixed numerous bugs in handling of the single-linked
list (I'm not kidding - just take a look at the old parport_daisy_fini()
and weep; it is supposed to go through a simple list and remove all entries
that satisfy a condition).
Alexander Viro [Thu, 5 Feb 2004 00:59:29 +0000 (16:59 -0800)]
[PATCH] parport fixes (4/6)
parport_gsc.c turned into proper parisc driver; instead of scanning
the list of ports upon rmmod in search of ones that had been created by us,
we do cleanup where it belongs - in parisc driver ->remove().
Alexander Viro [Thu, 5 Feb 2004 00:59:07 +0000 (16:59 -0800)]
[PATCH] parport fixes (3/6)
A bunch of parport_enumerate() users was duplicating parport_find_...()
without proper locking. Replaced with use of appropriate helpers, races closed.
Alexander Viro [Thu, 5 Feb 2004 00:58:49 +0000 (16:58 -0800)]
[PATCH] parport fixes (2/6)
We use a new mutex to protect all additions/removals of drivers and
ports. That cures a lot of insanity:
* driver removals can't hit us in the middle of attach_driver_chain().
Old code simply dies on that.
* port removals can't hit us in the middle of driver registration.
Again, old code dies on that.
* driver ->detach() is allowed to block now.
* we are guaranteed that by the time when parport_unregister_driver()
returns, all ->detach() calls are finished. Old code did _not_ guarantee
that (read: was inherently racy since rmmod of driver could race with port
removal and get driver->detach(port) called after the module was gone).
* we are guaranteed that driver->attach(port) won't be called
more than once. With the old code that was a matter of luck.
* removed piles and piles of braindead code.
Alexander Viro [Thu, 5 Feb 2004 00:58:34 +0000 (16:58 -0800)]
[PATCH] parport fixes (1/6)
Current tree has all allocated ports on portlist. However,
most of the portlist users assume that we only have announced ports
there and break badly if they happen to see the list after port driver
has created a port (parport_register_port()) but before it finishes
the setup (and calls parport_announce_port()).
The only place that wants to see all allocated port is
parport_register_port() itself and only to pick the first unused
port number.
We add a new list (all_ports) and put ports there when allocated;
that list is kept ordered by port->number. Ports are placed on portlist
only by parport_announce_port().
Gobs of shite in parport_register_port() removed, pile of races
closed...
I didn't include that with the bitkeeper based PowerMac updates so Jeff
can assume his role as maintainer/filter of network driver updates :)
Here's my latest update to this pmac-only driver, please apply if you
are ok with it. The driver now uses the macio infrastructure for
detection & power management notifications, getting into sysfs at
the same time.
Ben.
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2004/01/23 09:38:35+11:00 benh@kernel.crashing.org
# Update PowerMac "bmac" driver to the "macio" device so it fits in sysfs
# and gets proper power management ordering
#
# drivers/net/bmac.c
# 2004/01/23 09:38:22+11:00 benh@kernel.crashing.org +185 -203
# Update PowerMac "bmac" driver to the "macio" device so it fits in sysfs
# and gets proper power management ordering
#
I've been chasing a weird SELinux bug which shows up mostly when doing
installs of a dev-* rpm (ie. creating and overwriting lots of block
device inodes), but which I've also seen when doing mkinitrd.
It turned out not to be an SELinux problem at all, but a core VFS
S_ISBLK bug. It seems that SELinux simply widens the race window.
The code at fault is fs/fs-writeback.c:__mark_inode_dirty():
/*
* Only add valid (hashed) inodes to the superblock's
* dirty list. Add blockdev inodes as well.
*/
if (!S_ISBLK(inode->i_mode)) {
if (hlist_unhashed(&inode->i_hash))
goto out;
if (inode->i_state & (I_FREEING|I_CLEAR))
goto out;
}
The "I_FREEING|I_CLEAR" condition was added after the ISBLK/unhashed
tests were already in the source, but I can't see any reason why we'd
want the I_FREEING test not to apply to block devices. And indeed, this
results in all sorts of inode list corruptions. Simply moving the
I_FREEING|I_CLEAR test out of the protection of the S_ISBLK() condition
fixes things entirely.
The existing 2.6 kernel will reliably fail on me in about 2 seconds once
"rpm -Uvh --force dev*.rpm" starts its actual installation of the new
inodes. With the patch below I can't reproduce it at all.
Andrew Morton [Wed, 4 Feb 2004 02:54:15 +0000 (18:54 -0800)]
[PATCH] Fix ptrace in the vsyscall dso area
From: Roland McGrath <roland@redhat.com>
The #include is the part of this patch that matters, so the #ifdef below
works.
The rest of the patch removes gratuitous duplication due to some strange
aversion to concision in the presence of #ifdef, the kind that is all too
common, utterly pointless, and error prone.
Andrew Morton [Wed, 4 Feb 2004 02:53:48 +0000 (18:53 -0800)]
[PATCH] Altix update: irq fixes
From: Pat Gefre <pfg@sgi.com>
arch/ia64/sn/kernel/irq.c
Need to get the cpu from the passed in pcibr struct
Made the interrupt list static and gave it a better name - credit jes
Some lindent'isms
Took out some code that isn't used ..... yet
Andrew Morton [Wed, 4 Feb 2004 02:53:30 +0000 (18:53 -0800)]
[PATCH] Altix update: VGA, keyboard, other changes
From: Pat Gefre <pfg@sgi.com>
arch/ia64/sn/kernel/setup.c
If generic enabled legacy VGA or kbd - disable them
Slightly different check for work arounds and only do it once
If there is no klconfig info and we are in the simulator - ignore it
Update the pxm_to_nasid() routine. It failed for SP configurations and some
SMP configurations where M-bricks used pxm numbers lower that the first
c-brick.
If we don't find the cpu for pxm, search the memblks for it.
Andrew Morton [Wed, 4 Feb 2004 02:52:16 +0000 (18:52 -0800)]
[PATCH] Fix x86-64 boot problem
From: Andi Kleen <ak@muc.de>
Fix a bug introduced with the last merge that prevented booting with
CONFIG_DEBUG_INFO on on x86-64. It would corrupt registers in interrupts.
This has hit a few people, so I would consider it as a critical fix.
Andrew Morton [Wed, 4 Feb 2004 02:50:19 +0000 (18:50 -0800)]
[PATCH] CDROMREADAUDIO frames
From: Jens Axboe <axboe@suse.de>
2.6 imposes a 64 frame limit where 2.4 does not (just relies on kmalloc()
failing and limiting frames from that). That breaks at least on guys app.
With MSF adressing, it's much simpler to be able to ask for a full second
at the time, so I think we should just allow that. So bump the limit from
64 to CD_FRAMES (which is 75).
Andrew Morton [Wed, 4 Feb 2004 02:50:09 +0000 (18:50 -0800)]
[PATCH] PCI Scan all functions
From: Jake Moilanen <moilanen@austin.ibm.com>
On a ppc64 logically partitioned system, there can be a setup where function
0 of a PCI-PCI bridge is assigned to one partition and (for example) function
2 is assigned to a second partition. On the second partition, it would
appear that function 0 does not exist, but function 2 does. If all the
functions are not scanned, everything under function 2 would not be detected.
This patch allows devices that don't respond to function 0, but do respond to
other functions to be marked with a quirk and have all of their functions
scanned.
Andrew Morton [Wed, 4 Feb 2004 02:49:59 +0000 (18:49 -0800)]
[PATCH] Move cpu_vm_mask to be closer to mmu_context_t in struct mm
From: Jack Steiner <steiner@sgi.com>
The cpu_vm_mask use to be close to the mmu_context_t field in the mm
struct. Recently some large members were added between "cpu_vm_mask" and
"context". I suspect that was an oversight.
Here is a patch that puts the fields close together. This makes it likely
that both fields are in the same cache line. Since both fields are likely
to be updated at the same time, this may improve performance.
Andrew Morton [Wed, 4 Feb 2004 02:49:23 +0000 (18:49 -0800)]
[PATCH] shrink_list(): check PageSwapCache() after add_to_swap()
From: Nikita Danilov <Nikita@Namesys.COM>
shrink_list() checks PageSwapCache() before calling add_to_swap(), this
means that anonymous page that is going to be added to the swap right
now these checks return false and:
(*) it will be unaccounted for in nr_mapped, and
(*) it won't be written to the swap if gfp_flags include __GFP_IO but
not __GFP_FS.
(Both will happen only on the next round of scanning.)
Patch below just moves may_enter_fs initialization down. I am not sure
about (*nr_mapped) increase though.
Andrew Morton [Wed, 4 Feb 2004 02:49:14 +0000 (18:49 -0800)]
[PATCH] Use address hint in mmap for search
From: Andi Kleen <ak@suse.de>
When the user gave an address hint in mmap use it as starting point for the
search for !MAP_FIXED.
Currently it is only checked directly and when already used the free area
cache is used as starting point. With this change you can use mmap(4096,
....) to e.g. get the lowest free address in your address space, which is
sometimes useful. For example on x86-64 glibc wants to preferably allocate
thread local data in the first 4GB but use higher addresses when this is
not possible.
This can be a bit more costly in CPU time because it may have to skip over
more VMAs, but gives better semantics for most cases. Most programs pass
NULL as hint anyways so it won't make any difference for them.
I did it for the generic mmap and for x86-64 for now. Also minor white
space fixes for x86-64.
Andrew Morton [Wed, 4 Feb 2004 02:49:05 +0000 (18:49 -0800)]
[PATCH] rate limit nr_free_pages
From: Jes Sorensen <jes@trained-monkey.org>
nr_free_pages() is expensive, especially on large SMP machines. The patch
changes the memory overcommit code so that it only calls nr_free_pages() is
we're about to fail the allocation attempt.
Andrew Morton [Wed, 4 Feb 2004 02:48:48 +0000 (18:48 -0800)]
[PATCH] proc_check_root() locking fix
From: Maneesh Soni <maneesh@in.ibm.com>
The patch fixes locking in proc_check_root(). It brings is_subdir() call
under vfsmount_lock. Holding vfsmount_lock will ensure mnt_mountpoint
dentry is intact and the dentry does not go away while it is being checked
in is_subdir().
Andrew Morton [Wed, 4 Feb 2004 02:48:39 +0000 (18:48 -0800)]
[PATCH] is_subdir locking fix
From: Maneesh Soni <maneesh@in.ibm.com>
o The following patch fixes is_subdir() races with d_move. Due to concurrent
d_move, in is_subdir() we can end up accessing freed d_parent pointer in
case of pre-emptible kernel. To avoid this we can use rcu_read_lock() and
rcu_read_unlock().
o This also fixes the seqlock uses in is_subdir() as we need to restart the
the inner loop with the origianl new_dentry passed to the routine in case
of any rename occured while we are traversing d_parent links.
Andrew Morton [Wed, 4 Feb 2004 02:48:21 +0000 (18:48 -0800)]
[PATCH] u_int32_t causes cross-compile problems
From: Pratik Solanki <pratik.solanki@timesys.com>
I came across this C standards issue while cross-compiling the Linux kernel
with gcc on Solaris. The file gen_crc32table.c uses the non-standard type
u_int32_t. It's possible that the host machine's sys/types.h does not
define u_int32_t. The attached patch replaces u_int32_t with the POSIX
standard uint32_t and includes POSIX inttypes.h instead of sys/types.h.
Andrew Morton [Wed, 4 Feb 2004 02:48:12 +0000 (18:48 -0800)]
[PATCH] fix menuconfig choice item help display
From: Bjorn Helgaas <bjorn.helgaas@hp.com>
Anders Gustafsson <andersg@0x63.nu>
Roman Zippel <zippel@linux-m68k.org>
This patch fixes menuconfig so it can display help text for individual
choice group config entries.
Previously it would only display the help text attached to the "choice"
item. There was no way to display the help attached to individual config
entries inside the choice group. Typically, the "choice" item has no help
text, and all the useful help is attached to the individual entries, so
this was a bit of a problem.
Andrew Morton [Wed, 4 Feb 2004 02:48:03 +0000 (18:48 -0800)]
[PATCH] /proc/stat:btime fix
From: George Anzinger <george@mvista.com>,
Petri Kaukasoina <kaukasoi@elektroni.ee.tut.fi>
btime in /proc/stat does not stay constant but decreases at a rate of 15
secs/day, because we're assuming that HZ is exactly 100. Use the correct
adjustments to fix that up.
Andrew Morton [Wed, 4 Feb 2004 02:47:54 +0000 (18:47 -0800)]
[PATCH] Fine tune the time conversion to eliminate conversion errors.
From: George Anzinger <george@mvista.com>
The time conversion code is erroring on the side of a bit too small. The
attached patch forces any error to be on the high side. The current code will
convert 1 nanosecond to zero jiffies (standard says that should be 1). It also
is around 1 nanosecond late on each roll to the next jiffie.
I have done some error checks with this patch applied and get the following
errors in PPB ( Parts Per Billion):
Andrew Morton [Wed, 4 Feb 2004 02:47:35 +0000 (18:47 -0800)]
[PATCH] try reiserfs before other filesystems
reiserfs places its superblock in weird places which can result in false
positives and various printks when other filesystems probe a resierfs
filesystem.
Andrew Morton [Wed, 4 Feb 2004 02:46:42 +0000 (18:46 -0800)]
[PATCH] oprofile, typo in alpha driver
From: Philippe Elie <phil.el@wanadoo.fr>
Unless I miss something this look like a typo, one user reported to get
error from the daemon: 'Unknown event for counter 1' (alpha ev6) and the
behavior was better but not completly sane after trying this patch: he get
spurious event for counter 1 when enabling only counter 0 but rarely now.
No alpha box to test this.
Andrew Morton [Wed, 4 Feb 2004 02:46:33 +0000 (18:46 -0800)]
[PATCH] oprofile per-cpu buffer overrun
From: Philippe Elie <phil.el@wanadoo.fr>
In a ring buffer controlled by a read and write positions we can't use
buffer_size but only buffer_size - 1 entry, the last free entry act as a
guard to avoid write pos overrun. This bug was hidden because the writer,
oprofile_add_sample(), request one more entry than really needed.
Andrew Morton [Wed, 4 Feb 2004 02:46:26 +0000 (18:46 -0800)]
[PATCH] console cleanup
From: Sam Ravnborg <sam@ravnborg.org>,
Ben Collins <bcollins@debian.org>
Fix up the console makefiles and logo generation.
1) To make output look like the rest of the kernel build.
2) To avoid make utilising chained rules, and therefore issuing a 'rm
drivers/video/logo/linux_logo.c ...' during the build.
I have previously submitted a few patches for logo/Makefile, but this is the
first one that actually address the problems I have seen in a proper way.
And no, I did not like such a simple thing to look that complicated, the
other option was to list too many files or to use other types of kbuild/make
magic.
Andrew Morton [Wed, 4 Feb 2004 02:45:42 +0000 (18:45 -0800)]
[PATCH] Zero last byte of mount option page.
From: James Morris <jmorris@redhat.com>
Here's a patch which zeroes the last byte of the mount option data copied
from userspace during mount(2).
For filesystems which parse mount options as strings (the majority), lack
of a zero terminator could cause the page to be overrun. The source code
comments specify that the maximum size of the mount data is PAGE_SIZE-1, so
this patch will not affect any valid binary-formatted mount data.
Andrew Morton [Wed, 4 Feb 2004 02:45:33 +0000 (18:45 -0800)]
[PATCH] posix_timers fixes
From: George Anzinger <george@mvista.com>
- Removes C++ comment in favor of C style.
- Removes the special treatment for MIPS SIGEV values. We only require
(and error if this fails) that the SIGEV_THREAD_ID value not share bits
with the other SIGEV values. Note that mips has yet to define this value
so when they do...
- Corrects the check for the signal range to be from 1 to SIGRTMAX
inclusive.
- Adds a check to verify that kmem_cache_alloc() actually returned a timer,
error if not.
- Fixes a bug in timer_gettime() where the incorrect value was returned if
a signal was pending on the timer OR the timer was a SIGEV_NONE timer.
Andrew Morton [Wed, 4 Feb 2004 02:45:24 +0000 (18:45 -0800)]
[PATCH] Better "Losing Ticks" Error Message
From: timothy parkinson <t@timothyparkinson.com>
Seems like a lot of people see the below error message, but aren't quite
sure why it happens or how to fix it. I sure didn't. Here's my attempt at
remedying that.
Andrew Morton [Wed, 4 Feb 2004 02:45:06 +0000 (18:45 -0800)]
[PATCH] Remove memblks from the kernel
From: "Martin J. Bligh" <mbligh@aracnet.com>
This patch removes memblks from the kernel ... we don't use them, and the
NUMA API that was planning to use them when they were originally designed
isn't going to use them anymore. They're just unnecessary added complexity
now ... time for them to go.
There's a slight complication in that ia64 uses something with a similar
name for part of its memory layout, but Jes Sorensen kindly untangled them
from each other for us. The patch with his modifications is below. Jes
tested it on ia64, and I testbuilt it with every config in my arsenal.