Avi Kivity [Sun, 15 Apr 2007 13:31:09 +0000 (16:31 +0300)]
KVM: Use slab caches to allocate mmu data structures
Better leak detection, statistics, memory use, speed -- goodness all
around.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Thu, 12 Apr 2007 14:35:58 +0000 (17:35 +0300)]
KVM: Handle partial pae pdptr
Some guests (Solaris) do not set up all four pdptrs, but leave some invalid.
kvm incorrectly treated these as valid page directories, pinning the
wrong pages and causing general confusion.
Fix by checking the valid bit of a pae pdpte. This closes sourceforge bug
1698922.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Thu, 12 Apr 2007 10:03:01 +0000 (13:03 +0300)]
KVM: Initialize cr0 to indicate an fpu is present
Solaris panics if it sees a cpu with no fpu, and it seems to rely on this
bit. Closes sourceforge bug
1698920.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Eric Sesterhenn / Snakebyte [Mon, 9 Apr 2007 14:15:05 +0000 (16:15 +0200)]
KVM: Fix overflow bug in overflow detection code
The expression
sp - 6 < sp
where sp is a u16 is undefined in C since 'sp - 6' is promoted to int,
and signed overflow is undefined in C. gcc 4.2 actually warns about it.
Replace with a simpler test.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Mon, 2 Apr 2007 10:05:50 +0000 (13:05 +0300)]
KVM: Use kernel-standard types
Noted by Joerg Roedel.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Joerg Roedel [Fri, 30 Mar 2007 14:02:14 +0000 (17:02 +0300)]
KVM: SVM: enable LBRV virtualization if available
This patch enables the virtualization of the last branch record MSRs on
SVM if this feature is available in hardware. It also introduces a small
and simple check feature for specific SVM extensions.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Sun, 1 Apr 2007 13:34:31 +0000 (16:34 +0300)]
KVM: Add fpu get/set operations
These are really helpful when migrating an floating point app to another
machine.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Fri, 30 Mar 2007 13:54:30 +0000 (16:54 +0300)]
KVM: Add physical memory aliasing feature
With this, we can specify that accesses to one physical memory range will
be remapped to another. This is useful for the vga window at 0xa0000 which
is used as a movable window into the (much larger) framebuffer.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Fri, 30 Mar 2007 11:02:32 +0000 (14:02 +0300)]
KVM: Simply gfn_to_page()
Mapping a guest page to a host page is a common operation. Currently,
one has first to find the memory slot where the page belongs (gfn_to_memslot),
then locate the page itself (gfn_to_page()).
This is clumsy, and also won't work well with memory aliases. So simplify
gfn_to_page() not to require memory slot translation first, and instead do it
internally.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Dor Laor [Fri, 30 Mar 2007 10:06:33 +0000 (13:06 +0300)]
KVM: Add mmu cache clear function
Functions that play around with the physical memory map
need a way to clear mappings to possibly nonexistent or
invalid memory. Both the mmu cache and the processor tlb
are cleared.
Signed-off-by: Dor Laor <dor.laor@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Wed, 28 Mar 2007 18:04:16 +0000 (20:04 +0200)]
KVM: x86 emulator: fix bit string operations operand size
On x86, bit operations operate on a string of bits that can reside in
multiple words. For example, 'btsl %eax, (blah)' will touch the word
at blah+4 if %eax is between 32 and 63.
The x86 emulator compensates for that by advancing the operand address
by (bit offset / BITS_PER_LONG) and truncating the bit offset to the
range (0..BITS_PER_LONG-1). This has a side effect of forcing the operand
size to 8 bytes on 64-bit hosts.
Now, a 32-bit guest goes and fork()s a process. It write protects a stack
page at 0xbffff000 using the 'btr' instruction, at offset 0xffc in the page
table, with bit offset 1 (for the write permission bit).
The emulator now forces the operand size to 8 bytes as previously described,
and an innocent page table update turns into a cross-page-boundary write,
which is assumed by the mmu code not to be a page table, so it doesn't
actually clear the corresponding shadow page table entry. The guest and
host permissions are out of sync and guest memory is corrupted soon
afterwards, leading to guest failure.
Fix by not using BITS_PER_LONG as the word size; instead use the actual
operand size, so we get a 32-bit write in that case.
Note we still have to teach the mmu to handle cross-page-boundary writes
to guest page table; but for now this allows Damn Small Linux 0.4 (2.4.20)
to boot.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Tue, 27 Mar 2007 15:50:20 +0000 (17:50 +0200)]
KVM: Remove debug message
No longer interesting.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Mon, 26 Mar 2007 17:31:52 +0000 (19:31 +0200)]
KVM: Use list_move()
Use list_move() where possible. Noticed by Dor Laor.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Michal Piotrowski [Sun, 25 Mar 2007 15:59:32 +0000 (17:59 +0200)]
KVM: Remove unused function
Remove unused function
CC drivers/kvm/svm.o
drivers/kvm/svm.c:207: warning: ‘inject_db’ defined but not used
Signed-off-by: Michal Piotrowski <michal.k.k.piotrowski@gmail.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Sun, 25 Mar 2007 10:07:27 +0000 (12:07 +0200)]
KVM: SVM: Ensure timestamp counter monotonicity
When a vcpu is migrated from one cpu to another, its timestamp counter
may lose its monotonic property if the host has unsynced timestamp counters.
This can confuse the guest, sometimes to the point of refusing to boot.
As the rdtsc instruction is rather fast on AMD processors (7-10 cycles),
we can simply record the last host tsc when we drop the cpu, and adjust
the vcpu tsc offset when we detect that we've migrated to a different cpu.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Fri, 23 Mar 2007 07:55:25 +0000 (09:55 +0200)]
KVM: MMU: Fix hugepage pdes mapping same physical address with different access
The kvm mmu keeps a shadow page for hugepage pdes; if several such pdes map
the same physical address, they share the same shadow page. This is a fairly
common case (kernel mappings on i386 nonpae Linux, for example).
However, if the two pdes map the same memory but with different permissions, kvm
will happily use the cached shadow page. If the access through the more
permissive pde will occur after the access to the strict pde, an endless pagefault
loop will be generated and the guest will make no progress.
Fix by making the access permissions part of the cache lookup key.
The fix allows Xen pae to boot on kvm and run guest domains.
Thanks to Jeremy Fitzhardinge for reporting the bug and testing the fix.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Joerg Roedel [Wed, 21 Mar 2007 18:47:00 +0000 (19:47 +0100)]
KVM: SVM: forbid guest to execute monitor/mwait
This patch forbids the guest to execute monitor/mwait instructions on
SVM. This is necessary because the guest can execute these instructions
if they are available even if the kvm cpuid doesn't report its
existence.
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Sergey Kiselev [Thu, 22 Mar 2007 12:06:18 +0000 (14:06 +0200)]
KVM: Handle writes to MCG_STATUS msr
Some older (~2.6.7) kernels write MCG_STATUS register during kernel
boot (mce_clear_all() function, called from mce_init()). It's not
currently handled by kvm and will cause it to inject a GPF.
Following patch adds a "nop" handler for this.
Signed-off-by: Sergey Kiselev <sergey.kiselev@intel.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Wed, 21 Mar 2007 16:14:42 +0000 (18:14 +0200)]
KVM: Remove unused and write-only variables
Trivial cleanup.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Wed, 21 Mar 2007 16:11:36 +0000 (18:11 +0200)]
KVM: Don't allow the guest to turn off the cpu cache
The cpu cache is a host resource; the guest should not be able to turn
it off (even for itself).
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Wed, 21 Mar 2007 15:58:32 +0000 (17:58 +0200)]
KVM: Hack real-mode segments on vmx from KVM_SET_SREGS
As usual, we need to mangle segment registers when emulating real mode
as vm86 has specific constraints. We special case the reset segment base,
and set the "access rights" (or descriptor flags) to vm86 comaptible values.
This fixes reboot on vmx.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Wed, 21 Mar 2007 11:44:58 +0000 (13:44 +0200)]
KVM: Modify guest segments after potentially switching modes
The SET_SREGS ioctl modifies both cr0.pe (real mode/protected mode) and
guest segment registers. Since segment handling is modified by the mode on
Intel procesors, update the segment registers after the mode switch has taken
place.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Tue, 20 Mar 2007 16:44:51 +0000 (18:44 +0200)]
KVM: Remove set_cr0_no_modeswitch() arch op
set_cr0_no_modeswitch() was a hack to avoid corrupting segment registers.
As we now cache the protected mode values on entry to real mode, this
isn't an issue anymore, and it interferes with reboot (which usually _is_
a modeswitch).
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Tue, 20 Mar 2007 16:40:40 +0000 (18:40 +0200)]
KVM: Workaround vmx inability to virtualize the reset state
The reset state has cs.selector == 0xf000 and cs.base == 0xffff0000,
which aren't compatible with vm86 mode, which is used for real mode
virtualization.
When we create a vcpu, we set cs.base to 0xf0000, but if we get there by
way of a reset, the values are inconsistent and vmx refuses to enter
guest mode.
Workaround by detecting the state and munging it appropriately.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Tue, 20 Mar 2007 12:34:28 +0000 (14:34 +0200)]
KVM: MMU: Remove global pte tracking
The initial, noncaching, version of the kvm mmu flushed the all nonglobal
shadow page table translations (much like a native tlb flush). The new
implementation flushes translations only when they change, rendering global
pte tracking superfluous.
This removes the unused tracking mechanism and storage space.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Tue, 20 Mar 2007 12:29:06 +0000 (14:29 +0200)]
KVM: MMU: Remove unnecessary check for pdptr access
We already special case the pdptr access, so no need to check it again.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Tue, 20 Mar 2007 10:46:50 +0000 (12:46 +0200)]
KVM: Avoid guest virtual addresses in string pio userspace interface
The current string pio interface communicates using guest virtual addresses,
relying on userspace to translate addresses and to check permissions. This
interface cannot fully support guest smp, as the check needs to take into
account two pages at one in case an unaligned string transfer straddles a
page boundary.
Change the interface not to communicate guest addresses at all; instead use
a buffer page (mmaped by userspace) and do transfers there. The kernel
manages the virtual to physical translation and can perform the checks
atomically by taking the appropriate locks.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Wed, 7 Mar 2007 11:11:17 +0000 (13:11 +0200)]
KVM: Future-proof argument-less ioctls
Some ioctls ignore their arguments. By requiring them to be zero now,
we allow a nonzero value to have some special meaning in the future.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Wed, 7 Mar 2007 11:05:38 +0000 (13:05 +0200)]
KVM: Allow kernel to select size of mmap() buffer
This allows us to store offsets in the kernel/user kvm_run area, and be
sure that userspace has them mapped. As offsets can be outside the
kvm_run struct, userspace has no way of knowing how much to mmap.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Mon, 5 Mar 2007 17:46:05 +0000 (19:46 +0200)]
KVM: Add guest mode signal mask
Allow a special signal mask to be used while executing in guest mode. This
allows signals to be used to interrupt a vcpu without requiring signal
delivery to a userspace handler, which is quite expensive. Userspace still
receives -EINTR and can get the signal via sigwait().
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Mon, 5 Mar 2007 15:45:40 +0000 (17:45 +0200)]
KVM: Initialize the apic_base msr on svm too
Older userspace didn't care, but newer userspace (with the cpuid changes)
does.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Sun, 4 Mar 2007 12:24:03 +0000 (14:24 +0200)]
KVM: Add a special exit reason when exiting due to an interrupt
This is redundant, as we also return -EINTR from the ioctl, but it
allows us to examine the exit_reason field on resume without seeing
old data.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Sun, 4 Mar 2007 12:17:08 +0000 (14:17 +0200)]
KVM: Fold kvm_run::exit_type into kvm_run::exit_reason
Currently, userspace is told about the nature of the last exit from the
guest using two fields, exit_type and exit_reason, where exit_type has
just two enumerations (and no need for more). So fold exit_type into
exit_reason, reducing the complexity of determining what really happened.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Sun, 4 Mar 2007 11:59:30 +0000 (13:59 +0200)]
KVM: Allow userspace to process hypercalls which have no kernel handler
This is useful for paravirtualized graphics devices, for example.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Thu, 1 Mar 2007 15:56:20 +0000 (17:56 +0200)]
KVM: Add method to check for backwards-compatible API extensions
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Thu, 1 Mar 2007 15:20:13 +0000 (17:20 +0200)]
KVM: Renumber ioctls
The recent changes have left the ioctl numbers in complete disarray.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Thu, 1 Mar 2007 14:47:06 +0000 (16:47 +0200)]
KVM: Remove minor wart from KVM_CREATE_VCPU ioctl
That ioctl does not transfer any data, so it should be an _IO rather than an
_IOW.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Thu, 1 Mar 2007 14:20:40 +0000 (16:20 +0200)]
KVM: Remove the 'emulated' field from the userspace interface
We no longer emulate single instructions in userspace. Instead, we service
mmio or pio requests.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Wed, 28 Feb 2007 18:46:53 +0000 (20:46 +0200)]
KVM: Handle cpuid in the kernel instead of punting to userspace
KVM used to handle cpuid by letting userspace decide what values to
return to the guest. We now handle cpuid completely in the kernel. We
still let userspace decide which values the guest will see by having
userspace set up the value table beforehand (this is necessary to allow
management software to set the cpu features to the least common denominator,
so that live migration can work).
The motivation for the change is that kvm kernel code can be impacted by
cpuid features, for example the x86 emulator.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Thu, 22 Feb 2007 17:39:30 +0000 (19:39 +0200)]
KVM: Do not communicate to userspace through cpu registers during PIO
Currently when passing the a PIO emulation request to userspace, we
rely on userspace updating %rax (on 'in' instructions) and %rsi/%rdi/%rcx
(on string instructions). This (a) requires two extra ioctls for getting
and setting the registers and (b) is unfriendly to non-x86 archs, when
they get kvm ports.
So fix by doing the register fixups in the kernel and passing to userspace
only an abstract description of the PIO to be done.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Thu, 22 Feb 2007 10:58:31 +0000 (12:58 +0200)]
KVM: Use a shared page for kernel/user communication when runing a vcpu
Instead of passing a 'struct kvm_run' back and forth between the kernel and
userspace, allocate a page and allow the user to mmap() it. This reduces
needless copying and makes the interface expandable by providing lots of
free space.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Thu, 8 Mar 2007 09:48:09 +0000 (11:48 +0200)]
KVM: Fix bogus sign extension in mmu mapping audit
When auditing a 32-bit guest on a 64-bit host, sign extension of the page
table directory pointer table index caused bogus addresses to be shown on
audit errors.
Fix by declaring the index unsigned.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Wed, 7 Mar 2007 07:29:48 +0000 (09:29 +0200)]
KVM: Export <linux/kvm.h>
This allows users to actually build prgrams that use kvm without
the entire source tree.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Avi Kivity [Sun, 4 Mar 2007 11:27:36 +0000 (13:27 +0200)]
KVM: Use own minor number
Use the minor number (232) allocated to kvm by lanana.
Signed-off-by: Avi Kivity <avi@qumranet.com>
Dor Laor [Mon, 19 Feb 2007 16:25:43 +0000 (18:25 +0200)]
KVM: Use the generic skip_emulated_instruction() in hypercall code
Instead of twiddling the rip registers directly, use the
skip_emulated_instruction() function to do that for us.
Signed-off-by: Dor Laor <dor.laor@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Dor Laor [Mon, 19 Feb 2007 14:44:49 +0000 (16:44 +0200)]
KVM: Fix guest register corruption on paravirt hypercall
The hypercall code mixes up the ->cache_regs() and ->decache_regs()
callbacks, resulting in guest register corruption.
Signed-off-by: Dor Laor <dor.laor@qumranet.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Linus Torvalds [Tue, 1 May 2007 00:43:48 +0000 (17:43 -0700)]
libata: honour host controllers that want just one host
The Marvell IDE interface on my machine would hit a BUG_ON() in
lib/iomem.c because it was calling ata_pci_init_one() specifying just a
single port on the host, but that would actually end up trying to
initialize two ports, the second one with bogus information.
This fixes "ata_pci_init_one()" so that it actually passes down the
n_ports variable that it got from the low-level driver to the host
allocation routine ("ata_host_alloc_pinfo()"), which results in the ATA
layer actually having the correct port number information.
And in order to make it all work, I also needed to fix a few places that
had incorrectly hard-coded the fact that a host always had exactly two
ports (both ata_pci_init_bmdma() and ata_request_legacy_irqs() would
just always iterate over both ports).
Acked-by: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
David Rientjes [Mon, 30 Apr 2007 22:09:56 +0000 (15:09 -0700)]
pm: include EIO from errno-base.h
For backwards compatibility, call_platform_enable_wakeup() can return 0
instead of -EIO since we aren't guaranteed to have errno defined.
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: David Rientjes <rientjes@google.com>
Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeremy Fitzhardinge [Mon, 30 Apr 2007 22:09:56 +0000 (15:09 -0700)]
Add kvasprintf()
Add a kvasprintf() function to complement kasprintf().
No in-tree users yet, but I have some coming up.
[akpm@linux-foundation.org: EXPORT it]
Signed-off-by: Jeremy Fitzhardinge <jeremy@xensource.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Keir Fraser <keir@xensource.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Johannes Berg [Mon, 30 Apr 2007 22:09:55 +0000 (15:09 -0700)]
power management: force pm_ops.valid callback to be assigned
This patch changes the docs and behaviour from "all states valid" to "no
states valid" if no .valid callback is assigned. Users of pm_ops that only
need mem sleep can assign pm_valid_only_mem without any overhead, others
will require more elaborate callbacks.
Now that all users of pm_ops have a .valid callback this is a safe thing to
do and prevents things from getting messy again as they were before.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Pavel Machek <pavel@ucw.cz>
Looks-okay-to: Rafael J. Wysocki <rjw@sisk.pl>
Cc: <linux-pm@lists.linux-foundation.org>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Johannes Berg [Mon, 30 Apr 2007 22:09:54 +0000 (15:09 -0700)]
power management: implement pm_ops.valid for everybody
Almost all users of pm_ops only support mem sleep, don't check in .valid and
don't reject any others in .prepare so users can be confused if they check
/sys/power/state, especially when new states are added (these would then
result in s-t-r although they're supposed to be something different).
This patch implements a generic pm_valid_only_mem function that is then
exported for users and puts it to use in almost all existing pm_ops.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: David Brownell <david-b@pacbell.net>
Acked-by: Pavel Machek <pavel@ucw.cz>
Cc: linux-pm@lists.linux-foundation.org
Cc: Len Brown <lenb@kernel.org>
Acked-by: Russell King <rmk@arm.linux.org.uk>
Cc: Greg KH <greg@kroah.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Johannes Berg [Mon, 30 Apr 2007 22:09:53 +0000 (15:09 -0700)]
power management: remove firmware disk mode
This patch removes the firmware disk suspend mode which is the wrong approach,
it is supposed to be used for implementing firmware-based disk suspend but
cannot actually be used for that.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Acked-by: Pavel Machek <pavel@ucw.cz>
Cc: <linux-pm@lists.linux-foundation.org>
Cc: David Brownell <david-b@pacbell.net>
Cc: Len Brown <lenb@kernel.org>
Acked-by: Russell King <rmk@arm.linux.org.uk>
Cc: Greg KH <greg@kroah.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Johannes Berg [Mon, 30 Apr 2007 22:09:51 +0000 (15:09 -0700)]
rework pm_ops pm_disk_mode, kill misuse
This patch series cleans up some misconceptions about pm_ops. Some users of
the pm_ops structure attempt to use it to stop the user from entering suspend
to disk, this, however, is not possible since the user can always use
"shutdown" in /sys/power/disk and then the pm_ops are never invoked. Also,
platforms that don't support suspend to disk simply should not allow
configuring SOFTWARE_SUSPEND (read the help text on it, it only selects
suspend to disk and nothing else, all the other stuff depends on PM).
The pm_ops structure is actually intended to provide a way to enter
platform-defined sleep states (currently supported states are "standby" and
"mem" (suspend to ram)) and additionally (if SOFTWARE_SUSPEND is configured)
allows a platform to support a platform specific way to enter low-power mode
once everything has been saved to disk. This is currently only used by ACPI
(S4).
This patch:
The pm_ops.pm_disk_mode is used in totally bogus ways since nobody really
seems to understand what it actually does.
This patch clarifies the pm_disk_mode description.
It also removes all the arm and sh users that think they can veto suspend to
disk via pm_ops; not so since the user can always do echo shutdown >
/sys/power/disk, they need to find a better way involving Kconfig or such.
ACPI is the only user left with a non-zero pm_disk_mode.
The patch also sets the default mode to shutdown again, but when a new pm_ops
is registered its pm_disk_mode is selected as default, that way the default
stays for ACPI where it is apparently required.
Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: David Brownell <david-b@pacbell.net>
Acked-by: Pavel Machek <pavel@ucw.cz>
Cc: <linux-pm@lists.linux-foundation.org>
Cc: Len Brown <lenb@kernel.org>
Acked-by: Russell King <rmk@arm.linux.org.uk>
Cc: Greg KH <greg@kroah.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Jeff Mahoney [Mon, 30 Apr 2007 22:09:50 +0000 (15:09 -0700)]
reiserfs: suppress lockdep warning
We're getting lockdep warnings due to a post-2.6.21-rc7 bugfix.
The xattr_sem can never be taken in the manner described. Internal inodes
are protected by I_PRIVATE. Add the appropriate annotation.
Cc: <stable@kernel.org>
Cc: "Antonino A. Daplas" <adaplas@pol.net>
Cc: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Robert Peterson [Mon, 30 Apr 2007 22:09:48 +0000 (15:09 -0700)]
Extend print_symbol capability
Today's print_symbol function dumps a kernel symbol with printk. This
patch extends the functionality of kallsyms.c so that the symbol lookup
function may be used without the printk. This is useful for modules that
want to dump symbols elsewhere, for example, to debugfs. I intend to use
the new function call in the GFS2 file system (which will be a separate
patch).
[akpm@linux-foundation.org: build fix]
[clameter@sgi.com: sprint_symbol should return length of string like sprintf]
Signed-off-by: Robert Peterson <rpeterso@redhat.com>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Roman Zippel <zippel@linux-m68k.org>
Cc: "Randy.Dunlap" <rdunlap@xenotime.net>
Cc: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Paulo Marques <pmarques@grupopie.com>
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
David S. Miller [Mon, 30 Apr 2007 21:51:58 +0000 (14:51 -0700)]
[UDP]: Do not allow specific bind when wildcard bind exists.
When allocating local ports, do not allow a bind to a port
with a specific local address when a bind to that port with
a wildcard local address already exists.
Noticed by Linus.
Signed-off-by: David S. Miller <davem@davemloft.net>
David S. Miller [Mon, 30 Apr 2007 20:35:29 +0000 (13:35 -0700)]
[IPV4] UDP: Fix endianness bugs in hashing changes.
I accidently applied an earlier version of Eric Dumazet's patch, from
March 21st. His version from March 30th didn't have these bugs, so
this just interdiffs to the correct patch.
Signed-off-by: David S. Miller <davem@davemloft.net>
Linus Torvalds [Mon, 30 Apr 2007 15:59:57 +0000 (08:59 -0700)]
Merge branch 'for-linus' of git://git./linux/kernel/git/ieee1394/linux1394-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394/linux1394-2.6: (56 commits)
ieee1394: remove garbage from Kconfig
ieee1394: more help in Kconfig
ieee1394: ohci1394: Fix mistake in printk message.
ieee1394: ohci1394: remove unnecessary rcvPhyPkt bit flipping in LinkControl register
ieee1394: ohci1394: fix cosmetic problem in error logging
ieee1394: eth1394: send async streams at S100 on 1394b buses
ieee1394: eth1394: fix error path in module_init
ieee1394: eth1394: correct return codes in hard_start_xmit
ieee1394: eth1394: hard_start_xmit is called in atomic context
ieee1394: eth1394: some conditions are unlikely
ieee1394: eth1394: clean up fragment_overlap
ieee1394: eth1394: don't use alloc_etherdev
ieee1394: eth1394: omit useless set_mac_address callback
ieee1394: eth1394: CONFIG_INET is always defined
ieee1394: eth1394: allow MTU bigger than 1500
ieee1394: unexport highlevel_host_reset
ieee1394: eth1394: contain host reset
ieee1394: eth1394: shorter error messages
ieee1394: eth1394: correct a memset argument
ieee1394: eth1394: refactor .probe and .update
...
Linus Torvalds [Mon, 30 Apr 2007 15:58:21 +0000 (08:58 -0700)]
Merge branch 'for-linus' of /linux/kernel/git/jikos/hid
* 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jikos/hid: (21 commits)
USB HID: don't warn on idVendor == 0
USB HID: add 'quirks' module parameter
USB HID: add support for dynamically-created quirks
USB HID: clarify static quirk handling as squirks
USB HID: encapsulate quirk handling into hid-quirks.c
USB HID: EMS USBII device needs HID_QUIRK_MULTI_INPUT
HID: update copyright and authorship macro
HID: introduce proper zeroing of unused bits in output reports
USB HID: add support for WiseGroup MP-8800 Quad Joypad
USB HID: add FF support for Logitech Force 3D Pro Joystick
USB HID: numlock quirk for dell W7658 keyboard
USB HID: Logitech MX3000 keyboard needs report descriptor quirk
USB HID: extend quirk for Logitech S510 keyboard
USB HID: usbkbd/usbmouse - handle errors when registering devices
USB HID: add QUIRK_HIDDEV for Belkin Flip KVM
HID: enable dead keys on a belkin wireless keyboard
USB HID: Thustmaster firestorm dual power v1 support
USB HID: specify explicit size for hid_blacklist.quirks
USB HID: fix retry & reset logic
USB HID: consolidate vendor/product ids
...
Linus Torvalds [Mon, 30 Apr 2007 15:14:42 +0000 (08:14 -0700)]
Merge /pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (21 commits)
[IPV4] SNMP: Support OutMcastPkts and OutBcastPkts
[IPV4] SNMP: Support InMcastPkts and InBcastPkts
[IPV4] SNMP: Support InTruncatedPkts
[IPV4] SNMP: Support InNoRoutes
[SNMP]: Add definitions for {In,Out}BcastPkts
[TCP] FRTO: RFC4138 allows Nagle override when new data must be sent
[TCP] FRTO: Delay skb available check until it's mandatory
[XFRM]: Restrict upper layer information by bundle.
[TCP]: Catch skb with S+L bugs earlier
[PATCH] INET : IPV4 UDP lookups converted to a 2 pass algo
[L2TP]: Add the ability to autoload a pppox protocol module.
[SKB]: Introduce skb_queue_walk_safe()
[AF_IUCV/IUCV]: smp_call_function deadlock
[IPV6]: Fix slab corruption running ip6sic
[TCP]: Update references in two old comments
[XFRM]: Export SPD info
[IPV6]: Track device renames in snmp6.
[SCTP]: Fix sctp_getsockopt_local_addrs_old() to use local storage.
[NET]: Remove NETIF_F_INTERNAL_STATS, default to internal stats.
[NETPOLL]: Remove CONFIG_NETPOLL_RX
...
Linus Torvalds [Mon, 30 Apr 2007 15:12:39 +0000 (08:12 -0700)]
Merge branch 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block
* 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block:
[PATCH] elevator: elv_list_lock does not need irq disabling
[BLOCK] Don't pin lots of memory in mempools
cfq-iosched: speedup cic rb lookup
ll_rw_blk: add io_context private pointer
cfq-iosched: get rid of cfqq hash
cfq-iosched: tighten queue request overlap condition
cfq-iosched: improve sync vs async workloads
cfq-iosched: never allow an async queue idling
cfq-iosched: get rid of ->dispatch_slice
cfq-iosched: don't pass unused preemption variable around
cfq-iosched: get rid of ->cur_rr and ->cfq_list
cfq-iosched: slice offset should take ioprio into account
[PATCH] cfq-iosched: style cleanups and comments
cfq-iosched: sort IDLE queues into the rbtree
cfq-iosched: sort RT queues into the rbtree
[PATCH] cfq-iosched: speed up rbtree handling
cfq-iosched: rework the whole round-robin list concept
cfq-iosched: minor updates
cfq-iosched: development update
cfq-iosched: improve preemption for cooperating tasks
Linus Torvalds [Mon, 30 Apr 2007 15:10:12 +0000 (08:10 -0700)]
Merge branch 'for-2.6.22' of git://git./linux/kernel/git/paulus/powerpc
* 'for-2.6.22' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc: (255 commits)
[POWERPC] Remove dev_dbg redefinition in drivers/ps3/vuart.c
[POWERPC] remove kernel module option for booke wdt
[POWERPC] Avoid putting cpu node twice
[POWERPC] Spinlock initializer cleanup
[POWERPC] ppc4xx_sgdma needs dma-mapping.h
[POWERPC] arch/powerpc/sysdev/timer.c build fix
[POWERPC] get_property cleanups
[POWERPC] Remove the unused HTDMSOUND driver
[POWERPC] cell: cbe_cpufreq cleanup and crash fix
[POWERPC] Declare enable_kernel_spe in a header
[POWERPC] Add dt_xlate_addr() to bootwrapper
[POWERPC] bootwrapper: CONFIG_ -> CONFIG_DEVICE_TREE
[POWERPC] Don't define a custom bd_t for Xilixn Virtex based boards.
[POWERPC] Add sane defaults for Xilinx EDK generated xparameters files
[POWERPC] Add uartlite boot console driver for the zImage wrapper
[POWERPC] Stop using ppc_sys for Xilinx Virtex boards
[POWERPC] New registration for common Xilinx Virtex ppc405 platform devices
[POWERPC] Merge common virtex header files
[POWERPC] Rework Kconfig dependancies for Xilinx Virtex ppc405 platform
[POWERPC] Clean up cpufreq Kconfig dependencies
...
Mitsuru Chinen [Mon, 30 Apr 2007 07:48:20 +0000 (00:48 -0700)]
[IPV4] SNMP: Support OutMcastPkts and OutBcastPkts
A transmitted IP multicast datagram should be counted as OutMcastPkts.
By the same token, a transmitted IP broadcast datagram should be
counted as OutBcastPkts.
Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Mitsuru Chinen [Mon, 30 Apr 2007 07:48:10 +0000 (00:48 -0700)]
[IPV4] SNMP: Support InMcastPkts and InBcastPkts
A received IP multicast datagram should be counted as InMcastPkts.
By the same token, a received IP broadcast datagram should be
counted as InBcastPkts.
Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Mitsuru Chinen [Mon, 30 Apr 2007 07:46:30 +0000 (00:46 -0700)]
[IPV4] SNMP: Support InTruncatedPkts
An IP datagram which is being discarded because the datagram frame
didn't carry enough data should be counted as InTruncatedPkts.
Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Mitsuru Chinen [Mon, 30 Apr 2007 07:45:49 +0000 (00:45 -0700)]
[IPV4] SNMP: Support InNoRoutes
An IP datagram which is being discarded because of no routes in the
forwarding path should be counted as InNoRoutes.
Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Mitsuru Chinen [Mon, 30 Apr 2007 07:45:02 +0000 (00:45 -0700)]
[SNMP]: Add definitions for {In,Out}BcastPkts
The updated IP-MIB RFC (RFC4293) specifys new objects, InBcastPkts
and OutBcastPkts. This adds definitions for them.
Signed-off-by: Mitsuru Chinen <mitch@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Ilpo Järvinen [Mon, 30 Apr 2007 07:42:20 +0000 (00:42 -0700)]
[TCP] FRTO: RFC4138 allows Nagle override when new data must be sent
This is a corner case where less than MSS sized new data thingie
is awaiting in the send queue. For F-RTO to work correctly, a
new data segment must be sent at certain point or F-RTO cannot
be used at all. RFC4138 allows overriding of Nagle at that
point.
Implementation uses frto_counter states 2 and 3 to distinguish
when Nagle override is needed.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Ilpo Järvinen [Mon, 30 Apr 2007 07:39:55 +0000 (00:39 -0700)]
[TCP] FRTO: Delay skb available check until it's mandatory
No new data is needed until the first ACK comes, so no need to check
for application limitedness until then.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Masahide NAKAMURA [Mon, 30 Apr 2007 07:33:35 +0000 (00:33 -0700)]
[XFRM]: Restrict upper layer information by bundle.
On MIPv6 usage, XFRM sub policy is enabled.
When main (IPsec) and sub (MIPv6) policy selectors have the same
address set but different upper layer information (i.e. protocol
number and its ports or type/code), multiple bundle should be created.
However, currently we have issue to use the same bundle created for
the first time with all flows covered by the case.
It is useful for the bundle to have the upper layer information
to be restructured correctly if it does not match with the flow.
1. Bundle was created by two policies
Selector from another policy is added to xfrm_dst.
If the flow does not match the selector, it goes to slow path to
restructure new bundle by single policy.
2. Bundle was created by one policy
Flow cache is added to xfrm_dst as originated one. If the flow does
not match the cache, it goes to slow path to try searching another
policy.
Signed-off-by: Masahide NAKAMURA <nakam@linux-ipv6.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Ilpo Järvinen [Mon, 30 Apr 2007 07:57:33 +0000 (00:57 -0700)]
[TCP]: Catch skb with S+L bugs earlier
SACKED_ACKED and LOST are mutually exclusive with SACK, thus
having their sum larger than packets_out is bug with SACK.
Eventually these bugs trigger traps in the tcp_clean_rtx_queue
with SACK but it's much more informative to do this here.
Non-SACK TCP, however, could get more than packets_out duplicate
ACKs which each increment sacked_out, so it makes sense to do
this kind of limitting for non-SACK TCP but not for SACK enabled
one. Perhaps the author had the opposite in mind but did the
logic accidently wrong way around? Anyway, the sacked_out
incrementer code for non-SACK already deals this issue before
calling sync_left_out so this trapping can be done
unconditionally.
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Signed-off-by: David S. Miller <davem@davemloft.net>
Eric Dumazet [Mon, 30 Apr 2007 07:26:00 +0000 (00:26 -0700)]
[PATCH] INET : IPV4 UDP lookups converted to a 2 pass algo
Some people want to have many UDP sockets, binded to a single port but
many different addresses. We currently hash all those sockets into a
single chain. Processing of incoming packets is very expensive,
because the whole chain must be examined to find the best match.
I chose in this patch to hash UDP sockets with a hash function that
take into account both their port number and address : This has a
drawback because we need two lookups : one with a given address, one
with a wildcard (null) address.
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
James Chapman [Mon, 30 Apr 2007 07:21:02 +0000 (00:21 -0700)]
[L2TP]: Add the ability to autoload a pppox protocol module.
This patch allows a name "pppox-proto-nnn" to be used in modprobe.conf
to autoload a PPPoX protocol nnn.
Signed-off-by: James Chapman <jchapman@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Jens Axboe [Mon, 30 Apr 2007 07:09:27 +0000 (09:09 +0200)]
Merge branch 'cfq' into for-linus
Jens Axboe [Thu, 26 Apr 2007 12:41:53 +0000 (14:41 +0200)]
[PATCH] elevator: elv_list_lock does not need irq disabling
It's never grabbed from irq context, so just make it plain spin_lock().
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe [Mon, 2 Apr 2007 08:06:42 +0000 (10:06 +0200)]
[BLOCK] Don't pin lots of memory in mempools
Currently we scale the mempool sizes depending on memory installed
in the machine, except for the bio pool itself which sits at a fixed
256 entry pre-allocation.
There's really no point in "optimizing" this OOM path, we just need
enough preallocated to make progress. A single unit is enough, lets
scale it down to 2 just to be on the safe side.
This patch saves ~150kb of pinned kernel memory on a 32-bit box.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
James Chapman [Mon, 30 Apr 2007 07:07:31 +0000 (00:07 -0700)]
[SKB]: Introduce skb_queue_walk_safe()
This patch provides a method for walking skb lists while inserting or
removing skbs from the list.
Signed-off-by: James Chapman <jchapman@katalix.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Jens Axboe [Tue, 24 Apr 2007 19:23:53 +0000 (21:23 +0200)]
cfq-iosched: speedup cic rb lookup
We often lookup the same queue many times in succession, so cache
the last looked up queue to avoid browsing the rbtree.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe [Tue, 24 Apr 2007 19:17:33 +0000 (21:17 +0200)]
ll_rw_blk: add io_context private pointer
To be used by as/cfq as they see fit.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Vasily Tarasov [Wed, 25 Apr 2007 10:29:51 +0000 (12:29 +0200)]
cfq-iosched: get rid of cfqq hash
cfq hash is no more necessary. We always can get cfqq from io context.
cfq_get_io_context_noalloc() function is introduced, because we don't
want to allocate cic on merging and checking may_queue. In order to
identify sync queue we've used hash key = CFQ_KEY_ASYNC. Since hash is
eliminated we need to use other criterion: sync flag for queue is added.
In all places where we dig in rb_tree we're in current context, so no
additional locking is required.
Advantages of this patch: no additional memory for hash, no seeking in
hash, code is cleaner. But it is necessary now to seek cic in per-ioc
rbtree, but it is faster:
- most processes work only with few devices
- most systems have only few block devices
- it is a rb-tree
Signed-off-by: Vasily Tarasov <vtaras@openvz.org>
Changes by me:
- Merge into CFQ devel branch
- Get rid of cfq_get_io_context_noalloc()
- Fix various bugs with dereferencing cic->cfqq[] with offset other
than 0 or 1.
- Fix bug in cfqq setup, is_sync condition was reversed.
- Fix bug where only bio_sync() is used, we need to check for a READ too
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe [Fri, 20 Apr 2007 18:45:39 +0000 (20:45 +0200)]
cfq-iosched: tighten queue request overlap condition
For tagged devices, allow overlap of requests if the idle window
isn't enabled on the current active queue.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe [Mon, 23 Apr 2007 06:33:33 +0000 (08:33 +0200)]
cfq-iosched: improve sync vs async workloads
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe [Thu, 19 Apr 2007 12:32:26 +0000 (14:32 +0200)]
cfq-iosched: never allow an async queue idling
We don't enable it by default, don't let it get enabled during
runtime.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe [Mon, 23 Apr 2007 06:26:36 +0000 (08:26 +0200)]
cfq-iosched: get rid of ->dispatch_slice
We can track it fairly accurately locally, let the slice handling
take care of the rest.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe [Mon, 23 Apr 2007 06:25:00 +0000 (08:25 +0200)]
cfq-iosched: don't pass unused preemption variable around
We don't use it anymore in the slice expiry handling.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe [Thu, 19 Apr 2007 10:03:34 +0000 (12:03 +0200)]
cfq-iosched: get rid of ->cur_rr and ->cfq_list
It's only used for preemption now that the IDLE and RT queues also
use the rbtree. If we pass an 'add_front' variable to
cfq_service_tree_add(), we can set ->rb_key to 0 to force insertion
at the front of the tree.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe [Fri, 20 Apr 2007 12:18:00 +0000 (14:18 +0200)]
cfq-iosched: slice offset should take ioprio into account
Use the max_slice-cur_slice as the multipler for the insertion offset.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe [Thu, 26 Apr 2007 10:54:48 +0000 (12:54 +0200)]
[PATCH] cfq-iosched: style cleanups and comments
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe [Wed, 18 Apr 2007 18:13:32 +0000 (20:13 +0200)]
cfq-iosched: sort IDLE queues into the rbtree
Same treatment as the RT conversion, just put the sorted idle
branch at the end of the tree.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe [Wed, 18 Apr 2007 18:01:57 +0000 (20:01 +0200)]
cfq-iosched: sort RT queues into the rbtree
Currently CFQ does a linked insert into the current list for RT
queues. We can just factor the class into the rb insertion,
and then we don't have to treat RT queues in a special way. It's
faster, too.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe [Thu, 26 Apr 2007 10:53:50 +0000 (12:53 +0200)]
[PATCH] cfq-iosched: speed up rbtree handling
For cases where the rbtree is mainly used for sorting and min retrieval,
a nice speedup of the rbtree code is to maintain a cache of the leftmost
node in the tree.
Also spotted in the CFS CPU scheduler code.
Improved by Alan D. Brunelle <Alan.Brunelle@hp.com> by updating the
leftmost hint in cfq_rb_first() if it isn't set, instead of only
updating it on insert.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe [Fri, 20 Apr 2007 12:27:50 +0000 (14:27 +0200)]
cfq-iosched: rework the whole round-robin list concept
Drawing on some inspiration from the CFS CPU scheduler design, overhaul
the pending cfq_queue concept list management. Currently CFQ uses a
doubly linked list per priority level for sorting and service uses.
Kill those lists and maintain an rbtree of cfq_queue's, sorted by when
to service them.
This unfortunately means that the ionice levels aren't as strong
anymore, will work on improving those later. We only scale the slice
time now, not the number of times we service. This means that latency
is better (for all priority levels), but that the distinction between
the highest and lower levels aren't as big.
The diffstat speaks for itself.
cfq-iosched.c | 363 +++++++++++++++++---------------------------------
1 file changed, 125 insertions(+), 238 deletions(-)
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe [Tue, 17 Apr 2007 10:47:55 +0000 (12:47 +0200)]
cfq-iosched: minor updates
- Move the queue_new flag clear to when the queue is selected
- Only select the non-first queue in cfq_get_best_queue(), if there's
a substantial difference between the best and first.
- Get rid of ->busy_rr
- Only select a close cooperator, if the current queue is known to take
a while to "think".
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe [Wed, 25 Apr 2007 10:44:27 +0000 (12:44 +0200)]
cfq-iosched: development update
- Implement logic for detecting cooperating processes, so we
choose the best available queue whenever possible.
- Improve residual slice time accounting.
- Remove dead code: we no longer see async requests coming in on
sync queues. That part was removed a long time ago. That means
that we can also remove the difference between cfq_cfqq_sync()
and cfq_cfqq_class_sync(), they are now indentical. And we can
kill the on_dispatch array, just make it a counter.
- Allow a process to go into the current list, if it hasn't been
serviced in this scheduler tick yet.
Possible future improvements including caching the cfqq lookup
in cfq_close_cooperator(), so we don't have to look it up twice.
cfq_get_best_queue() should just use that last decision instead
of doing it again.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Jens Axboe [Wed, 14 Feb 2007 18:59:49 +0000 (19:59 +0100)]
cfq-iosched: improve preemption for cooperating tasks
When testing the syslet async io approach, I discovered that CFQ
sometimes didn't perform as well as expected. cfq_should_preempt()
needs to better check for cooperating tasks, so fix that by allowing
preemption of an equal priority queue if the recently queued request
is as good a candidate for IO as the one we are currently waiting for.
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
Paul Mackerras [Mon, 30 Apr 2007 03:03:39 +0000 (13:03 +1000)]
[POWERPC] Remove dev_dbg redefinition in drivers/ps3/vuart.c
Commit
404d5b185b4eb56d6fa2f7bd27833f8df1c38ce4 changed the definition
of dev_dbg in the !DEBUG case from being a #define to being a static
inline. There was code in drivers/ps3/vuart.c to do exactly that,
which fails to compile now. This fixes it by removing the redefinition,
as the redefinition is now superfluous.
Signed-off-by: Paul Mackerras <paulus@samba.org>
Paul Mackerras [Mon, 30 Apr 2007 02:38:01 +0000 (12:38 +1000)]
Merge branch 'linux-2.6' into for-2.6.22
Dave Jiang [Fri, 13 Apr 2007 22:25:24 +0000 (08:25 +1000)]
[POWERPC] remove kernel module option for booke wdt
Remove option of making booke_wdt into a kernel module. This watchdog
cannot be disabled. No point being a kernel module.
Signed-off-by: Dave Jiang <djiang@mvista.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
John Rigby [Fri, 6 Apr 2007 22:57:37 +0000 (08:57 +1000)]
[POWERPC] Avoid putting cpu node twice
Call of_find_node_by_type with NULL instead of np
so the cpu node does not get put twice.
This was causing kref_put warnings.
Signed-off-by: John Rigby <jrigby@freescale.com>
Acked-by: Sylvain Munaut <tnt@246tNt.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
Thomas Gleixner [Sun, 29 Apr 2007 16:10:39 +0000 (16:10 +0000)]
[POWERPC] Spinlock initializer cleanup
Use DEFINE_SPINLOCK instead of initializing spinlocks to
SPIN_LOCK_UNLOCKED, since DEFINE_SPINLOCK is better for lockdep.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Paul Mackerras <paulus@samba.org>