Fix VIA-based TB/Decrementer calibration , previously it wouldn't work
properly with HZ != 100, causing tb_to_us to be wrong and gettimeofday()
to return strangely "off" results
There is a bug in cpufreq call back funtion in timer_tsc routines,
that can result in system deadlock. The issue is: grabbing the
write_lock on xtime_lock without disabling the interrupts. So,=20
if we happen to get a timer interrupt while we are in this code,
system will go into a deadlock.
This bug only effects the kernels that have CONFIG_CPU_FREQ enabled.
Ingo Molnar [Sat, 11 Oct 2003 12:54:53 +0000 (05:54 -0700)]
[PATCH] SMP races in the timer code
This fixes two del_timer_sync() races that are still in the timer code.
The first race was actually triggered in a 2.4 backport of the 2.6 timer
code. The second race was never triggered - it is mostly theoretical on
a standalone kernel. (It's more likely in any virtualized or otherwise
preemptable environment.)
Both races happen when self-rearming timers are used. One mainstream
example is kernel/itimer.c. The effect of the races is that
del_timer_sync() lets a timer running instead of synchronizing with it,
causing logic bugs (and crashes) in the affected kernel code. One
typical incarnation of the race is a double add_timer().
CPU0 gets stuck at the [*] code-point briefly - after the timer->base has
been set to NULL, but before the base->running_timer pointer has been set
up. This is a fundamentally volatile scenario, as there's _zero_ knowledge
in the data structures that this timer is about to be executed!
Now CPU1 comes along and calls del_timer_sync(). It will find nothing -
neither timer->base nor base->running_timer will cause it to synchronize.
It will return and report that the timer has been deleted - shortly
afterwards CPU1 continues to execute the timer fn, which will cause
crashes.
This particular race is easy to fix by reordering the timer->base
clearing with set_running_timer(), and putting a wmb() between them, but
there's more races:
race #2
The checking of del_timer_sync() for 'pending or running timer' is
fundamentally unrobust. Eg. if CPU0 gets stuck at the [***] point below:
base = &per_cpu(tvec_bases, i);
if (base->running_timer == timer) {
while (base->running_timer == timer) {
cpu_relax();
preempt_check_resched();
}
[***]
break;
}
}
smp_rmb();
if (timer_pending(timer))
goto del_again;
then del_timer_sync() has already decided that this timer is not running
(we just finished loop-waiting for it), but we have not done the
timer_pending() check yet.
If the timer has re-armed itself, and if the timer expires on CPU1 (this
needs a long delay on CPU0 but that's not hard to achieve eg. in UML or
with kernel preemption enabled), then CPU1 could start to expire the
timer and gets to the [**] point in __run_timers (see above), then CPU1
gets stalled and CPU0 is unstalled, then the timer_pending() check in
del_timer_sync() will not notice the running timer, and del_timer_sync()
returns - while CPU1 is just about to run the timer!
Fixing this second race is hard - it involves a heavy race-check
operation that has to lock all bases, and has to re-check the
base->running_timer value, and timer_pending condition atomically.
This fix also fixes the first race, due to forcing del_timer_sync() to
always observe the timer state atomically, so the [*] code point will
always synchronize with del_timer_sync().
The patch is ugly but safe, and it has fixed the crashes in the 2.4
backport. I tested the patch on 2.6.0-test7 with some heavy itimer use
and it works fine. Removing self-arming timers safely is the sole
purpose of del_timer_sync(), so there's no way around this overhead i
think. I believe we should ultimately fix all major del_timer_sync()
users to not use self-arming timers - having del_timer_sync() in the
thread-exit path is now a considerable source of SMP overhead. But this
is out of the scope of current 2.6 fixes of course, and we have to
support self-arming timers as well.
Jesse Barnes [Fri, 10 Oct 2003 11:35:59 +0000 (04:35 -0700)]
[PATCH] ia64: nable SN2 in generic builds
Now that it works, we can enable sn2 in generic builds. This should not
only allow generic kernels to work on sn2, but also fix the build
problems people have been seeing with the qla1280 driver. I tested a
generic kernel built with this patch on zx1 and it worked.
Tony Luck [Fri, 10 Oct 2003 09:53:34 +0000 (02:53 -0700)]
[PATCH] ia64: fix register numbers in MCA save/restore
This corrects the save/restore code in mca_asm.S
which was written long ago, before the assembler understood
mnemonic names for 'cr' and 'ar' registers (in fact it
appears to have been written pre-silicon, some of the
control register numbers don't match with what actually
got built). There were other goofs too (like using
0, 1, 2, etc. for region register subscripts).
David Mosberger [Fri, 10 Oct 2003 09:17:14 +0000 (02:17 -0700)]
ia64: Patch by Jesse Barnes:
This patch fixes the combination of CONFIG_DISCONTIGMEM and
CONFIG_VIRTUAL_MEM_MAP so that generic kernels will work on all ia64
platforms, including sn2, and also makes sn2 specific kernels work
(which I think is a first).
I've cleaned this patch up heavily based on feedback from yourself,
Christoph and others. I've tested sn2, zx1, and dig (thanks Xavier!)
specific configurations, as well as a generic configuration that allows
the same binary to boot on zx1, dig, and sn2.
Dave Jones [Fri, 10 Oct 2003 23:31:17 +0000 (00:31 +0100)]
Merge wopr.codemonkey.org.uk:/mnt/nfs/sepia/bar/src/kernel/2.6/trees/bk-linus
into wopr.codemonkey.org.uk:/mnt/nfs/sepia/bar/src/kernel/2.6/trees/cpufreq
Dave Jones [Fri, 10 Oct 2003 23:24:13 +0000 (00:24 +0100)]
[CPUFREQ] Kill longhaul warnings
(Blah about unused variables).
This code still won't be used, as its still not tested/debugged properly
on a Nehemiah.
Dave Jones [Fri, 10 Oct 2003 21:57:10 +0000 (22:57 +0100)]
[CPUFREQ] Fix longhauls speed calculations.
We got half multipliers horribly wrong, which made us think we could
clock the CPU much higher than we actually could.
Dave Jones [Fri, 10 Oct 2003 21:02:19 +0000 (22:02 +0100)]
[CPUFREQ] Make VIA longhaul work on Samuel2 & Ezra again.
These CPUs are actually only longhaul v1 compliant.
This was catastrophic, as the MSRs moved between v1 and v2.
There was also massive confusion in the documentation regarding Ezra.
It's not another variant, so 'v2' never existed.
Renamed v3 (Powersaver) to v2 as a result of this.
[PATCH] I2C: fix i2c-dev class release function bug.
There was no release function, that was the bug :)
It caused bad messages to show up in the syslog whenever a i2c driver was removed, and could
easily oops.
Alexander Malysh [Fri, 10 Oct 2003 07:11:04 +0000 (00:11 -0700)]
[PATCH] I2C: i2c-sis630 driver fixes
attached you can find a patch that should fix i2c-sis630 driver for
2.6.0-X kernel. With i2c-sis630 from stock 2.6.0-X we have oops and
driver was not correct registered against i2c-core.
Changes:
1) fixed a oops while modprobing
2) added check for buffer overflow for i2c block data read transaction
3) added 'force' modprobe parameter. It's allow more easily
testing for not yet supported SiS chips.
Peter Chubb [Thu, 9 Oct 2003 10:19:19 +0000 (03:19 -0700)]
[PATCH] ia64: drop stale check for GAS_HAS_LOCAL_TAGS
GAS_HAS_LOCAL_TAGS was removed a long time ago, but uaccess.h never got
updated. Without this fix, bad syscall args may cause a SEGFAULT instead
of failing gracefully.
Kenneth W. Chen [Thu, 9 Oct 2003 09:02:14 +0000 (02:02 -0700)]
[PATCH] ia64: fix NUMA hugetlb support
Here is a patch that adds numa support for hugetlb page on ia64. It is
taken from x86 numa implementation. The low level hugetlb page
pre-allocation is done in round robin fashion on each numa node and
allocation for user level code is node local aware.
Jesse Barnes [Thu, 9 Oct 2003 06:59:30 +0000 (23:59 -0700)]
[PATCH] ia64: deal with lack of SRAT in GENERIC kernels
n platforms without an SRAT (e.g. zx1), the cpu_to_node_map will get
built incorrectly without this fix, making generic kernels fail when
they try to alloc_pages_node() from a nodeid of -1.
Jesse Barnes [Thu, 9 Oct 2003 06:51:05 +0000 (23:51 -0700)]
[PATCH] ia64: fix is_headless_node() for systems w/<64p
I didn't realize that any_online_cpu() wouldn't work for
is_headless_node(), so this patch reverts the function back to using the
node_to_cpu_mask[] array, fixing sn2 for systems with less than 64p.
Noah J. Misch [Thu, 9 Oct 2003 06:17:49 +0000 (23:17 -0700)]
[PATCH] USB: Make Ethernet Gadget depend on CONFIG_NET
Previously, one could configure a kernel that wouldn't link by doing a 'make
allnoconfig' and then a 'make menuconfig' and enabling CONFIG_EXPERIMENTAL,
CONFIG_PCI, CONFIG_USB_GADGET, and CONFIG_USB_ETH.
Noah J. Misch [Thu, 9 Oct 2003 06:17:37 +0000 (23:17 -0700)]
[PATCH] USB: Make ISD-200 USB/ATA Bridge depend on BLK_DEV_IDE
This usb driver needs ide_fix_driveid from drivers/ide/ide-ops.c, which
needs BLK_DEV_IDE ("Enhanced IDE/MFM/RLL disk/cdrom/tape/floppy
support") to get built.
Without this patch, you can configure an un-linkable kernel by doing make
allnoconfig, make menuconfig, and setting CONFIG_PCI, CONFIG_USB,
CONFIG_USB_STORAGE, and CONFIG_USB_STORAGE_ISD200 only.
Paul Mundt [Thu, 9 Oct 2003 05:33:22 +0000 (22:33 -0700)]
[PATCH] net/sunrpc/clnt.c compile fix
net/sunrpc/clnt.c does not compile if RPC_DEBUG is not enabled, due to
the fact that tk_pid is protected by RPC_DEBUG (which in turn depends on
CONFIG_SYSCTL).
The printk's that use it don't actually need to print it out at all,
the rpc_task tag isn't really interesting here.
Matthew Wilcox [Thu, 9 Oct 2003 04:25:22 +0000 (21:25 -0700)]
[PATCH] Build fixes for zoran on PA-RISC
The Zoran driver doesn't include <asm/io.h> and thus won't compile
on architectures where that doesn't get implicitly included through
some other path.
Andi Kleen [Thu, 9 Oct 2003 04:23:31 +0000 (21:23 -0700)]
[PATCH] Prefetch workaround for Athlon/Opteron
This is the latest iteration of the workaround for the Athlon/Opteron
prefetch erratum. Sometimes the CPU would incorrectly report an
exception on prefetch.
This supercedes the previous dumb workaround of checking for AMD CPUs in
prefetch(). That one bloated the kernel by several KB and lead to lots
of unnecessary checks in hot paths.
Also this one handles user space faults too, so the kernel can
effectively isolte the user space from caring about this errata.
Instead it handles it in the slow path of the exception handler (the
check is only done when the kernel would normally trigger seg fault or
crash anyways)
All the serious criticisms to the previous patches have been addressed.
It checks segment bases now, handles vm86 mode and avoids deadlocks when
the prefetch exception happened inside mmap_sem.
This includes review and fixes from Jamie Lokier and Andrew Morton.
Opcode decoder based on code from Richard Brunner.
David Brownell [Thu, 9 Oct 2003 03:30:54 +0000 (20:30 -0700)]
[PATCH] USB: make more driver names match module names
This resolves a bug in osdl bugtraq (#1261) by making
some more driver names match their module names. Such
mismatches are bad because scripts often need to add
special cases, handling multiple names for drivers.
Paul Mackerras [Thu, 9 Oct 2003 03:30:27 +0000 (20:30 -0700)]
[PATCH] USB: Fix USB suspend in 2.6.0-test6
In drivers/usb/core/hcd-pci.c, the code forgets to set hcd->state to
USB_STATE_SUSPENDED on suspend. The effect is that on resume, the
code refuses to wake the HCD up, and instead prints a message saying
the interface hasn't been suspended.
The patch below fixes this. It is against 2.6.0-test6. With this
patch I can suspend and resume my Apple PowerBook G4, and the USB
works after resuming.
David Brownell [Thu, 9 Oct 2003 03:26:58 +0000 (20:26 -0700)]
[PATCH] USB: minor net2280 cleanup
This holds minor net2280 cleanups:
- Cleaner handling for cases where dma_alloc_coherent() must be
used instead of kmalloc(). (Kmalloc is more memory-efficient
for the "small buffers" case.) Both MIPS cases should work,
as well as others.
- Prefetch cachelines on PIO paths.
The first of those gets rid of one <linux/version.h> usage, no
longer useful now that 2.4 and 2.6 versions have forked.
Since 2.6.0-test6, ftape can't be configured as a built-in driver.
test6 changed ftape-init.c to call ftape_proc_destroy() also in
the non-MODULE case; however, ftape_proc_destroy() is only defined
when the driver is built as a module. The result is a linkage error.
This fixes this by deleting the #if MODULE around ftape_proc_destroy()'s
definition.