Andrew Morton [Wed, 18 Feb 2004 12:51:58 +0000 (04:51 -0800)]
[PATCH] md: Allow partitioning of MD devices.
From: NeilBrown <neilb@cse.unsw.edu.au>
With this patch, md used two major numbers for arrays.
One Major is number 9 with name 'md' have unpartitioned md arrays, one per
minor number.
The other Major is allocated dynamically with name 'mdp' and had on array for
every 64 minors, allowing for upto 63 partitions.
The arrays under one major are completely separate from the arrays under the
other.
The preferred name for devices with the new major are of the form:
/dev/md/d1p3 # partion 3 of device 1 - minor 67
When a paritioned md device is assembled, the partitions are not recognised
until after the whole-array device is opened again. A future version of
mdadm will perform this open so that the need will be transparent.
Andrew Morton [Wed, 18 Feb 2004 12:51:49 +0000 (04:51 -0800)]
[PATCH] md: Dynamically limit size of bio requests used for raid1 resync
From: NeilBrown <neilb@cse.unsw.edu.au>
Currently raid1 uses PAGE_SIZE read/write requests for resync, as it doesn't
know how to honour per-device restrictions. This patch uses to bio_add_page
to honour those restrictions and ups the limit on request size to 64K. This
has a measurable impact on rebuild speed (25M/s -> 60M/s)
Andrew Morton [Wed, 18 Feb 2004 12:51:40 +0000 (04:51 -0800)]
[PATCH] md: Avoid unnecessary bio allocation during raid1 resync
From: NeilBrown <neilb@cse.unsw.edu.au>
For each resync request, we allocate a "r1_bio" which has a bio "master_bio"
attached that goes largely unused. We also allocate a read_bio which is
used. This patch removes the read_bio and just uses the master_bio instead.
This fixes a bug wherein bi_bdev of the master_bio wasn't being set, but was
being used.
We also introduce a new "sectors" field into the r1_bio as we can no-longer
rely in master_bio->bi_sectors.
Andrew Morton [Wed, 18 Feb 2004 12:51:31 +0000 (04:51 -0800)]
[PATCH] md: Remove some un-needed fields from r1bio_s
From: NeilBrown <neilb@cse.unsw.edu.au>
next_r1 is never used, so it can just go.
read_bio isn't needed as we can easily use one of the pointers in the
write_bios array - write_bios[->read_disk]. So rename "write_bios" to "bios"
and store the pointer to the read bio in there.
Andrew Morton [Wed, 18 Feb 2004 12:51:22 +0000 (04:51 -0800)]
[PATCH] md: Discard the cmd field from r1_bio structure
From: NeilBrown <neilb@cse.unsw.edu.au>
The only time it is really needed is to differentiate a retry-on-fail from a
write-after-read-for-resync request to raid1d. So we use a bit in 'state'
for that.
Andrew Morton [Wed, 18 Feb 2004 12:51:13 +0000 (04:51 -0800)]
[PATCH] md: Split read and write end_request handlers
From: NeilBrown <neilb@cse.unsw.edu.au>
Instead of having a single end_request handler that must determine whether it
was a read or a write request, we have two separate handlers, which makes
each of them easier to follow.
Andrew Morton [Wed, 18 Feb 2004 12:50:37 +0000 (04:50 -0800)]
[PATCH] kNFSd: ip_map_init does a kmalloc which isn't checked...
From: NeilBrown <neilb@cse.unsw.edu.au>
There is no way to return an error from a cache init routine, so instead we
make sure to pre-allocate the memory needed, and free it after the lookup
if the lookup failed.
Andrew Morton [Wed, 18 Feb 2004 12:50:28 +0000 (04:50 -0800)]
[PATCH] kNFSd: Allow sunrpc/svc cache init function to modify the "key"
From: NeilBrown <neilb@cse.unsw.edu.au>
When adding a item to a sunrpc/svc cache that contains kmalloced data it is
usefully to move the malloced data out of the key object into the new cache
object rather than copying (as then we would need to cope with kmalloc
failure and such). This means modifying the original.
If the kmalloced data forms part of the key, then we must not move the data
out until after the key isn't needed any more. So this patch moves the
call to "INIT" on a new item (which fills in the key) to *after* the item
has been found (or not), and also makes sure we only call the HASH function
once.
Thanks to "J. Bruce Fields" <bfields@fieldses.org>
also
1/ remove unnecessary assignment
2/ fix comments that lag behind implementation.
Andrew Morton [Wed, 18 Feb 2004 12:50:10 +0000 (04:50 -0800)]
[PATCH] #if versus #ifdef cleanup
From: Valdis.Kletnieks@vt.edu
15 changes of #if to #ifdef and 2 places CONFIG_FOO should be
defined(CONFIG_FOO). This gets rid of spurious warnings if you build with
"-Wundef" so you get a warning if you have a preprocessor command like:
#if CONFIG_ETRAX_DS1302_RSTBIT == 27
and you'll be told if it's substituting a zero rather than silent
weirdness and unexpected code generation.
Andrew Morton [Wed, 18 Feb 2004 12:49:52 +0000 (04:49 -0800)]
[PATCH] Enable coredumps > 2GB
From: Andi Kleen <ak@muc.de>
Some x86-64 users were complaining that coredumps >2GB don't work.
This will enable large coredump for everybody. Apparently the 32bit
gdb/binutils cannot handle them, but I hear the binutils people are working
on fixing that. I doubt it will harm people - unreadable coredumps are not
worse than no coredump and it won't make any difference in space usage if
you get a 1.99GB or a 2.5GB coredump. So just enable it unconditionally.
If it should be really a problem for 32bit the rlimit defaults in
resource.h could be changed.
For file systems that don't support O_LARGEFILE you should just get an
truncated coredumps for big address spaces.
Andrew Morton [Wed, 18 Feb 2004 12:49:43 +0000 (04:49 -0800)]
[PATCH] devfs: race fixes and cleanup
From: Andrey Borzenkov <arvidjaar@mail.ru>
- use struct nameidata in devfs_d_revalidate_wait to detect when it is
called without i_sem hold; take i_sem on parent in this case. This
prevents both deadlock with devfs_lookup by allowing it to drop i_sem
consistently and oops in d_instantiate by ensuring that it always runs
protected
- remove dead code that deals with major number allocation. The only
remaining user was devfs itself and patch changes it to
- use register_chardev to get device number for internal /dev/.devfsd and
/dev/.statd.
- remove dead auto allocation flag as well
- remove code that does module get on dev open - it is handled by fops_get.
Use init_special_inode consistently
- get rid of struct cdev_type and bdev_type - both have just single dev_t
now
Andrew Morton [Wed, 18 Feb 2004 12:49:34 +0000 (04:49 -0800)]
[PATCH] snprintf fixes
From: Juergen Quade <quade@hsnr.de>
Lots of places in the kernel are using [v]snprintf wrongly: they assume it
returns the number of characters copied. It doesn't. It returns the
number of characters which _would_ have been copied had the buffer not been
filled up.
So create new functions vscnprintf() and scnprintf() which have the
expected (sane) semaptics, and migrate callers over to using them.
Andrew Morton [Wed, 18 Feb 2004 12:49:05 +0000 (04:49 -0800)]
[PATCH] NGROUPS 2.6.2rc2 + fixups
From: Tim Hockin <thockin@sun.com>,
Neil Brown <neilb@cse.unsw.edu.au>,
me
New groups infrastructure. task->groups and task->ngroups are replaced by
task->group_info. Group)info is a refcounted, dynamic struct with an array
of pages. This allows for large numbers of groups. The current limit of
32 groups has been raised to 64k groups. It can be raised more by changing
the NGROUPS_MAX constant in limits.h
Someone complained about the number of references to /etc/modules.conf in
the documentation. While fixing them up (and examples where changed),
removed those which are redundant due to MODULE_ALIAS.
The issue of exceedingly large hash tables has been discussed on the
mailing list a while back, but seems to slip through the cracks.
What we found is it's not a problem for x86 (and most other
architectures) because __get_free_pages won't be able to get anything
beyond order MAX_ORDER-1 (10) which means at most those hash tables are
4MB each (assume 4K page size). However, on ia64, in order to support
larger hugeTLB page size, the MAX_ORDER is bumped up to 18, which now
means a 2GB upper limits enforced by the page allocator (assume 16K page
size). PPC64 is another example that bumps up MAX_ORDER.
Last time I checked, the tcp ehash table is taking a whooping (insane!)
2GB on one of our large machine. dentry and inode hash tables also take
considerable amount of memory.
Setting the size of these tables is difficult: they need to be constrained on
many-zone ia64 machines, but this could cause significant performance
problems when there are (for example) 100 million dentries in cache.
Large-memory machines which do not slice that memory up into huge numbers of
zones do not need to run the risk of this slowdown.
So the sizing algorithms remain essentially unchanged, and boot-time options
are provided which permit the tables to be scaled down.
Andrew Morton [Wed, 18 Feb 2004 12:47:47 +0000 (04:47 -0800)]
[PATCH] Use CPU_UP_PREPARE properly
From: Rusty Russell <rusty@rustcorp.com.au>
The cpu hotplug code actually provides two notifiers: CPU_UP_PREPARE
which preceeds the online and can fail, and CPU_ONLINE which can't.
Current usage is only done at boot, so this distinction doesn't
matter, but it's a bad example to set. This also means that the
migration threads do not have to be higher priority than the
others, since they are ready to go before any CPU_ONLINE callbacks
are done.
This patch is experimental but fairly straight foward: I haven't been
able to test it since extracting it from the hotplug cpu code, so it's
possible I screwed something up.
Andrew Morton [Wed, 18 Feb 2004 12:47:38 +0000 (04:47 -0800)]
[PATCH] Remove More Unneccessary CPU Notifiers
From: Rusty Russell <rusty@rustcorp.com.au>
Three more removed CPU notifiers extracted from the hotplug CPU patch.
kernel/softirq.c: the tasklet cpu prepration callback is useless:
the vectors are already initialized to NULL. Even with the hotplug
CPU patches, they're of little or no use.
fs/buffer.c: once again, they are already initialized to zero.
mm/page_alloc.c: once again, already initialized to zero.
Andrew Morton [Wed, 18 Feb 2004 12:47:29 +0000 (04:47 -0800)]
[PATCH] Minor workqueue.c cleanup
From: Rusty Russell <rusty@rustcorp.com.au>
Move duplicated code to __queue_work(), and don't set the CPU for
queue_delayed_work() until the timer goes off. The second one only has an
effect on CONFIG_HOTPLUG_CPU where the CPU goes down and the timer goes off
on a different CPU than it was scheduled on.
Andrew Morton [Wed, 18 Feb 2004 12:47:20 +0000 (04:47 -0800)]
[PATCH] Remove kstat cpu notifiers
From: Rusty Russell <rusty@rustcorp.com.au>
Some well-meaning person put a notifier in for CPUs to update the kstat
structures in sched.c. However, it does nothing, and even with the full
hotplug CPU patch, it still does nothing.
Simple counters very rarely need anything done when CPUs come up or go
down. If you have per-cpu caches, or per-cpu threads, you need to do
something. But very rarely for stats.
Andrew Morton [Wed, 18 Feb 2004 12:47:11 +0000 (04:47 -0800)]
[PATCH] kthread primitive
From: Rusty Russell <rusty@rustcorp.com.au>
These two patches provide the framework for stopping kernel threads to
allow hotplug CPU. This one just adds kthread.c and kthread.h, next
one uses it.
Most importantly, adds a Monty Python quote to the kernel.
Details:
The hotplug CPU code introduces two major problems:
1) Threads which previously never stopped (migration thread,
ksoftirqd, keventd) have to be stopped cleanly as CPUs go offline.
2) Threads which previously never had to be created now have
to be created when a CPU goes online.
Unfortunately, stopping a thread is fairly baroque, involving memory
barriers, a completion and spinning until the task is actually dead
(for example, complete_and_exit() must be used if inside a module).
There are also three problems in starting a thread:
1) Doing it from a random process context risks environment contamination:
better to do it from keventd to guarantee a clean environment, a-la
call_usermodehelper.
2) Getting the task struct without races is a hard: see kernel/sched.c
migration_call(), kernel/workqueue.c create_workqueue_thread().
3) There are races in starting a thread for a CPU which is not yet
online: migration thread does a complex dance at the moment for
a similar reason (there may be no migration thread to migrate us).
Place all this logic in some primitives to make life easier:
kthread_create() and kthread_stop(). These primitives require no
extra data-structures in the caller: they operate on normal "struct
task_struct"s.
Other changes:
- Expose keventd_up(), as keventd and migration threads will use kthread to
launch, and kthread normally uses workqueues and must recognize this case.
- Kthreads created at boot before "keventd" are spawned directly. However,
this means that they don't have all signals blocked, and hence can be
killed. The simplest solution is to always explicitly block all signals in
the kthread.
- Change over the migration threads, the workqueue threads and the
ksoftirqd threads to use kthread.
- module.c currently spawns threads directly to stop the machine, so a
module can be atomically tested for removal.
- Unfortunately, this means that the current task is manipulated (which
races with set_cpus_allowed, for example), and it can't set its priority
artificially high. Using a kernel thread can solve this cleanly, and with
kthread_run, it's simple.
- kthreads use keventd, so they inherit its cpus_allowed mask. Unset it.
All current users set it explicity anyway, but it's nice to fix.
- call_usermode_helper uses keventd, so the process created inherits its
cpus_allowed mask. Unset it.
- Prevent errors in boot when cpus_possible() contains a cpu which is not
online (ie. a cpu didn't come up). This doesn't happen on x86, since a
boot failure makes that CPU no longer possible (hacky, but it works).
- When the cpu fails to come up, some callbacks do kthread_stop(), which
doesn't work without keventd (which hasn't started yet). Call it directly,
and take care that it restores signal state (note: do_sigaction does a
flush on blocked signals, so we don't need to repeat it).
Andrew Morton [Wed, 18 Feb 2004 12:47:01 +0000 (04:47 -0800)]
[PATCH] ACPI PM timer
From: Dominik Brodowski <linux@dominikbrodowski.de>,
John Stultz <johnstul@us.ibm.com>,
Dmitry Torokhov
Add the ACPI Powermanagement Timer as x86 kernel timing source. Unlike the
Time Stamp Counter, it is a reliable timing source which does not get
affected by aggressive powermanagement features like CPU frequency scaling.
Some ideas and some code are based on Arjan van de Ven's implementation for
2.4, and on R. Byron Moore's drivers/acpi/hardware/hwtimer.c.
We also replace the loop based delay_pmtmr with a TSC based delay_pmtmr,
which resolves a number of issues caused by the loop based delay. Unsynced
TSCs as well frequency changing TSCs will effect the length of __delay(), but
it seems this method works best.
Andrew Morton [Wed, 18 Feb 2004 12:46:43 +0000 (04:46 -0800)]
[PATCH] loop.c doesn't fail init gracefully
From: BlaisorBlade <blaisorblade_spam@yahoo.it>
loop_init doesn't fail gracefully for two reasons:
1) If initialization of loop driver fails, we have an call to
devfs_add("loop") without any devfs_remove; I add that.
2) On lwn.net 2.6 kernel docs, Jonathan Corbet says: "If you are calling
add_disk() in your driver initialization routine, you should not fail
the initialization process after the first call."
So I make loop.c conform to this request by moving add_disk after all
memory allocations.
Andrew Morton [Wed, 18 Feb 2004 12:46:25 +0000 (04:46 -0800)]
[PATCH] remove useless highmem bounce from loop/cryptoloop
From: Ben Slusky <sluskyb@paranoiacs.org>
The attached patch changes the loop device transfer functions (including
cryptoloop transfers) to accept page/offset pairs instead of virtual
addresses, and removes the redundant kmaps in do_lo_send, do_lo_receive,
and loop_transfer_bio. Per Andrew Morton's request a while back.
Andrew Morton [Wed, 18 Feb 2004 12:46:08 +0000 (04:46 -0800)]
[PATCH] ppc64: iseries IRQ fix
From: Stephen Rothwell <sfr@canb.auug.org.au>
This patch lets 2.6.3-rc4 build and boot on an PPC64 iSeries box (at least
for my configuration). The veth.o bit in the networking Makefile got there
by accident and should be removed anyway ...
There is more to make it work properly (note the "Temporary hack"), but
this gets us closer.
Andrew Morton [Wed, 18 Feb 2004 12:45:41 +0000 (04:45 -0800)]
[PATCH] ppc64: Fix prom.c warnings
arch/ppc64/kernel/prom.c:200: warning: missing braces around initializer
arch/ppc64/kernel/prom.c:200: warning: (near initialization for `hmt_thread_data[0]')
arch/ppc64/kernel/prom.c: In function `prom_hold_cpus':
arch/ppc64/kernel/prom.c:1090: warning: implicit declaration of function `_get_PIR'
Andrew Morton [Wed, 18 Feb 2004 12:44:55 +0000 (04:44 -0800)]
[PATCH] Fix for PPP activ/passiv filter
From: Karsten Keil <kkeil@suse.de>
I found a bug in the PPPIOCSPASS PPPIOCSACTIVE IOCTL implementation in
kernel 2.5/2.6.
The current pppd code use a empty filter (uprog.len=0) to detach the filter
in the kernel, but this code was removed in 2.5.71 while fixing a compiler
warning.
Here the new patch, also with better limit checking.
The second patch check for flen == 0 in the filter check too, since later
in this code a filter[flen - 1] access is done, which is not so funny with
flen 0. Maybe it's not really needed anymore, since with the first patch
it would not longer called with flen=0.
paulus says:
It looks correct. Previously we had (and in 2.4 we still have)
if (uprog.len > 0 && uprog.len < 65536) {
...
which gave warnings since uprog.len is unsigned short. So someone
decided that both parts of the condition were redundant.
Andrew Morton [Wed, 18 Feb 2004 12:44:45 +0000 (04:44 -0800)]
[PATCH] i4l: hisax deadlock fix
From: Karsten Keil <kkeil@suse.de>
This patch fix a deadlock in HiSax (reported from David Woodhouse
<dwmw2@infradead.org>). upper layer was called back while holding the card
lock fix is to move the wakeup call into BH handler to avoid direct
callbacks.
Dave Jones [Thu, 19 Feb 2004 02:48:43 +0000 (02:48 +0000)]
[CPUFREQ] Add extra __init markers to longrun driver.
Caught by Randy Dunlap.
longrun_cpu_init() only gets called during startup, and calls
other __init routines.
Dave Jones [Thu, 19 Feb 2004 02:46:52 +0000 (02:46 +0000)]
[CPUFREQ] Add extra __init markers to longhaul driver.
Caught by Randy Dunlap.
longhaul_cpu_init only gets called during startup, and calls
other __init routines.
Assume tp->dirty_tx = NUM_TX_DESC/2, tp->cur_tx = NUM_TX_DESC - 1,
watch "entry" go beyond NUM_TX_DESC. Actually this is where the same
bug in r8169 driver comes from.
Randy Dunlap [Wed, 18 Feb 2004 14:29:38 +0000 (09:29 -0500)]
[PATCH] tr/3c359: handle kmalloc failures during init
From: Pablo Menichini <pablo@menichini.com.ar>
and maximilian attems <janitor@sternwelten.at>
while looking at kj mails from 200212 and 200301
this patch slept through
originally from: Pablo Menichini <pablo@menichini.com.ar>
rediffed and compile tested
patch applies on plain 2.6.0
Don Fry [Wed, 18 Feb 2004 14:29:31 +0000 (09:29 -0500)]
[PATCH] 2.6.3 pcnet32.c transmit hang fix
The transmit routine will stop interrupting and hang, causing the
tx_timeout routine to attempt to restart the device when the 32-bit
cur_tx counter wraps below dirty_tx. If the device had called
netif_stop_queue it will never call netif_wake_queue in the interrupt
routine (at least on an IA32 system) due to 32-bit wrap around arithmetic.
On my IA32 system 'dirty_tx > lp->cur_tx - TX_RING_SIZE + 2' would
always evaluate to false when dirty and cur_tx were less than 15,
preventing netif_wake_queue to be called.
By starting dirty_tx and cur_tx at 0xfffffff0 (to reduce test time) I
found that once cur_tx wrapped to zero, that transmitted buffers would
never be unmapped or freed because 'while (dirty_tx < lp->cur_tx) {'
was not true. cur_tx would keep incrementing (in start_xmit) but dirty_tx
would not (in pcnet32_interrupt), thus leaking skb's and pci map entries.
On PPC machines, the system would quickly run out of pci maps.
Shmulik Hen [Wed, 18 Feb 2004 13:59:35 +0000 (08:59 -0500)]
[PATCH] Add VLAN support in ALB mode
Add capability to tag self generated ARP packets that are required
for receive load balancing in bonding. VLAN Id's are saved and used
each time a new IP connection is established since 8021q currently
supports IP binding.
Shmulik Hen [Wed, 18 Feb 2004 13:59:27 +0000 (08:59 -0500)]
[PATCH] Add VLAN support in TLB mode
Add capability to tag self generated learning packets that are
required to speed up port selection in the switch after a fail
over in bonding since some switches will only update their MAC
tables from tagged packets when VLAN support is turned on. All
VLAN Id's that have been configured on top of the bond interface
will be used in cyclic order.
Shmulik Hen [Wed, 18 Feb 2004 13:59:20 +0000 (08:59 -0500)]
[PATCH] Add support for HW accel. slaves
Now that David Miller accepted the first half of this set into 2.6,
I'm resending the last half to you for inclusion in netdev-2.6.
Tested against latest netdev-2.6. Summary:
Change the bond interface to publish full VLAN hardware acceleration
offloading capabilities, and add capability in all xmit functions to
take special care for VLAN HW accel. tagged skb's that are going out
through a slave that is not offloading capable.
Add a mechanism to collect and save the VLAN Id's that have been
added on top of a bond interface, and propagate the register/add/kill
operations to the slaves.
Add blocking mechanism to prevent adding VLAN interfaces on top of a
bond that contains VLAN challenged slaves and to prevent adding VLAN
challenged slaves to a bond that already has VLAN interfaces on top
of it.
Add a section about VLAN to Documentation/networking/bonding.txt and
also correct some minor spelling/grammer errors.
Don Fry [Wed, 18 Feb 2004 13:48:55 +0000 (08:48 -0500)]
[PATCH] 2.6.3 pcnet32.c bus master arbitration failure fix
Here is the first of several individual patches to 2.6.3 for the pcnet32
driver.
The driver did not properly serialize accesses to chip registers, resulting
in reading/writing the wrong register. This patch eliminates this problem
and gets rid of the cause of the symptom of 'bus master arbitration failure'.
It was easier to use generic_mii_ioctl than modify the current pcnet32_ioctl
routine with the necessary locks. This has been re-tested on an IA32 system.
Andi Kleen [Wed, 18 Feb 2004 03:44:21 +0000 (19:44 -0800)]
[PATCH] Intel x86-64 support merge
This has all the x86-64 specific changes for Intel Prescott/Nocona
support.
It requires a few minor changes outside arch/x86_64, which I am sending
separately.
This patch is needed to boot an 64bit kernel on a 64-bit capable
Prescott machine.
The ugliest part is probably the swiotlb code. In fact the code for
that is not even included, but just reused from IA64. swiotlb
implements the PCI DMA API using bounce buffering. I don't like this at
all, but there was no other way to support non DAC capable hardware
(like IDE or USB) on machines with >3GB. Please redirect all flames for
that to the Intel chipset designers.
ChangeLog:
- Add Kconfig options for PSC
- Add support to reuse microcode driver from i386 (Suresh B Siddha)
- Try to optimize for the selected CPU
- Fix early CPUID check for Intel CPUs (Suresh B Siddha)
- Fix GDT to use the configured cache line size for padding
- Support monitor/mwait idle loop
- Support HyperThreading
- Support Intel CPUID flags
- Remove all 3dnow prefetches
- Add alternative() for the prefetchw prefetch inline.
- Include P4 driver in oprofile
- Support Intel NOPs in alternative
Andrew Morton [Tue, 17 Feb 2004 11:32:13 +0000 (03:32 -0800)]
[PATCH] Tuner bugfix
From: Neal Stephenson <neal@bakerst.org>
In 2.6.2, I noticed that my modprobe.conf line for tuner "options tuner
type=2" no longer worked. It even failed with insmod "insmod tuner.ko
type=2". dmesg reported
vmunix: tuner: chip found @ 0xc0
vmunix: tuner: type set to 19 (Temic PAL* auto (4006 FN5))
vmunix: tuner: type forced to 19 (Temic PAL* auto (4006 FN5)) [insmod]
I noticed that the a line had been removed from 2.6.1 and when it is added
everything works again.