[PATCH] consolidate hit count increments in profile_tick()
With prof_cpu_mask and profile_pc() in hand, the core is now able to perform
all the profile accounting work on behalf of arches. Consolidate the profile
accounting and convert all arches to call the core function.
Signed-off-by: William Irwin <wli@holomorphy.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
The program counter calculation from pt_regs is the only portion of profile
accounting that differs across various architectures. This is usually
instruction_pointer(regs), but to handle the few arches where it isn't,
introduce profile_pc().
Signed-off-by: William Irwin <wli@holomorphy.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Handling of prof_cpu_mask is grossly inconsistent. Some arches have it as a
cpumask_t, others unsigned long, and even within arches it's treated
inconsistently. This makes it cpumask_t across the board, and consolidates
the handling in kernel/profile.c
Signed-off-by: William Irwin <wli@holomorphy.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Arjan van de Ven [Fri, 27 Aug 2004 03:30:55 +0000 (20:30 -0700)]
[PATCH] schedule profileing
From: William Lee Irwin III <wli@holomorphy.com>
The patch (from Ingo) below is quite interesting, it allows the use of
readprofile not for statistical tine sampling, but for seeing where calls to
schedule() come from, so it can give some insight to the "where do my context
switches come from" question.
Boot with `profile=schedul2' to activate this feature.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Rusty Russell [Fri, 27 Aug 2004 03:30:43 +0000 (20:30 -0700)]
[PATCH] Hotplug CPU vs TASK_ZOMBIEs: The Sequel to Hotplug CPU vs TASK_DEAD
release_task can sleep. Sleeping allows a CPU to go down underneath you.
release_task removes you from the tasklist, so you don't get migrated off the
CPU: BUG() in sched.c.
In last week's episode, our dashing hero (Ingo Molnar) solved this for
self-reaping tasks by grabbing the hotplug cpu lock to prevent this.
However, in an unexpected twist, the problem remains for tasks whose
parents call release_task on them: the zombies are off the task list, and
lurk on the dead CPU.
Fortunately, the comedic sidekick (Rusty Russell) has an answer: let's make
the hotplug callback walk the runqueue of the dead CPU as well, taking care
of the zombies.
1) Restore exit.c to its former form. The comment is incorrect: sched.c
checks PF_DEAD, not the state, to decide to do the final
put_task_struct(), and it does it for all tasks, self-reaping or no.
2) Implement migrate_dead_tasks() in the sched.c hotplug CPU callback.
3) Rename migrate_all_tasks() to migrate_live_tasks().
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Neil Brown [Fri, 27 Aug 2004 03:30:20 +0000 (20:30 -0700)]
[PATCH] md: fix problems with checksum handling in MD superblocks.
md currently uses csum_partial to calculate checksums for superblocks.
However this function is not consistent across all architectures. Some
(i386) to a 32bit csum. Some (alpha) do a 16 bit csum. This makes it hard
for userspace to keep up.
So we provide a generic routine (that does exactly what the i386
csum_partial does) and:
- When setting the csum, use csum_partial so that old kernels will still
recognise the superblock
- When checking the csum, allow either csum_partial or the new generic
code to provide the right csum. This allows user-space to just use the
common code and always work.
Also modify the csum for version-1 superblock (which currently aren't being
used) to always user a predictable checksum algorithm.
Thanks to Mike Tran <mhtran@us.ibm.com> for noticing this.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Jesse Barnes [Fri, 27 Aug 2004 03:30:08 +0000 (20:30 -0700)]
[PATCH] fix sysrq support in sn_console.c
In porting the sn_console driver to the serial core, we lost sysrq support.
This patch fixes it and removes a few unncessary #ifdefs. Can you please
send it on to Linus asap? sysrq is a *really* nice thing to have.
Jesse Barnes [Fri, 27 Aug 2004 03:29:57 +0000 (20:29 -0700)]
[PATCH] fix show_mem on discontig machines
Dave Hansen recently did some bootmem and paging init cleanups, but I
missed this little bit when I tested his original patches. We need to
initialize pgdat->node_mem_map correctly since a) we're using vmem_map, and
b) the core won't do it for us since we have a valid node_start_pfn I
believe.
Neil Brown [Fri, 27 Aug 2004 03:29:45 +0000 (20:29 -0700)]
[PATCH] Use fixed size buffer instead of kmalloc for m_class in ip_map
This avoids lots of bothersome memory management and is generally
cleaner.
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Sam Ravnborg [Thu, 26 Aug 2004 23:20:43 +0000 (01:20 +0200)]
kbuild: use *.lds infrastructure in arch/i386/kernel
Rusty decided to preprocess a *.lds.S file in parallele with the new *.lds infrastructure
being added to kbuild. Fix that up.
Also added the file to targets so we do not see recompile each time the kernel is build.
David Brownell [Thu, 26 Aug 2004 09:04:56 +0000 (02:04 -0700)]
[PATCH] USB: gadgetfs minor updates
Gadgetfs updates:
- Resolve a problem that came from a change in the API to AIO:
kiocb->private type and size changed, but the name remained
the same ... so GCC wouldn't report pending memory-corruption.
- Probe the controller at runtime, eliminatingting config-specific
defines which need to be updated for each new controller. Rip
out the old #defines.
- Use newish APIs to let VBUS current be used to recharge
batteries (or whatever).
- Use no_llseek() ... endpoints are pure data streams.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Oliver Neukum [Thu, 26 Aug 2004 08:56:59 +0000 (01:56 -0700)]
[PATCH] USB: cdc acm patch
Fix tty layer sleep/locking problem (again) ... when this is
called through the network stack (PPP) sleeping isn't allowed.
There's some bugtraq ID for this.
From: Oliver Neukum <oliver@neukum.org> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
This patch gets rid of the tcp_default_win_scale sysctl and instead
computes the optimum maximum window scale. It just means one less
thing to have to tune. I also moved the code out of the inline because
it gets called three places and isn't in the critical path.
As a side effect, it will cause a smaller window scale for many people
since the default tcp_rmem fits in a win_scale of 2. This is allows for
finer grain windows (good), but may mask some of the problems with bad
implementations we have already seen (bad).
Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: David S. Miller <davem@redhat.com>
[PATCH] ppc32: Improve workaround for 74xx CPUs with broken BTIC
The previous workaround didn't enable the BTIC bit on CPUs where it is
broken. However, it seems some firmwares will unconditionally set it,
so this new patch will actually _clear_ it on CPUs where it is broken.
Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
The trackpad on recent Apple laptops tend to emmit spurrious 'right
clicks' apparently. This patch from Alex Clausen fixes it, please
apply. The trackpad cannot normally emit a right click, so just filter
those out.
Signed-off-by: Alexander Clausen <alex@skip86.com> Signed-off-by: Michael Schmitz <schmitz@opal.biophys.uni-duesseldorf.de> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Alexander Viro [Thu, 26 Aug 2004 01:13:08 +0000 (18:13 -0700)]
[PATCH] missing include of config.h in asm-alpha/page.h
That was a nasty one - missing include of config.h in a file that has
non-trivial ifdefs. With some configs it ended up with very odd conflicts
(we get included early, take the wrong branch of ifdef, then get another
file included, it pulls in config.h and picks the right branch of its
ifdef; surprise, surprise, they conflict).
Signed-off-by: Al Viro <viro@parcelfarce.linux.org.uk> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Linus Torvalds [Wed, 25 Aug 2004 14:31:10 +0000 (07:31 -0700)]
Revert I2C keywest class fixup
Benh says: "Please revert that for now, I need to figure out what they
were exactly trying to do and will come up with something if it makes
sense but the patch as-is doesn't"
David Mosberger [Wed, 25 Aug 2004 11:06:16 +0000 (04:06 -0700)]
[PATCH] signal-race-fix: ia64
It looks fine to me, except that I decided to play chicken as far as the
give_sigsegv update of sa_handler is concerned.
Arun, I hope I got the ia32 emulation parts right, but you may want to
double-check.
The patch seems to work fine as far as I have tested. I'm seeing some
oddity in context-switch overhead and pipe latency as reported by LMbench,
but I suspect that's due to another change that happened somewhere between
2.6.5-rc1 and Linus' bk tree as of this morning.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Andi Kleen [Wed, 25 Aug 2004 11:01:29 +0000 (04:01 -0700)]
[PATCH] signal-race-fixes: x86-64 support
Add the signal race changes to x86-64 to make it compile again.
Didn't merge the more pointless changes from i386.
Also remove the special SA_ONESHOT handling, doesn't seem to be needed
anymore.
From: Mikael Pettersson <mikpe@csd.uu.se>
The signal-race-fixes patch in 2.6.8-rc2-mm1 appears to have broken
x86-64's ia32 emulation.
When forcing a SIGSEGV the old code updated "*ka", where ka was a pointer
to current's k_sigaction for SIGSEGV. Now "ka_copy" points to a copy of
that structure, so assigning "*ka_copy" doesn't do what we want. Instead do
the assignment via current->... just like the normal signal delivery code
does.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
The signal-race-fixes patch in 2.6.8-rc2-mm1 appears to be a bit broken on
s390.
When forcing a SIGSEGV the old code updated "*ka", where ka was a pointer
to current's k_sigaction for SIGSEGV. Now "ka_copy" points to a copy of
that structure, so assigning "*ka_copy" doesn't do what we want. Instead do
the assignment via current->... just like i386 and x86_64 do.
Furthermore, the SA_ONESHOT handling wasn't deleted. That is now handled
by generic code in the kernel.
Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Corey Minyard [Wed, 25 Aug 2004 11:00:58 +0000 (04:00 -0700)]
[PATCH] signal handling race fix
The problem:
In arch/i386/signal.c, in the do_signal() function, it calls
get_signal_to_deliver() which returns the signal number to deliver (along
with siginfo). get_signal_to_deliver() grabs and releases the lock, so
the signal handler lock is not held in do_signal(). Then the do_signal()
calls handle_signal(), which uses the signal number to extract the
sa_handler, etc.
Since no lock is held, it seems like another thread with the same
signal handler set can come in and call sigaction(), it can change
sa_handler between the call to get_signal_to_deliver() and fetching the
value of sa_handler. If the sigaction() call set it to SIG_IGN, SIG_DFL,
or some other fundamental change, that bad things can happen.
The patch:
You have to get the sigaction information that will be delivered while
holding sighand->siglock in get_signal_to_deliver().
In 2.4, it can be fixed per-arch and requires no change to the
arch-independent code because the arch fetches the signal with
dequeue_signal() and does all the checking.
The test app:
The program below has three threads that share signal handlers. Thread
1 changes the signal handler for a signal from a handler to SIG_IGN and
back. Thread 0 sends signals to thread 3, which just receives them.
What I believe is happening is that thread 1 changes the signal handler
in the process of thread 3 receiving the signal, between the time that
thread 3 fetches the signal info using get_signal_to_deliver() and
actually delivers the signal with handle_signal().
Although the program is obvously an extreme case, it seems like any
time you set the handler value of a signal to SIG_IGN or SIG_DFL, you can
have this happen. Changing signal attributes might also cause problems,
although I am not so sure about that.
(akpm: this test app segv'd on SMP within milliseconds for me)
[BRIDGE]: Fix oops when mangling and brouting and tcpdumping packets
The ebtables brouting chain, traversed through the call
br_should_route_hook(), can alter a packet. The redirect target
does this, f.e., to change the MAC destination.
Bart discovered this and proposed a patch; this is a revised version.
This version cleans up the handle_bridge code in net/core/dev.c as well
as getting rid of extra rcu_read_lock and only does the br_port checking
once.
Signed-off-by: Stephen Hemminger <shemminger@osdl.org> Signed-off-by: David S. Miller <davem@redhat.com>
[ARM PATCH] 2047/1: disable NWFPE_XP on big endian
Patch from Lennert Buytenhek
Hi,
gcc doesn't understand 80-bit floating point on the ARM currently,
according to the kernel's Kconfig docs, but it would seem that the
current extended double emulation code is broken for big endian
platforms.
So, this patch disables NWFPE_XP on big endian architectures, until
someone comes round and fixes it.
[ARM PATCH] 2046/1: fix nwfpe for double arithmetic on big-endian platforms
Patch from Lennert Buytenhek
Hi,
I need the patch below (against 2.6.8-rc1-ds1) to make nwfpe properly
emulate arithmetic with doubles on a big endian ARM platform.
From reading the mailing list archives and from helpful comments I've
received from people on this list, I gather that this has come up in
the past, but it appears that Russell King was never really convinced
as to why this patch is needed. I think I understand what's going on,
and will try to explain.
On little endian ARM, the double value 1.0 looks like this when stored
in memory in FPA word ordering:
bytes: 0x00 0x00 0xf0 0x3f 0x00 0x00 0x00 0x00
u32s: 0x3ff00000 0x00000000
u64: 0x000000003ff00000
On big endian, it looks like this:
bytes: 0x3f 0xf0 0x00 0x00 0x00 0x00 0x00 0x00
u32s: 0x3ff00000 0x00000000
u64: 0x3ff0000000000000
It appears to be this way because once upon a time, somebody decided
that the sub-words of a double will use native endian word ordering
within themselves, but the two separate words will always be stored
with the most significant one first. God knows why they did it this
way, but they did.
Anyway. The key observation is that nwfpe internally stores double
values in the type 'float64', which is basically just a typedef for
unsigned long long. It never accesses 'float64's on the byte level
by casting pointers around or anything like that, it just uses direct
u64 arithmetic primitives (add, shift, or, and) for float64
manipulations and that's it.
So. For little endian platforms, 1.0 looks like:
0x00 0x00 0xf0 0x3f 0x00 0x00 0x00 0x00
But since nwfpe treats it as a u64, it wants it to look like:
0x00 0x00 0x00 0x00 0x00 0x00 0xf0 0x3f
So, that's why the current code swaps the words around when getting
doubles from userspace and putting them back (see fpa11_cpdt.c,
loadDouble and storeDouble.)
On big endian, 1.0 looks like:
0x3f 0xf0 0x00 0x00 0x00 0x00 0x00 0x00
Since nwfpe treats it as a u64, it wants it to look like:
0x3f 0xf0 0x00 0x00 0x00 0x00 0x00 0x00
Hey! That's exactly the same. So in this case, it shouldn't be
swapping the halves around. However, it currently does that swapping
unconditionally, and that's why floating point emulation messes up.
This is how I understand things -- hope it makes sense to other people
too.
Ben Dooks [Wed, 25 Aug 2004 18:14:27 +0000 (19:14 +0100)]
[ARM PATCH] 2043/1: S3C2410 update to registered devices
Patch from Ben Dooks
Updated all arch/arm/mach-s3c2410/mach-XXX.c files to
register default set of devices
Added new board struct to keep this sort of info, as it
isn't possible to register platform_devices until after
the init_io functions have been called.
John Rose [Wed, 25 Aug 2004 06:23:54 +0000 (23:23 -0700)]
[PATCH] PCI Hotplug: create pci_remove_bus()
The following patch implements a pci_remove_bus() that can be used by
hotplug drivers for the removal of root buses. It also defines a
release function that frees the device struct for pci_bus->bridge when a
root bus class device is unregistered.
Signed-off-by: John Rose <johnrose@austin.ibm.com> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Jean Delvare [Wed, 25 Aug 2004 06:21:59 +0000 (23:21 -0700)]
[PATCH] I2C: rename in0_ref to cpu0_vid
This patch changes all the i2c chip drivers and documentation to use the
name "cpu0_vid" instead of "in0_ref". The name "in0_ref" was an error in
the first place as motherboard manufacturers may fail to follow the chip
manufacturer's recommendation about which "in" channel to use for VCore
monitoring.
The new name leaves room for chips able to monitor more than 1 vid
value, such as the LM93 and, to a lesser extent, the PC87360 family (all
by National Semiconductor). These chips are typically designed for
dual-CPU motherboards.
This breaks the interface (obviously) so libsensors has been updated to
support both names.
Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Alan Stern [Wed, 25 Aug 2004 03:48:14 +0000 (20:48 -0700)]
[PATCH] USB: Add missing cleanup to usb_register_root_hub()
This patch adds some simple cleanups that are missing for one of the error
case in usb_register_root_hub(). I would be very surprised if this code
ever gets executed, but we might as well be correct.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>