Russell King [Sun, 14 Mar 2004 20:37:39 +0000 (20:37 +0000)]
[PCMCIA] socket user operations should take pcmcia_socket
Patch from Dominik Brodowski, updated by Russell King.
The pcmcia_{suspend,resume,eject,insert}_card calls are only issued
by the userspace cardctl tool via ds.c. There's no need to verify the
caller (ds) has a valid "handle", as long as it knows the proper
struct pcmcia_socket.
Russell King [Sun, 14 Mar 2004 20:20:33 +0000 (20:20 +0000)]
[PCMCIA] Rename driver services constants.
Driver services constants clash with similar constants defined
by Card services. Prefix them all with DS_.
This patch started out as Dominik Brodowski's 2.6.0-test9
ds_includes_cs_internal patch, which only changed one constant
and attempted to fix PCMCIA debugging.
Russell King [Sun, 14 Mar 2004 20:12:21 +0000 (20:12 +0000)]
[PCMCIA] Add, fix, update PCMCIA debugging.
The PCMCIA core debugging assumes that "pc_debug" is a global. If
pc_debug were to be a global, it would pollute the kernel's global
name space, potentially clashing with PCMCIA drivers and even ds.c.
We also get rid of PCMCIA using the "DEBUG" macro, which is the
standard macro to enable debugging in the kernel. Instead, we
introduce cs_dbg() for core PCMCIA debugging, ds_dbg() for driver
services debugging, and similar macros in the socket drivers.
Andrew Morton [Sat, 13 Mar 2004 11:26:39 +0000 (03:26 -0800)]
[PATCH] Work around an AMD768MPX erratum
From: Andi Kleen <ak@suse.de>
This patch has been in the SuSE 2.4 kernel forever, but for some reason
never made it mainline.
It works around the infamous "only works stable when a mouse is plugged in"
problem some AMD 768MPX Dual Athlon chipsets have. The problem happens
because the chipset can hang when PCI prefetch strides from a RAM page into
the VGA text buffer. When a PS2 mouse is plugged in the BIOS reserves a
page before the VGA text buffer, which stops the prefetch early.
This patch always reserves this page when the chipset could be AMD768MPX.
This can be only done early in bootmem setup. Because it's difficult to
scan the PCI bus that early it just always reserves this page when the CPU
is an Athlon. Normally it should not make a difference because the BIOS
will have reserved that page anyways when a PS/2 mouse is plugged in.
Andrew Morton [Sat, 13 Mar 2004 11:26:09 +0000 (03:26 -0800)]
[PATCH] use wait_task_inactive() in kthread_bind()
From: Rusty Russell <rusty@rustcorp.com.au>
Make it clear that the reason we do wait_task_inactive is because
kthread_bind frobs with k->thread_info->cpu, which is only legal because
the task is definitely not running.
We can't use the normal migration thread code here, because it doesn't let
us bind to cpus which are offline yet, and also because we use this to
start the migration threads themselves.
Andrew Morton [Sat, 13 Mar 2004 11:25:58 +0000 (03:25 -0800)]
[PATCH] further __KERNEL_SYSCALLS__ removal
From: Arnd Bergmann <arnd@arndb.de>
Dave Jones already removed some of the useless __KERNEL_SYSCALLS__ defines
in various files, this gets rid of almost all the others. Replacing
execve() is nontrivial, so I left those in for now.
For all the other system calls that are currently used from inside the
kernel, calling the sys_* function directly should always have an identical
effect.
Wim Van Sebroeck [Sun, 14 Mar 2004 00:38:29 +0000 (01:38 +0100)]
WATCHDOG] v2.6.4 wdt977-v0.03-patch
Version 0.03 of wdt977.c - Changes that were made are:
* Extract the stop code in a seperate function (wdt977_stop)
* Extract the start code in a seperate function (wdt977_start)
* Rename kick_wdog to wdt977_keepalive for consistency
* Extract the watchdog's status code to a seperate function (wdt977_get_status)
* Change the way we deal with the watchdog timeout:
Up till now we used timeoutM (in minutes) as the correct value and then
calculated timeout as being timeoutM*60 or *timeoutM*120 (depending on
wether or not we have the netwinder hardware bug).
From now on timeout is the correct value and we calculate timeoutM out
of it. Because of this we start with checking wether or not we have a
correct timeout value (if not we reset it to the default value) and we
automatically calculate timeoutM. Each time we change timeout with a
correct timeout value, we recalculate timeoutM.
* Extended ioctl code with WDIOC_SETOPTIONS and updated the watchdog_info structure
* Added notifier support
Wim Van Sebroeck [Sun, 14 Mar 2004 00:31:12 +0000 (01:31 +0100)]
[WATCHDOG] v2.6.4 pcwd_pci-v1.00_20040313-patch
Two small fixes:
* Make cards_found a global variable so that if we remove the
pci device we can count down.
* If we can't find a correct I/O address for the card, then we
should disable the card again.
Jeff Garzik [Fri, 12 Mar 2004 20:16:33 +0000 (15:16 -0500)]
[blk carmel] fix bug, minor cleanups
* the scan-channels message seemed to always give invalid output.
Look at the constant, and discover we are sending another
message entirely. Fix the constant (CARM_MSG_IOCTL).
Don Fry [Fri, 12 Mar 2004 08:23:52 +0000 (03:23 -0500)]
[PATCH] netdevice.h add netif_msg_init helper
This patch adds a helper function to initialize the debug bit mask
for use with netif_msg_*. When the debug_value is out of range
it returns the default_msg_enable_bits. Tested IA32.
Andrew Morton [Fri, 12 Mar 2004 00:25:36 +0000 (16:25 -0800)]
[PATCH] vm: balance inactive zone refill rates
The current refill logic in refill_inactive_zone() takes an arbitrarily large
number of pages and chops it down to SWAP_CLUSTER_MAX*4, regardless of the
size of the zone.
This has the effect of reducing the amount of refilling of large zones
proportionately much more than of small zones.
We made this change in may 2003 and I'm damned if I remember why. let's put
it back so we don't truncate the refill count and see what happens.
Andrew Morton [Fri, 12 Mar 2004 00:25:12 +0000 (16:25 -0800)]
[PATCH] vmscan: batch up inactive list scanning work
From: Nick Piggin <piggin@cyberone.com.au>
Use a "refill_counter" for inactive list scanning, similar to the one used
for active list scanning. This batches up scanning now that we precisely
balance ratios, and don't round up the amount to be done.
No observed benefits, but I imagine it would lower the acquisition
frequency of the lru locks in some cases, and make codepaths more efficient
in general due to cache niceness.
Andrew Morton [Fri, 12 Mar 2004 00:25:03 +0000 (16:25 -0800)]
[PATCH] vmscan: less throttling of page allocators and kswapd
This is just a random unsubstantiated tuning tweak: don't immediately
throttle page allocators and kwapd when the going is getting heavier: scan a
bit more of the LRU before throttling.
Andrew Morton [Fri, 12 Mar 2004 00:24:52 +0000 (16:24 -0800)]
[PATCH] fix the kswapd zone scanning algorithm
This removes a vestige of the old algorithm. We don't want to skip zones if
all_zones_ok is true: we've already precalculated which zones need scanning
and this just stops us from ever performing kswapd reclaim from the DMA zone.
Andrew Morton [Fri, 12 Mar 2004 00:24:40 +0000 (16:24 -0800)]
[PATCH] kswapd: fix lumpy page reclaim
As kswapd is now scanning zones in the highmem->normal->dma direction it can
get into competition with the page allocator: kswapd keep on trying to free
pages from highmem, then kswapd moves onto lowmem. By the time kswapd has
done proportional scanning in lowmem, someone has come in and allocated a few
pages from highmem. So kswapd goes back and frees some highmem, then some
lowmem again. But nobody has allocated any lowmem yet. So we keep on and on
scanning lowmem in response to highmem page allocations.
Andrew Morton [Fri, 12 Mar 2004 00:24:29 +0000 (16:24 -0800)]
[PATCH] kswapd: avoid unnecessary reclaiming from higher zones
Currently kswapd walks across all zones in dma->normal->highmem order,
performing proportional scanning until all zones are OK. This means that
pressure against ZONE_NORMAL causes unnecessary reclaim of ZONE_HIGHMEM.
To fix that up we change kswapd so that it walks the zones in the
high->normal->dma direction, skipping zones which are OK. Once it encounters
a zone which needs some reclaim kswapd will perform proportional scanning
against that zone as well as all the succeeding lower zones.
We scan the lower zones even if they have sufficient free pages. This is
because
a) the lower zone may be above pages_high, but because of the incremental
min, the lower zone may still not be eligible for allocations. That's bad
because cache in that lower zone will then not be scanned at the correct
rate.
b) pages in this lower zone are usable for allocations against the higher
zone. So we do want to san all the relevant zones at an equal rate.
Andrew Morton [Fri, 12 Mar 2004 00:24:10 +0000 (16:24 -0800)]
[PATCH] Balance inter-zone scan rates
When page reclaim is working out how many pages to san in a zone (max-scan)
it presently rounds that number up if it looks too small - for work batching.
Problem is, this can result in excessive scanning against small zones which
have few inactive pages. So remove it.
Not that it is possible for max_scan to be zero. That's OK - it'll become
non-zero as the priority increases.
Andrew Morton [Fri, 12 Mar 2004 00:24:01 +0000 (16:24 -0800)]
[PATCH] vmscan: drive everything via nr_to_scan
Page reclaim is currently a bit schitzo: sometimes we say "go and scan this
many pages and tell me how many pages were freed" and at other times we say
"go and scan this many pages, but stop if you freed this many".
It makes the logic harder to control and to understand. This patch coverts
everything into the "go and scan this many pages and tell me how many pages
were freed" model.
It doesn't seem to affect performance much either way.
Andrew Morton [Fri, 12 Mar 2004 00:23:50 +0000 (16:23 -0800)]
[PATCH] vmscan: zone balancing fix
We currently have a problem with the balancing of reclaim between zones: much
more reclaim happens against highmem than against lowmem.
This patch partially fixes this by changing the direct reclaim path so it
does not bale out of the zone walk after having reclaimed sufficient pages
from highmem: go on to reclaim from lowmem regardless of how many pages we
reclaimed from lowmem.
Andrew Morton [Fri, 12 Mar 2004 00:23:38 +0000 (16:23 -0800)]
[PATCH] vm: scan slab in response to highmem scanning
The patch which went in six months or so back which said "only reclaim slab
if we're scanning lowmem pagecache" was wrong. I must have been asleep at
the time.
We do need to scan slab in response to highmem page reclaim as well. Because
all the math is based around the total amount of memory in the machine, and
we know that if we're performing highmem page reclaim then the lower zones
have no free memory.
Andrew Morton [Fri, 12 Mar 2004 00:22:50 +0000 (16:22 -0800)]
[PATCH] kswapd throttling fixes
The logic in balance_pgdat() is all bollixed up.
- the incoming arg `nr_pages' should be used to determine if we're being
asked to free a specific number of pages, not `to_free'.
- local variable `to_free' is not appropriate for the determination of
whether we failed to bring all zones to appropriate free pages levels.
Fix this by correctly calculating `all_zones_ok' and then use
all_zones_ok to determine whether we need to throttle kswapd.
So the logic now is:
for (increasing priority) {
all_zones_ok = 1;
for (all zones) {
to_reclaim = number of pages to try to reclaim
from this zone;
max_scan = number of pages to scan in this pass
(gets larger as `priority' decreases)
/*
* set `reclaimed' to the number of pages which were
* actually freed up
*/
reclaimed = scan(max_scan pages);
reclaimed += shrink_slab();
to_free -= reclaimed; /* for the `nr_pages>0' case */
/*
* If this scan failed to reclaim `to_reclaim' or more
* pages, we're getting into trouble. Need to scan
* some more, and throttle kswapd. Note that this
* zone may now have sufficient free pages due to
* freeing activity by some other process. That's
* OK - we'll pick that info up on the next pass
* through the loop.
*/
if (reclaimed < to_reclaim)
all_zones_ok = 0;
}
if (to_free > 0)
continue; /* swsusp: need to do more work */
if (all_zones_ok)
break; /* kswapd is done */
/*
* OK, kswapd is getting into trouble. Take a nap, then take
* another pass across the zones.
*/
blk_congestion_wait();
}
Andrew Morton [Fri, 12 Mar 2004 00:22:27 +0000 (16:22 -0800)]
[PATCH] Narrow blk_congestion_wait races
From: Nick Piggin <piggin@cyberone.com.au>
The addition of the smp_mb and the other change is to try to close the
window for races a bit. Obviously they can still happen, it's a racy
interface and it doesn't matter much.
Andrew Morton [Fri, 12 Mar 2004 00:21:24 +0000 (16:21 -0800)]
[PATCH] Add barriers to avoid race in mempool_alloc/free
From: Chris Mason <mason@suse.com>
mempool_alloc() and mempool_free() check pool->curr_nr without any locks
held. This can lead to skipping a wakeup when there are people waiting,
and sleeping when there are free elements in the pool.
I can't trigger this reliably, but sooner or later someone on ppc is
probably going to hit it.
Andrew Morton [Fri, 12 Mar 2004 00:20:22 +0000 (16:20 -0800)]
[PATCH] fbdev: monitor detection fixes
From: James Simmons <jsimmons@infradead.org>,
Kronos <kronos@kronoz.cjb.net>
Various fixes and enhancements to the monitor hardware detection code. The
only driver that uses it is the radeon driver.
Old EDID parsing code was very verbose, half of the patch address this (ie.
print lots of stuff iff DEBUG). The other big change is the FB_MODE_IS_*
stuff: we really need a way to know the origin of a video mode. In this way
we can select video mode that comes from EDID instead of VESA or GTF.
Drivers other than radeonfb won't be affected because they cannot (yet) get
EDID from the monitor and don't use EDID related code.
Andrew Morton [Fri, 12 Mar 2004 00:19:57 +0000 (16:19 -0800)]
[PATCH] fix raid0 readahead size
From: Arjan van de Ven <arjanv@redhat.com>
Readahead of raid0 was suboptimal; it read only 1 stride ahead. The
problem with this is that while it will keep all spindles busy, it will not
actually manage to make larger IO's, eg each disk would just do the chunk
size IO. Doing at least 2 chunks is more than appropriate so that each
spindle will get a chance to merge IO's.
Andrew Morton [Fri, 12 Mar 2004 00:19:45 +0000 (16:19 -0800)]
[PATCH] module.h __attribute_used__ fix
From: Rusty Russell <rusty@rustcorp.com.au>
Someone added __attribute_used__ throughout module.h, but didn't remove the
", unused". Looks like some arch/gcc combos still consider it unused, and
discard the fn.
The attached patch is needed to stop showing us "Macintosh device drivers"
for all architectures via menuconfig || xconfig || gconfig. It's only
necessary for PPC and/or MAC.
Andrew Morton [Fri, 12 Mar 2004 00:19:04 +0000 (16:19 -0800)]
[PATCH] add nowarn to a few pte chain allocators
From: Arjan van de Ven <arjanv@redhat.com>
Several of the pte_chain_alloc() allocators that use GFP_ATOMIC have a
fallback for failure that sleeps; they thus need to not warn on failure..
Seen during a big fork on a busy system.
Andrew Morton [Fri, 12 Mar 2004 00:18:43 +0000 (16:18 -0800)]
[PATCH] EDD: Get Legacy Parameters
From: Matt Domsch <Matt_Domsch@dell.com>
Patch below from Patrick J. LoPresti and myself. Patrick describes:
Why this patch? The problem is that the legacy BIOS interface
(INT13/AH=3D08) for querying the disk geometry returns different values
than the extended INT13 interface which the EDD code currently uses. This
is because the legacy interface only provides a 10-bit cylinder field, so
modern BIOSes "lie" about the head/sector counts in order to make more of
the disk visible within the first 1024 cylinders.
Many non-Linux applications, including the stock Windows boot loader, DOS
fdisk, etc., rely upon the legacy interface and geometry. So it is useful
to be able to obtain the legacy values from a running Linux kernel.
What this patch does is to add new entries under
/sys/firmware/edd/int13_devXX named "legacy_cylinders", "legacy_heads", and
"legacy_sectors". These provide the geometry given by the legacy
INT13/AH=3D08 BIOS interface, just like the current "default_cylinders"
etc. provide the the geometry given by the INT13/AH=3D48 interface.
Without this patch, I cannot use Linux to partition a drive and install
Windows, which happens to be my application.
- Pat
http://unattended.sourceforge.net/
In addition, this adds two buggy BIOS workarounds in the EDD int13
calls as suggested by Ralf Brown's interrupt list.
I'm also interested in moving this code out of arch/i386/kernel/edd.c and
include/asm-i386/edd.h, as I believe it is applicable on x86-64 as well.
However, there's no good place under drivers/ to put edd.c when it's not
tied to a bus, but to several CPU architectures and their firmwares...
Maybe a new directory drivers/firmware?
Andrew Morton [Fri, 12 Mar 2004 00:18:34 +0000 (16:18 -0800)]
[PATCH] wavfront.c needs syscalls.h
sound/oss/wavfront.c: In function `wavefront_download_firmware':
sound/oss/wavfront.c:2524: warning: implicit declaration of function `sys_open'
sound/oss/wavfront.c:2533: warning: implicit declaration of function `sys_read'
sound/oss/wavfront.c:2582: warning: implicit declaration of function `sys_close
Andrew Morton [Fri, 12 Mar 2004 00:18:23 +0000 (16:18 -0800)]
[PATCH] Fix reading the last block on a bdev
From: Chris Mason <mason@suse.com>
This patch fixes a problem we're hitting on ia64 with page sizes > 4k.
When the page size is greater than the block size, and parts of the page
fall past the end of the device, readpage will fail because
blkdev_get_block returns -EIO for blocks past i_size.
The attached patch changes blkdev_get_block to return holes when reading
past the end of the device, which allows us to read that last valid 4k
block and then fill the rest of the page with zeros. Writes will still
fail with -EIO.