linux-2.6
17 years agoKVM: Don't require explicit indication of completion of mmio or pio
Avi Kivity [Sun, 29 Apr 2007 12:02:17 +0000 (15:02 +0300)] 
KVM: Don't require explicit indication of completion of mmio or pio

It is illegal not to return from a pio or mmio request without completing
it, as mmio or pio is an atomic operation.  Therefore, we can simplify
the userspace interface by avoiding the completion indication.

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Remove extraneous guest entry on mmio read
Avi Kivity [Wed, 14 Mar 2007 13:54:54 +0000 (15:54 +0200)] 
KVM: Remove extraneous guest entry on mmio read

When emulating an mmio read, we actually emulate twice: once to determine
the physical address of the mmio, and, after we've exited to userspace to
get the mmio value, we emulate again to place the value in the result
register and update any flags.

But we don't really need to enter the guest again for that, only to take
an immediate vmexit.  So, if we detect that we're doing an mmio read,
emulate a single instruction before entering the guest again.

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: SVM: Only save/restore MSRs when needed
Anthony Liguori [Sun, 29 Apr 2007 08:56:06 +0000 (11:56 +0300)] 
KVM: SVM: Only save/restore MSRs when needed

We only have to save/restore MSR_GS_BASE on every VMEXIT.  The rest can be
saved/restored when we leave the VCPU.  Since we don't emulate the DEBUGCTL
MSRs and the guest cannot write to them, we don't have to worry about
saving/restoring them at all.

This shaves a whopping 40% off raw vmexit costs on AMD.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: fix an if() condition
Adrian Bunk [Sat, 28 Apr 2007 19:20:48 +0000 (21:20 +0200)] 
KVM: fix an if() condition

It might have worked in this case since PT_PRESENT_MASK is 1, but let's
express this correctly.

Signed-off-by: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: VMX: Add lazy FPU support for VT
Anthony Liguori [Fri, 27 Apr 2007 06:29:49 +0000 (09:29 +0300)] 
KVM: VMX: Add lazy FPU support for VT

Only save/restore the FPU host state when the guest is actually using the
FPU.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: VMX: Properly shadow the CR0 register in the vcpu struct
Anthony Liguori [Fri, 27 Apr 2007 06:29:21 +0000 (09:29 +0300)] 
KVM: VMX: Properly shadow the CR0 register in the vcpu struct

Set all of the host mask bits for CR0 so that we can maintain a proper
shadow of CR0.  This exposes CR0.TS, paving the way for lazy fpu handling.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Don't complain about cpu erratum AA15
Avi Kivity [Wed, 25 Apr 2007 07:59:52 +0000 (10:59 +0300)] 
KVM: Don't complain about cpu erratum AA15

It slows down Windows x64 horribly.

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Lazy FPU support for SVM
Anthony Liguori [Mon, 23 Apr 2007 14:17:21 +0000 (09:17 -0500)] 
KVM: Lazy FPU support for SVM

Avoid saving and restoring the guest fpu state on every exit.  This
shaves ~100 cycles off the guest/host switch.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Allow passing 64-bit values to the emulated read/write API
Avi Kivity [Sun, 22 Apr 2007 12:28:19 +0000 (15:28 +0300)] 
KVM: Allow passing 64-bit values to the emulated read/write API

This simplifies the API somewhat (by eliminating the special-case
cmpxchg8b on i386).

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Per-vcpu statistics
Avi Kivity [Thu, 19 Apr 2007 14:27:43 +0000 (17:27 +0300)] 
KVM: Per-vcpu statistics

Make the exit statistics per-vcpu instead of global.  This gives a 3.5%
boost when running one virtual machine per core on my two socket dual core
(4 cores total) machine.

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: VMX: Avoid unnecessary vcpu_load()/vcpu_put() cycles
Yaozu Dong [Wed, 25 Apr 2007 13:49:19 +0000 (16:49 +0300)] 
KVM: VMX: Avoid unnecessary vcpu_load()/vcpu_put() cycles

By checking if a reschedule is needed, we avoid dropping the vcpu.

[With changes by me, based on Anthony Liguori's observations]

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: MMU: Avoid heavy ASSERT at non debug mode.
Yaozu Dong [Wed, 25 Apr 2007 06:17:25 +0000 (14:17 +0800)] 
KVM: MMU: Avoid heavy ASSERT at non debug mode.

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: VMX: Only save/restore MSR_K6_STAR if necessary
Avi Kivity [Thu, 19 Apr 2007 11:28:44 +0000 (14:28 +0300)] 
KVM: VMX: Only save/restore MSR_K6_STAR if necessary

Intel hosts only support syscall/sysret in long more (and only if efer.sce
is enabled), so only reload the related MSR_K6_STAR if the guest will
actually be able to use it.

This reduces vmexit cost by about 500 cycles (6400 -> 5870) on my setup.

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Fold drivers/kvm/kvm_vmx.h into drivers/kvm/vmx.c
Avi Kivity [Thu, 19 Apr 2007 10:26:39 +0000 (13:26 +0300)] 
KVM: Fold drivers/kvm/kvm_vmx.h into drivers/kvm/vmx.c

No meat in that file.

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: VMX: Don't switch 64-bit msrs for 32-bit guests
Avi Kivity [Thu, 19 Apr 2007 10:22:48 +0000 (13:22 +0300)] 
KVM: VMX: Don't switch 64-bit msrs for 32-bit guests

Some msrs are only used by x86_64 instructions, and are therefore
not needed when the guest is legacy mode.  By not bothering to switch
them, we reduce vmexit latency by 2400 cycles (from about 8800) when
running a 32-bt guest on a 64-bit host.

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: VMX: Reduce unnecessary saving of host msrs
Avi Kivity [Tue, 17 Apr 2007 12:30:24 +0000 (15:30 +0300)] 
KVM: VMX: Reduce unnecessary saving of host msrs

THe automatically switched msrs are never changed on the host (with
the exception of MSR_KERNEL_GS_BASE) and thus there is no need to save
them on every vm entry.

This reduces vmexit latency by ~400 cycles on i386 and by ~900 cycles (10%)
on x86_64.

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Handle guest page faults when emulating mmio
Avi Kivity [Tue, 17 Apr 2007 07:53:22 +0000 (10:53 +0300)] 
KVM: Handle guest page faults when emulating mmio

Usually, guest page faults are detected by the kvm page fault handler,
which detects if they are shadow faults, mmio faults, pagetable faults,
or normal guest page faults.

However, in ceratin circumstances, we can detect a page fault much later.
One of these events is the following combination:

- A two memory operand instruction (e.g. movsb) is executed.
- The first operand is in mmio space (which is the fault reported to kvm)
- The second operand is in an ummaped address (e.g. a guest page fault)

The Windows 2000 installer does such an access, an promptly hangs.  Fix
by adding the missing page fault injection on that path.

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: SVM: Report hardware exit reason to userspace instead of dmesg
Avi Kivity [Mon, 16 Apr 2007 11:28:40 +0000 (14:28 +0300)] 
KVM: SVM: Report hardware exit reason to userspace instead of dmesg

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Retry sleeping allocation if atomic allocation fails
Avi Kivity [Mon, 16 Apr 2007 08:53:17 +0000 (11:53 +0300)] 
KVM: Retry sleeping allocation if atomic allocation fails

This avoids -ENOMEM under memory pressure.

Signed-off-by: Avi Kivity <avi@qumranet.com>
17 years agoKVM: Use slab caches to allocate mmu data structures
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>
17 years agoKVM: Handle partial pae pdptr
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>
17 years agoKVM: Initialize cr0 to indicate an fpu is present
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>
17 years agoKVM: Fix overflow bug in overflow detection code
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>
17 years agoKVM: Use kernel-standard types
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>
17 years agoKVM: SVM: enable LBRV virtualization if available
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>
17 years agoKVM: Add fpu get/set operations
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>
17 years agoKVM: Add physical memory aliasing feature
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>
17 years agoKVM: Simply gfn_to_page()
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>
17 years agoKVM: Add mmu cache clear function
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>
17 years agoKVM: x86 emulator: fix bit string operations operand size
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>
17 years agoKVM: Remove debug message
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>
17 years agoKVM: Use list_move()
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>
17 years agoKVM: Remove unused function
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>
17 years agoKVM: SVM: Ensure timestamp counter monotonicity
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>
17 years agoKVM: MMU: Fix hugepage pdes mapping same physical address with different access
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>
17 years agoKVM: SVM: forbid guest to execute monitor/mwait
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>
17 years agoKVM: Handle writes to MCG_STATUS msr
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>
17 years agoKVM: Remove unused and write-only variables
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>
17 years agoKVM: Don't allow the guest to turn off the cpu cache
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>
17 years agoKVM: Hack real-mode segments on vmx from KVM_SET_SREGS
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>
17 years agoKVM: Modify guest segments after potentially switching modes
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>
17 years agoKVM: Remove set_cr0_no_modeswitch() arch op
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>
17 years agoKVM: Workaround vmx inability to virtualize the reset state
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>
17 years agoKVM: MMU: Remove global pte tracking
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>
17 years agoKVM: MMU: Remove unnecessary check for pdptr access
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>
17 years agoKVM: Avoid guest virtual addresses in string pio userspace interface
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>
17 years agoKVM: Future-proof argument-less ioctls
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>
17 years agoKVM: Allow kernel to select size of mmap() buffer
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>
17 years agoKVM: Add guest mode signal mask
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>
17 years agoKVM: Initialize the apic_base msr on svm too
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>
17 years agoKVM: Add a special exit reason when exiting due to an interrupt
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>
17 years agoKVM: Fold kvm_run::exit_type into kvm_run::exit_reason
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>
17 years agoKVM: Allow userspace to process hypercalls which have no kernel handler
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>
17 years agoKVM: Add method to check for backwards-compatible API extensions
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>
17 years agoKVM: Renumber ioctls
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>
17 years agoKVM: Remove minor wart from KVM_CREATE_VCPU ioctl
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>
17 years agoKVM: Remove the 'emulated' field from the userspace interface
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>
17 years agoKVM: Handle cpuid in the kernel instead of punting to userspace
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>
17 years agoKVM: Do not communicate to userspace through cpu registers during PIO
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>
17 years agoKVM: Use a shared page for kernel/user communication when runing a vcpu
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>
17 years agoKVM: Fix bogus sign extension in mmu mapping audit
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>
17 years agoKVM: Export <linux/kvm.h>
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>
17 years agoKVM: Use own minor number
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>
17 years agoKVM: Use the generic skip_emulated_instruction() in hypercall code
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>
17 years agoKVM: Fix guest register corruption on paravirt hypercall
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>
17 years agolibata: honour host controllers that want just one host
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>
17 years agopm: include EIO from errno-base.h
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>
17 years agoAdd kvasprintf()
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>
17 years agopower management: force pm_ops.valid callback to be assigned
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>
17 years agopower management: implement pm_ops.valid for everybody
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>
17 years agopower management: remove firmware disk mode
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>
17 years agorework pm_ops pm_disk_mode, kill misuse
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>
17 years agoreiserfs: suppress lockdep warning
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>
17 years agoExtend print_symbol capability
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>
17 years ago[UDP]: Do not allow specific bind when wildcard bind exists.
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>
17 years ago[IPV4] UDP: Fix endianness bugs in hashing changes.
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>
17 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394...
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
  ...

17 years agoMerge branch 'for-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jikos/hid
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
  ...

17 years agoMerge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
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
  ...

17 years agoMerge branch 'for-linus' of git://git.kernel.dk/data/git/linux-2.6-block
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

17 years agoMerge branch 'for-2.6.22' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus...
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
  ...

17 years ago[IPV4] SNMP: Support OutMcastPkts and OutBcastPkts
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>
17 years ago[IPV4] SNMP: Support InMcastPkts and InBcastPkts
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>
17 years ago[IPV4] SNMP: Support InTruncatedPkts
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>
17 years ago[IPV4] SNMP: Support InNoRoutes
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>
17 years ago[SNMP]: Add definitions for {In,Out}BcastPkts
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>
17 years ago[TCP] FRTO: RFC4138 allows Nagle override when new data must be sent
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>
17 years ago[TCP] FRTO: Delay skb available check until it's mandatory
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>
17 years ago[XFRM]: Restrict upper layer information by bundle.
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>
17 years ago[TCP]: Catch skb with S+L bugs earlier
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>
17 years ago[PATCH] INET : IPV4 UDP lookups converted to a 2 pass algo
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>
17 years ago[L2TP]: Add the ability to autoload a pppox protocol module.
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>
17 years agoMerge branch 'cfq' into for-linus
Jens Axboe [Mon, 30 Apr 2007 07:09:27 +0000 (09:09 +0200)] 
Merge branch 'cfq' into for-linus

17 years ago[PATCH] elevator: elv_list_lock does not need irq disabling
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>
17 years ago[BLOCK] Don't pin lots of memory in mempools
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>
17 years ago[SKB]: Introduce skb_queue_walk_safe()
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>
17 years agocfq-iosched: speedup cic rb lookup
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>
17 years agoll_rw_blk: add io_context private pointer
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>
17 years agocfq-iosched: get rid of cfqq hash
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>
17 years agocfq-iosched: tighten queue request overlap condition
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>