]> git.karo-electronics.de Git - karo-tx-linux.git/log
karo-tx-linux.git
13 years agokvm tools: Implement VIRTIO_BLK_T_GET_ID
Sasha Levin [Sat, 16 Jul 2011 09:28:23 +0000 (12:28 +0300)]
kvm tools: Implement VIRTIO_BLK_T_GET_ID

Return device id when requested by virtio-blk.
Device id is currently based on the device information and the inode
number of the underlying disk image.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Use writev() in xwritev()
Pekka Enberg [Tue, 12 Jul 2011 18:42:21 +0000 (21:42 +0300)]
kvm tools: Use writev() in xwritev()

This patch fixes a typo in xwritev(). Luckily the function is not used so the
problem is only latent. Spotted during code review.

Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Update README
Sasha Levin [Tue, 12 Jul 2011 14:34:33 +0000 (17:34 +0300)]
kvm tools: Update README

Update required kernel config options and git info.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, bios: Make sure IRQ handlers segment is properly set
Cyrill Gorcunov [Sun, 10 Jul 2011 21:52:53 +0000 (01:52 +0400)]
kvm tools, bios: Make sure IRQ handlers segment is properly set

The mini bios is copied at predefined place and should have
constant segment address.

Without this patch cs value varies depending on which code
is compiled and how big bios is, it's kinda flowing error
which is not triggered yet by a pure luck.

Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, 9p: WSTAT don't use open fid
Aneesh Kumar K.V [Sun, 10 Jul 2011 18:23:21 +0000 (23:53 +0530)]
kvm tools, 9p: WSTAT don't use open fid

We should use full path instead of fd. WSTAT can operate on
unopen fid.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, 9p: Add error handling to protocol handlers
Aneesh Kumar K.V [Sun, 10 Jul 2011 17:59:16 +0000 (23:29 +0530)]
kvm tools, 9p: Add error handling to protocol handlers

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Fix leaked descriptors
Sasha Levin [Sun, 10 Jul 2011 12:41:55 +0000 (15:41 +0300)]
kvm tools: Fix leaked descriptors

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, qcow: I/O error on compressed sectors
Pekka Enberg [Sun, 10 Jul 2011 12:36:11 +0000 (15:36 +0300)]
kvm tools, qcow: I/O error on compressed sectors

We currently don't support compressed sectors in QCOW images so warn the user
about it and return a I/O error.

Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, qcow: Flush only dirty L2 tables
Pekka Enberg [Sat, 9 Jul 2011 12:15:52 +0000 (15:15 +0300)]
kvm tools, qcow: Flush only dirty L2 tables

This patch improves qcow_l2_cache_write() to only flush dirty L2 tables.

Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, qcow: Delayed L2 table writeout
Pekka Enberg [Sat, 9 Jul 2011 07:58:37 +0000 (10:58 +0300)]
kvm tools, qcow: Delayed L2 table writeout

This patch delays writeout for new L2 tables like we do for L1 tables. If a L2
table has non-allocated clusters, we mark that in the in-memory L2 table but
don't actually write it to disk until the L2 table is thrown out of LRU cache
or when qcow_disk_flush() is called. That makes writes to new clusters volatile
before VIRTIO_BLK_T_FLUSH is issued without corrupting the QCOW image on I/O
error.

Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, qcow: Use big endian order for L2 table entries
Pekka Enberg [Sat, 9 Jul 2011 07:49:16 +0000 (10:49 +0300)]
kvm tools, qcow: Use big endian order for L2 table entries

Don't keep the in-memory array in CPU byte order to simplify delayed L2 table
writeout.

Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, qcow: Don't fdatasync() L2 table writeout
Pekka Enberg [Sat, 9 Jul 2011 07:37:58 +0000 (10:37 +0300)]
kvm tools, qcow: Don't fdatasync() L2 table writeout

There's now now point in making sure new L2 tables actually hit the disk before
we write out data to clusters because they are not visible on-disk until
qcow_disk_flush() is called which flushes the L1 table.

Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, qcow: Delayed L1 table writeout
Pekka Enberg [Sat, 9 Jul 2011 07:23:07 +0000 (10:23 +0300)]
kvm tools, qcow: Delayed L1 table writeout

This patch moves L1 table writeout to qcow_disk_flush(). The rationale here is
that while writes to clusters that don't have L2 table allocated on-disk are
volatile until VIRTIO_BLK_T_FLUSH is issued, we never corrupt the disk image.

Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, qcow: Introduce qcow_disk_flush()
Pekka Enberg [Sat, 9 Jul 2011 07:15:12 +0000 (10:15 +0300)]
kvm tools, qcow: Introduce qcow_disk_flush()

This patch introduces a QCOW specific qcow_disk_flush() in preparation for
delaying QCOW metadata writeout until VIRTIO_BLK_T_FLUSH time.

Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, qcow: Fix locking issues
Pekka Enberg [Sat, 9 Jul 2011 11:04:12 +0000 (14:04 +0300)]
kvm tools, qcow: Fix locking issues

The virtio_blk_do_io() function can enter the QCOW code through
disk_image__{read,write,flush}() from multiple threads because it uses a thread
pool for I/O requests. Thus, use locking to make the QCOW2 code thread-safe.

Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, qcow: Use 'struct qcow_l2_table' instead of untyped array
Pekka Enberg [Sat, 9 Jul 2011 11:23:47 +0000 (14:23 +0300)]
kvm tools, qcow: Use 'struct qcow_l2_table' instead of untyped array

This patch converts disk/qcow.c to use 'struct qcow_l2_table' for tracking
dirty L2 tables later on in this series.

Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools, qcow: Rename struct qcow_l2_cache to struct qcow_l2_table
Pekka Enberg [Sat, 9 Jul 2011 11:13:51 +0000 (14:13 +0300)]
kvm tools, qcow: Rename struct qcow_l2_cache to struct qcow_l2_table

This patch renames 'struct qcow_l2_cache' to 'struct qcow_l2_table' in
preparation for replacing the untyped L2 table arrays with the struct.

Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Prasad Joshi <prasadjoshi124@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: fix instances enumeration
Konstantin Khlebnikov [Sun, 10 Jul 2011 12:13:27 +0000 (16:13 +0400)]
kvm tools: fix instances enumeration

Calling readdir() with NULL dirp leads to segfault.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@openvz.org>
[ penberg@kernel.org: use 'while' instead of 'for' ]
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Move uip to net directory
Asias He [Sat, 9 Jul 2011 23:58:19 +0000 (07:58 +0800)]
kvm tools: Move uip to net directory

This mirrors what the kernel already has.

Suggested-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Make virtio net work on older kernels
Asias He [Sat, 9 Jul 2011 23:58:18 +0000 (07:58 +0800)]
kvm tools: Make virtio net work on older kernels

Some old kernels do not support TUNSETVNETHDRSZ ioctl which modifies the virtio
net header size. The default header size should work, so let's go on if the
TUNSETVNETHDRSZ ioctl is not supported and just give a warnning.

Reported-by: John Floren <john@jfloren.net>
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add KVMTOOLS-VERSION-FILE to .gitignore
Pekka Enberg [Sat, 9 Jul 2011 07:12:30 +0000 (10:12 +0300)]
kvm tools: Add KVMTOOLS-VERSION-FILE to .gitignore

Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Rename debug options under 'kvm run'
Sasha Levin [Sat, 9 Jul 2011 06:57:30 +0000 (09:57 +0300)]
kvm tools: Rename debug options under 'kvm run'

Rename debug options to make them consistent with each other.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Rename command source files
Sasha Levin [Sat, 9 Jul 2011 06:57:29 +0000 (09:57 +0300)]
kvm tools: Rename command source files

Rename kvm-[command] into builtin-[command] to prevent
clashes with non-command files such as kvm-cpu.h

Suggested-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Don't sort command-list.txt for help text
Pekka Enberg [Fri, 8 Jul 2011 22:25:28 +0000 (01:25 +0300)]
kvm tools: Don't sort command-list.txt for help text

This patch removes the alphabetical sorting from util/generate-cmdlist.h so
that 'kvm run' command, for example, is displayed first:

  $ ./kvm

   usage: kvm [--version] [--help] COMMAND [ARGS]

   The most commonly used kvm commands are:
     run       Start the virtual machine
     pause     Pause/resume the virtual machine
     version   Print the version of the kernel tree kvm tools
     list      Print a list of running instances on the host.
     debug     Print debug information from a running instance
     balloon   Inflate or deflate the virtio balloon

   See 'kvm help COMMAND' for more information on a specific command.

Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Properly add 'kvm balloon' to command list
Sasha Levin [Fri, 8 Jul 2011 21:56:12 +0000 (00:56 +0300)]
kvm tools: Properly add 'kvm balloon' to command list

Also adds some documentation.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Update 'kvm pause' documentation
Sasha Levin [Fri, 8 Jul 2011 21:56:11 +0000 (00:56 +0300)]
kvm tools: Update 'kvm pause' documentation

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Properly add 'kvm debug' to command list
Sasha Levin [Fri, 8 Jul 2011 21:56:10 +0000 (00:56 +0300)]
kvm tools: Properly add 'kvm debug' to command list

Also adds some basic documentation.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Properly add 'kvm list' to command list
Sasha Levin [Fri, 8 Jul 2011 21:56:09 +0000 (00:56 +0300)]
kvm tools: Properly add 'kvm list' to command list

Also adds some basic documentation.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add 'kvm version' command
Sasha Levin [Fri, 8 Jul 2011 21:56:08 +0000 (00:56 +0300)]
kvm tools: Add 'kvm version' command

Add a 'kvm version' command which prints the version of the kernel
used to build kvm tools.

Part of the code is based on and was loaned from perf.

Suggested-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Fix guest single-stepping setup
Pekka Enberg [Thu, 7 Jul 2011 18:12:45 +0000 (21:12 +0300)]
kvm tools: Fix guest single-stepping setup

"K. Watts" writes:

  When the singlestep is enabled the ioctl to sent out when the kvm_cpu
  is initialized (kvm-cpu.c in the for loop that gets each vcpu built).
  When the ioct goes out the CPU is sitting at the initialization vector
  of 0xf000:0xfff0 on CPU #0 and 0x000000 on the other SMP CPUs.  The
  new host kernel code that handles setting the TF was changed in 2.6.32
  and again at 2.6.38.  2.6.32 seems just flat broken, but 2.6.38 checks
  that the linear address of the RIP matches what it was when the
  KVM_GUESTDBG_SINGLESTEP flag was set.  Because the kvm-tool doesn't
  start the CPU at the initialization vector (0xfff0) (0x7c00 for the
  MBR and where ever you guys map the linux kernel to) they don't match
  and the host kernel won't set the trap flag.

  Basically the debug and singlestep ioclts need to happen after the CPU
  has been initialized.  I moved kvm_cpu__enable_singlestep to happen in
  kvm_cpu__reset_vcpu after the registers are set (EIP points to boot
  address) and the TRAP flags get set and all is good with the world.

  Singlestepping is disabled when the guest issues a CLI because the
  Linux host doesn't support features in new Intel and AMD CPUs.  We can
  sort of "shadow" the interrupt mask and still get the CPU to trap out
  at ever instruction even when the guest has disabled interrupts on the
  CPU.  I have to get the bios disk handler working completely first,
  but that may be my next task so that we can trace all the CPU
  instructions.  My current hack is to just re-enable the trap flag
  every time a VMEXIT occurs.  I get enough instructions to get me by.

This patch fixes the problem by moving the kvm_cpu__enable_singlestep() into
kvm_cpu__start().

Suggested-by: K. Watts <traetox@gmail.com>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Clean ghost pid files in 'kvm list'
Sasha Levin [Tue, 5 Jul 2011 09:35:45 +0000 (12:35 +0300)]
kvm tools: Clean ghost pid files in 'kvm list'

When running 'kvm list', first make sure that the guest process
is up and running before printing the entry.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Export kvm__remove_pidfile
Sasha Levin [Tue, 5 Jul 2011 09:35:44 +0000 (12:35 +0300)]
kvm tools: Export kvm__remove_pidfile

This will allow cleaning up ghost pid files outside of the module.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Allow pausing and debugging all running instances
Sasha Levin [Sun, 3 Jul 2011 15:38:10 +0000 (18:38 +0300)]
kvm tools: Allow pausing and debugging all running instances

Add a 'kvm [debug,pause] all' command to allow pausing or debugging
all running guests on a host.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add 'kvm list' command
Sasha Levin [Sun, 3 Jul 2011 15:38:09 +0000 (18:38 +0300)]
kvm tools: Add 'kvm list' command

Use 'kvm list' to list running virtual guest.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add instance enumerator
Sasha Levin [Sun, 3 Jul 2011 15:38:08 +0000 (18:38 +0300)]
kvm tools: Add instance enumerator

Add API kvm__enumerate_instances() to enumerate running guest
instances.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Give guest instances default name
Sasha Levin [Sun, 3 Jul 2011 15:38:07 +0000 (18:38 +0300)]
kvm tools: Give guest instances default name

Name instances which aren't specifically named by the user (using
the --name flag) with the following pattern: 'guest-<pid>'

Suggested-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Fix home dir resolution
Sasha Levin [Sun, 3 Jul 2011 15:38:06 +0000 (18:38 +0300)]
kvm tools: Fix home dir resolution

Previous code didn't properly resolve home directory.
Resolve user's home dir using the $HOME enviroment variable.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agoMerge commit 'v3.0-rc5' into kvm/core
Pekka Enberg [Sat, 2 Jul 2011 10:53:10 +0000 (13:53 +0300)]
Merge commit 'v3.0-rc5' into kvm/core

13 years agokvm tools: Stop VCPUs before freeing struct kvm
Sasha Levin [Sat, 2 Jul 2011 23:52:11 +0000 (02:52 +0300)]
kvm tools: Stop VCPUs before freeing struct kvm

Not stopping VCPUs before leads to seg faults and other errors due to
synchronization between threads.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add 'kvm balloon' command
Sasha Levin [Sat, 2 Jul 2011 23:52:10 +0000 (02:52 +0300)]
kvm tools: Add 'kvm balloon' command

Add a command to allow easily inflate/deflate the balloon driver in running
instances.

Usage:
kvm balloon [command] [instance name] [size]

command is either inflate or deflate, and size is represented in MB.
Target instance must be named (started with '--name').

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Advise memory allocated for guest RAM as KSM mergable
Sasha Levin [Sat, 2 Jul 2011 23:52:09 +0000 (02:52 +0300)]
kvm tools: Advise memory allocated for guest RAM as KSM mergable

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add virtio-balloon device
Sasha Levin [Sat, 2 Jul 2011 23:52:08 +0000 (02:52 +0300)]
kvm tools: Add virtio-balloon device

From the virtio spec:

The virtio memory balloon device is a primitive device for managing guest
memory: the device asks for a certain amount of memory, and the guest supplies
it (or withdraws it, if the device has more than it asks for). This allows the
guest to adapt to changes in allowance of underlying physical memory.

To activate the virtio-balloon device run kvm tools with the '--balloon'
command line parameter.

Current implementation listens for two signals:

 - SIGKVMADDMEM: Adds 1M to the balloon driver (inflate). This will decrease
available memory within the guest.
 - SIGKVMDELMEM: Remove 1M from the balloon driver (deflate). This will
increase available memory within the guest.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Provide instance name when running 'kvm pause'
Sasha Levin [Sat, 2 Jul 2011 23:52:07 +0000 (19:52 -0400)]
kvm tools: Provide instance name when running 'kvm pause'

Instead of sending a signal to the first instance found, send it
to a specific instance.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Provide instance name when running 'kvm debug'
Sasha Levin [Sat, 2 Jul 2011 23:52:06 +0000 (19:52 -0400)]
kvm tools: Provide instance name when running 'kvm debug'

Instead of sending a signal to the first instance found, send it
to a specific instance.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Allow giving instance names
Sasha Levin [Sat, 2 Jul 2011 23:52:05 +0000 (19:52 -0400)]
kvm tools: Allow giving instance names

This will allow tracking instance names and sending commands
to specific instances if multiple instances are running.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Process virtio-blk requests in parallel
Sasha Levin [Sat, 2 Jul 2011 23:52:04 +0000 (19:52 -0400)]
kvm tools: Process virtio-blk requests in parallel

Process multiple requests within a virtio-blk device's vring
in parallel.

Doing so may improve performance in cases when a request which can
be completed using data which is present in a cache is queued after
a request with un-cached data.

bonnie++ benchmarks have shown a 6% improvement with reads, and 2%
improvement in writes.

Suggested-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Don't dynamically allocate threadpool jobs
Sasha Levin [Sat, 2 Jul 2011 23:52:03 +0000 (19:52 -0400)]
kvm tools: Don't dynamically allocate threadpool jobs

To allow efficient use of shorter-term threadpool jobs, don't
allocate them dynamically upon creation. Instead, store them
within 'job' structures.

This will prevent some overhead creating/destroying jobs which live
for a short time.

Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agotools/kvm/9p: return EOPNOTSUPP if the handler is not implemented
Aneesh Kumar K.V [Tue, 28 Jun 2011 06:56:50 +0000 (12:26 +0530)]
tools/kvm/9p: return EOPNOTSUPP if the handler is not implemented

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agotools/kvm/9p: Add encode/decode routines for protocol data
Aneesh Kumar K.V [Tue, 28 Jun 2011 06:56:49 +0000 (12:26 +0530)]
tools/kvm/9p: Add encode/decode routines for protocol data

The protocol data is in little-endian format.

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Introduce struct net_dev_operations
Asias He [Wed, 29 Jun 2011 08:47:36 +0000 (16:47 +0800)]
kvm tools: Introduce struct net_dev_operations

virtio_net_{tx, rx}_thread can use ops->{tx, rx} to send and recevie
network package in both tap mode and user mode.

Suggested-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Make default host ip address to 192.168.33.1
Asias He [Wed, 29 Jun 2011 08:47:35 +0000 (16:47 +0800)]
kvm tools: Make default host ip address to 192.168.33.1

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Make default network mode to user mode
Asias He [Wed, 29 Jun 2011 08:47:34 +0000 (16:47 +0800)]
kvm tools: Make default network mode to user mode

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Make virtio net work with user mode network
Asias He [Wed, 29 Jun 2011 08:47:33 +0000 (16:47 +0800)]
kvm tools: Make virtio net work with user mode network

- Call uip_rx() and uip_tx() in virtio_net_rx_thread() and
  virtio_net_tx_thread() if user mode network is enabled.

- Initialize uip in virtio_net__init() if user mode network is enabled.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Change default guest MAC address to 00:15:15:15:15:15
Asias He [Wed, 29 Jun 2011 08:47:32 +0000 (16:47 +0800)]
kvm tools: Change default guest MAC address to 00:15:15:15:15:15

This patch makes guest MAC address the last portion of
default guest IP address which is 192.168.33.15.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Introduce -net {user, tap, none} options for virtio net
Asias He [Wed, 29 Jun 2011 08:47:31 +0000 (16:47 +0800)]
kvm tools: Introduce -net {user, tap, none} options for virtio net

Use '-net user' to enable user model network, which enables plain user
without speical privileges to use network in guest.

Use '-net tap' to enable tap based network, which requres special
privileges.

Use '-net none' to disable virtio net.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Reanme net_device to net_dev
Asias He [Wed, 29 Jun 2011 08:47:30 +0000 (16:47 +0800)]
kvm tools: Reanme net_device to net_dev

This patch makes virtio net device's name convention consistent with others in
virtio/*.c.  struct {net_dev, blk_dev, con_dev, rng_dev, p9_dev}.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add MACRO for user and tap mode for virtio net
Asias He [Wed, 29 Jun 2011 08:47:29 +0000 (16:47 +0800)]
kvm tools: Add MACRO for user and tap mode for virtio net

This patch prepares the user and tap mode for virtio net.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Introduce uip_rx() for uip
Asias He [Wed, 29 Jun 2011 08:47:28 +0000 (16:47 +0800)]
kvm tools: Introduce uip_rx() for uip

This patch implement rx interface for uip. uip_rx() can be called in
virtio_net_rx_thread().

It is a consumer of the ethernet used buffer. It sleeps until there is
used buffer avaiable and copy ethernet data into virtio iov buffers
which provided by virtio_net_rx_thread().

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Introduce uip_tx() for uip
Asias He [Wed, 29 Jun 2011 08:47:27 +0000 (16:47 +0800)]
kvm tools: Introduce uip_tx() for uip

This patch implement tx interface for uip. uip_tx() can be called in
virtio_net_tx_thread().

It dispatches ethernet frame to ARP or IP handling code.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Introduce uip_init() for uip
Asias He [Wed, 29 Jun 2011 08:47:26 +0000 (16:47 +0800)]
kvm tools: Introduce uip_init() for uip

- Initialize TCP/UDP socket list, ethernet buffer list.

- Allocate memory for ethernet buffer.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add TCP support for uip
Asias He [Wed, 29 Jun 2011 08:47:25 +0000 (16:47 +0800)]
kvm tools: Add TCP support for uip

- Implement uip_tx_do_ipv4_tcp() to send TCP package to remote host.

- Implement uip_tcp_socket_thread() to receive TCP package from
  remote host.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Implement uip_csum_tcp() to calculate TCP checksum
Asias He [Wed, 29 Jun 2011 08:47:24 +0000 (16:47 +0800)]
kvm tools: Implement uip_csum_tcp() to calculate TCP checksum

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add helper to allocate and get TCP initial sequence number
Asias He [Wed, 29 Jun 2011 08:47:23 +0000 (16:47 +0800)]
kvm tools: Add helper to allocate and get TCP initial sequence number

Guest's initial sequence number can be found in the SYN package that
guest send to us to intialize a TCP session.

Remote server's initial sequence number is faked. RFC 793 specifies
that the ISN should be viewed as a 32-bit counter that increments
by one every 4 microseconds. For simplicity's sake, current
implementation in uip just returns a constant.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add helpers to test whether SYN or FIN bit is set.
Asias He [Wed, 29 Jun 2011 08:47:22 +0000 (16:47 +0800)]
kvm tools: Add helpers to test whether SYN or FIN bit is set.

This patch adds too helpers uip_tcp_is_syn(), uip_tcp_is_fin() to check if SYN and
FIN bit is set.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add helper to return start address of TCP payload
Asias He [Wed, 29 Jun 2011 08:47:21 +0000 (16:47 +0800)]
kvm tools: Add helper to return start address of TCP payload

uip_tcp_payload() returns start address of TCP payload in a TCP package.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add helpers to return TCP {header, total, payload} length
Asias He [Wed, 29 Jun 2011 08:47:20 +0000 (16:47 +0800)]
kvm tools: Add helpers to return TCP {header, total, payload} length

This patch adds three helpers uip_tcp_hdrlen(), uip_tcp_len(),
uip_tcp_payloadlen() to return TCP header length, TCP totoal
length, and tcp payload length.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Introduce struct uip_tcp_socket
Asias He [Wed, 29 Jun 2011 08:47:19 +0000 (16:47 +0800)]
kvm tools: Introduce struct uip_tcp_socket

struct uip_tcp_socket is used to present every session
between guest and remote host.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Introduce struct uip_tcp to present TCP package.
Asias He [Wed, 29 Jun 2011 08:47:18 +0000 (16:47 +0800)]
kvm tools: Introduce struct uip_tcp to present TCP package.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add UDP support for uip
Asias He [Wed, 29 Jun 2011 08:47:17 +0000 (16:47 +0800)]
kvm tools: Add UDP support for uip

- Implement uip_tx_do_ipv4_udp() to send UDP package to remote host.

- Implement uip_udp_socket_thread() to receive UDP package from
  remote host.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Implement uip_csum_udp() to calculate UDP checksum
Asias He [Wed, 29 Jun 2011 08:47:16 +0000 (16:47 +0800)]
kvm tools: Implement uip_csum_udp() to calculate UDP checksum

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add helper to return ethernet header length
Asias He [Wed, 29 Jun 2011 08:47:15 +0000 (16:47 +0800)]
kvm tools: Add helper to return ethernet header length

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add two helpers to return UDP {header, total} length
Asias He [Wed, 29 Jun 2011 08:47:14 +0000 (16:47 +0800)]
kvm tools: Add two helpers to return UDP {header, total} length

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Introduce struct uip_udp_socket
Asias He [Wed, 29 Jun 2011 08:47:13 +0000 (16:47 +0800)]
kvm tools: Introduce struct uip_udp_socket

struct uip_udp_socket is used to present every "connection" between
guest and remote host.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Introduce struct uip_pseudo_hdr to present UDP pseudo header
Asias He [Wed, 29 Jun 2011 08:47:12 +0000 (16:47 +0800)]
kvm tools: Introduce struct uip_pseudo_hdr to present UDP pseudo header

This pseudo header is used for UDP checksum.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Introduce struct uip_udp to present UDP package
Asias He [Wed, 29 Jun 2011 08:47:11 +0000 (16:47 +0800)]
kvm tools: Introduce struct uip_udp to present UDP package

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add ICMP support for uip
Asias He [Wed, 29 Jun 2011 08:47:10 +0000 (16:47 +0800)]
kvm tools: Add ICMP support for uip

- Introduce struct uip_icmp to present ICMP package

- Implement uip_csum_icmp() to calculate ICMP checksum

- Current ICMP implementation in uip does not really send ICMP package
  to remote host in question, instead it just fake a ICMP reply to fool guest.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Implement IP checksum for uip
Asias He [Wed, 29 Jun 2011 08:47:09 +0000 (16:47 +0800)]
kvm tools: Implement IP checksum for uip

Other protocal, e.g. TCP, UDP, ICMP, can use uip_csum() to make
checsksum as well.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add IPV4 support for uip
Asias He [Wed, 29 Jun 2011 08:47:08 +0000 (16:47 +0800)]
kvm tools: Add IPV4 support for uip

- Introduce struct uip_ip to present IP package

- Add a helper uip_ip_len() to return totoal length of a IP package

- Add a helper uip_ip_hdrlen() to return the IP header length

- Currently, uip does not support IP options
  Drop IP package if IP header length is not 20 bytes which means it
  contains IP options.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Add ARP support for uip
Asias He [Wed, 29 Jun 2011 08:47:07 +0000 (16:47 +0800)]
kvm tools: Add ARP support for uip

- Introduce struct uip_arp to present ARP package
- uip_tx_do_arp()
  Clone incoming ARP ethernet frame, if ARP is requesting
  host IP address, tell guest host MAC address.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agokvm tools: Introduce ethernet frame buffer system for uip
Asias He [Wed, 29 Jun 2011 08:47:06 +0000 (16:47 +0800)]
kvm tools: Introduce ethernet frame buffer system for uip

- uip_buf_get_free()
  Get a free buffer from buffer pool, sleep if there is no free buffer.

- uip_buf_get_used()
  Get a used buffer from buffer pool, sleep if there is no used buffer.

- uip_buf_set_free()
  Set a buffer as free, so it can be reused by the buffer producer.

- uip_buf_set_used()
  Set a buffer as used, uip rx code will inject the ethernet frame in
  this buffer into guest.

- uip_buf_clone()
  Get a free buffer, and clone data into it.

Signed-off-by: Asias He <asias.hejun@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
13 years agoLinux 3.0-rc5 v3.0-rc5
Linus Torvalds [Tue, 28 Jun 2011 02:12:22 +0000 (19:12 -0700)]
Linux 3.0-rc5

13 years agodrm/i915: more struct_mutex locking
Hugh Dickins [Mon, 27 Jun 2011 23:18:20 +0000 (16:18 -0700)]
drm/i915: more struct_mutex locking

When auditing the locking in i915_gem.c (for a prospective change which
I then abandoned), I noticed two places where struct_mutex is not held
across GEM object manipulations that would usually require it.

Since one is in initial setup and the other in driver unload, I'm
guessing the mutex is not required for either; but post a patch in case
it is.

Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Keith Packard <keithp@keithp.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agodrm/i915: use shmem_truncate_range
Hugh Dickins [Mon, 27 Jun 2011 23:18:19 +0000 (16:18 -0700)]
drm/i915: use shmem_truncate_range

The interface to ->truncate_range is changing very slightly: once "tmpfs:
take control of its truncate_range" has been applied, this can be applied.
 For now there is only a slight inefficiency while this remains unapplied,
but it will soon become essential for managing shmem's use of swap.

Change i915_gem_object_truncate() to use shmem_truncate_range() directly:
which should also spare i915 later change if we switch from
inode_operations->truncate_range to file_operations->fallocate.

Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Keith Packard <keithp@keithp.com>
Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agodrm/i915: use shmem_read_mapping_page
Hugh Dickins [Mon, 27 Jun 2011 23:18:18 +0000 (16:18 -0700)]
drm/i915: use shmem_read_mapping_page

Soon tmpfs will stop supporting ->readpage and read_cache_page_gfp(): once
"tmpfs: add shmem_read_mapping_page_gfp" has been applied, this patch can
be applied to ease the transition.

Make i915_gem_object_get_pages_gtt() use shmem_read_mapping_page_gfp() in
the one place it's needed; elsewhere use shmem_read_mapping_page(), with
the mapping's gfp_mask properly initialized.

Forget about __GFP_COLD: since tmpfs initializes its pages with memset,
asking for a cold page is counter-productive.

Include linux/shmem_fs.h also in drm_gem.c: with shmem_file_setup() now
declared there too, we shall remove the prototype from linux/mm.h later.

Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Keith Packard <keithp@keithp.com>
Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agodrm/ttm: use shmem_read_mapping_page
Hugh Dickins [Mon, 27 Jun 2011 23:18:17 +0000 (16:18 -0700)]
drm/ttm: use shmem_read_mapping_page

Soon tmpfs will stop supporting ->readpage and read_mapping_page(): once
"tmpfs: add shmem_read_mapping_page_gfp" has been applied, this patch can
be applied to ease the transition.

ttm_tt_swapin() and ttm_tt_swapout() use shmem_read_mapping_page() in
place of read_mapping_page(), since their swap_space has been created with
shmem_file_setup().

Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Thomas Hellstrom <thellstrom@vmware.com>
Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agodrivers/tty/serial/8250_pci.c: fix warning
Andrew Morton [Mon, 27 Jun 2011 23:18:16 +0000 (16:18 -0700)]
drivers/tty/serial/8250_pci.c: fix warning

Fis the warning

  drivers/tty/serial/8250_pci.c:1457: warning: initialization from incompatible pointer type

Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agodrivers/misc/ioc4.c: fix section mismatch / race condition
Ralf Baechle [Mon, 27 Jun 2011 23:18:15 +0000 (16:18 -0700)]
drivers/misc/ioc4.c: fix section mismatch / race condition

Fix this section mismatch:

  WARNING: drivers/misc/ioc4.o(.data+0x144): Section mismatch in reference from the variable ioc4_load_modules_work to the function .devinit.text:ioc4_load_modules()
  The variable ioc4_load_modules_work references
  the function __devinit ioc4_load_modules()
  If the reference is valid then annotate the
  variable with __init* or __refdata (see linux/init.h) or name the variable:
  *driver, *_template, *_timer, *_sht, *_ops, *_probe, *_probe_one, *_console

This one is potentially fatal; by the time ioc4_load_modules is invoked
it may already have been freed.  For that reason ioc4_load_modules_work
can't be turned to __devinitdata but also because it's referenced in
ioc4_exit.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Acked-by: Brent Casavant <bcasavan@sgi.com>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agodrivers/leds/leds-lp5523.c: fix section mismatches
Ralf Baechle [Mon, 27 Jun 2011 23:18:14 +0000 (16:18 -0700)]
drivers/leds/leds-lp5523.c: fix section mismatches

Fix this section mismatch:

  WARNING: drivers/leds/leds-lp5523.o(.text+0x12f4): Section mismatch in reference from the function lp5523_probe() to the function .init.text:lp5523_init_led()
  The function lp5523_probe() references
  the function __init lp5523_init_led().
  This is often because lp5523_probe lacks a __init
  annotation or the annotation of lp5523_init_led is wrong.

Fixing this one triggers one more mismatch, fix that one as well.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agodrivers/leds/leds-lp5521.c: fix section mismatches
Ralf Baechle [Mon, 27 Jun 2011 23:18:13 +0000 (16:18 -0700)]
drivers/leds/leds-lp5521.c: fix section mismatches

Fix this section mismatch:

  WARNING: drivers/leds/leds-lp5521.o(.text+0xf2c): Section mismatch in reference from the function lp5521_probe() to the function .init.text:lp5521_init_led()
  The function lp5521_probe() references
  the function __init lp5521_init_led().
  This is often because lp5521_probe lacks a __init
  annotation or the annotation of lp5521_init_led is wrong.

Fixing this mismatch triggers one more mismatch, fix that one as well.

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agomemcg: fix direct softlimit reclaim to be called in limit path
KAMEZAWA Hiroyuki [Mon, 27 Jun 2011 23:18:12 +0000 (16:18 -0700)]
memcg: fix direct softlimit reclaim to be called in limit path

Commit d149e3b25d7c ("memcg: add the soft_limit reclaim in global direct
reclaim") adds a softlimit hook to shrink_zones().  By this, soft limit
is called as

   try_to_free_pages()
       do_try_to_free_pages()
           shrink_zones()
               mem_cgroup_soft_limit_reclaim()

Then, direct reclaim is memcg softlimit hint aware, now.

But, the memory cgroup's "limit" path can call softlimit shrinker.

   try_to_free_mem_cgroup_pages()
       do_try_to_free_pages()
           shrink_zones()
               mem_cgroup_soft_limit_reclaim()

This will cause a global reclaim when a memcg hits limit.

This is bug. soft_limit_reclaim() should be called when
scanning_global_lru(sc) == true.

And the commit adds a variable "total_scanned" for counting softlimit
scanned pages....it's not "total".  This patch removes the variable and
update sc->nr_scanned instead of it.  This will affect shrink_slab()'s
scan condition but, global LRU is scanned by softlimit and I think this
change makes sense.

TODO: avoid too much scanning of a zone when softlimit did enough work.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: Ying Han <yinghan@google.com>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agotaskstats: don't allow duplicate entries in listener mode
Vasiliy Kulikov [Mon, 27 Jun 2011 23:18:11 +0000 (16:18 -0700)]
taskstats: don't allow duplicate entries in listener mode

Currently a single process may register exit handlers unlimited times.
It may lead to a bloated listeners chain and very slow process
terminations.

Eg after 10KK sent TASKSTATS_CMD_ATTR_REGISTER_CPUMASKs ~300 Mb of
kernel memory is stolen for the handlers chain and "time id" shows 2-7
seconds instead of normal 0.003.  It makes it possible to exhaust all
kernel memory and to eat much of CPU time by triggerring numerous exits
on a single CPU.

The patch limits the number of times a single process may register
itself on a single CPU to one.

One little issue is kept unfixed - as taskstats_exit() is called before
exit_files() in do_exit(), the orphaned listener entry (if it was not
explicitly deregistered) is kept until the next someone's exit() and
implicit deregistration in send_cpu_listeners().  So, if a process
registered itself as a listener exits and the next spawned process gets
the same pid, it would inherit taskstats attributes.

Signed-off-by: Vasiliy Kulikov <segooon@gmail.com>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agomm: fix assertion mapping->nrpages == 0 in end_writeback()
Jan Kara [Mon, 27 Jun 2011 23:18:10 +0000 (16:18 -0700)]
mm: fix assertion mapping->nrpages == 0 in end_writeback()

Under heavy memory and filesystem load, users observe the assertion
mapping->nrpages == 0 in end_writeback() trigger.  This can be caused by
page reclaim reclaiming the last page from a mapping in the following
race:

CPU0 CPU1
  ...
  shrink_page_list()
    __remove_mapping()
      __delete_from_page_cache()
        radix_tree_delete()
evict_inode()
  truncate_inode_pages()
    truncate_inode_pages_range()
      pagevec_lookup() - finds nothing
  end_writeback()
    mapping->nrpages != 0 -> BUG
        page->mapping = NULL
        mapping->nrpages--

Fix the problem by doing a reliable check of mapping->nrpages under
mapping->tree_lock in end_writeback().

Analyzed by Jay <jinshan.xiong@whamcloud.com>, lost in LKML, and dug out
by Miklos Szeredi <mszeredi@suse.de>.

Cc: Jay <jinshan.xiong@whamcloud.com>
Cc: Miklos Szeredi <mszeredi@suse.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agomm/memory-failure.c: fix spinlock vs mutex order
Peter Zijlstra [Mon, 27 Jun 2011 23:18:09 +0000 (16:18 -0700)]
mm/memory-failure.c: fix spinlock vs mutex order

We cannot take a mutex while holding a spinlock, so flip the order and
fix the locking documentation.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Andi Kleen <ak@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agodrivers/misc/lkdtm.c: fix race when crashpoint is hit multiple times before checking...
Josh Hunt [Mon, 27 Jun 2011 23:18:08 +0000 (16:18 -0700)]
drivers/misc/lkdtm.c: fix race when crashpoint is hit multiple times before checking count

We observed the crash point count going negative in cases where the
crash point is hit multiple times before the check of "count == 0" is
done.  Because of this we never call lkdtm_do_action().  This patch just
adds a spinlock to protect count.

Reported-by: Tapan Dhimant <tdhimant@akamai.com>
Signed-off-by: Josh Hunt <johunt@akamai.com>
Acked-by: Ankita Garg <ankita@in.ibm.com>
Cc: <stable@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoinclude/linux/compat.h: declare compat_sys_sendmmsg()
Chris Metcalf [Mon, 27 Jun 2011 23:18:07 +0000 (16:18 -0700)]
include/linux/compat.h: declare compat_sys_sendmmsg()

This is required for tilegx to be able to use the compat unistd.h header
where compat_sys_sendmmsg() is now mentioned.

Signed-off-by: Chris Metcalf <cmetcalf@tilera.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoromfs: fix romfs_get_unmapped_area() argument check
Bob Liu [Mon, 27 Jun 2011 23:18:06 +0000 (16:18 -0700)]
romfs: fix romfs_get_unmapped_area() argument check

romfs_get_unmapped_area() checks argument `len' without considering
PAGE_ALIGN which will cause do_mmap_pgoff() return -EINVAL error after
commit f67d9b1576c ("nommu: add page_align to mmap").

Fix the check by changing it in same way ramfs_nommu_get_unmapped_area()
was changed in ramfs/file-nommu.c.

Signed-off-by: Bob Liu <lliubbo@gmail.com>
Cc: David Howells <dhowells@redhat.com>
Cc: Paul Mundt <lethal@linux-sh.org>
Acked-by: Greg Ungerer <gerg@snapgear.com>
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoum: add asm/percpu.h
Richard Weinberger [Mon, 27 Jun 2011 23:18:05 +0000 (16:18 -0700)]
um: add asm/percpu.h

To make SLUB work on UML we need this_cpu_cmpxchg from
asm-generic/percpu.h.

Signed-off-by: Richard Weinberger <richard@nod.at>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agodrivers/rtc/rtc-ds1307.c: add support for RTC device pt7c4338
Priyanka Jain [Mon, 27 Jun 2011 23:18:04 +0000 (16:18 -0700)]
drivers/rtc/rtc-ds1307.c: add support for RTC device pt7c4338

PT7C4338 chip is being manufactured by Pericom Technology Inc.  It is a
serial real-time clock which provides:

1) Low-power clock/calendar.
2) Programmable square-wave output.

It has 56 bytes of nonvolatile RAM.  Its register set is same as that of
rtc device: DS1307.

Signed-off-by: Priyanka Jain <Priyanka.Jain@freescale.com>
Acked-by: Timur Tabi <timur@freescale.com>
Reviewed-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agotmpfs: add shmem_read_mapping_page_gfp
Hugh Dickins [Mon, 27 Jun 2011 23:18:04 +0000 (16:18 -0700)]
tmpfs: add shmem_read_mapping_page_gfp

Although it is used (by i915) on nothing but tmpfs, read_cache_page_gfp()
is unsuited to tmpfs, because it inserts a page into pagecache before
calling the filesystem's ->readpage: tmpfs may have pages in swapcache
which only it knows how to locate and switch to filecache.

At present tmpfs provides a ->readpage method, and copes with this by
copying pages; but soon we can simplify it by removing its ->readpage.
Provide shmem_read_mapping_page_gfp() now, ready for that transition,

Export shmem_read_mapping_page_gfp() and add it to list in shmem_fs.h,
with shmem_read_mapping_page() inline for the common mapping_gfp case.

(shmem_read_mapping_page_gfp or shmem_read_cache_page_gfp? Generally the
read_mapping_page functions use the mapping's ->readpage, and the
read_cache_page functions use the supplied filler, so I think
read_cache_page_gfp was slightly misnamed.)

Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agotmpfs: take control of its truncate_range
Hugh Dickins [Mon, 27 Jun 2011 23:18:03 +0000 (16:18 -0700)]
tmpfs: take control of its truncate_range

2.6.35's new truncate convention gave tmpfs the opportunity to control
its file truncation, no longer enforced from outside by vmtruncate().
We shall want to build upon that, to handle pagecache and swap together.

Slightly redefine the ->truncate_range interface: let it now be called
between the unmap_mapping_range()s, with the filesystem responsible for
doing the truncate_inode_pages_range() from it - just as the filesystem
is nowadays responsible for doing that from its ->setattr.

Let's rename shmem_notify_change() to shmem_setattr().  Instead of
calling the generic truncate_setsize(), bring that code in so we can
call shmem_truncate_range() - which will later be updated to perform its
own variant of truncate_inode_pages_range().

Remove the punch_hole unmap_mapping_range() from shmem_truncate_range():
now that the COW's unmap_mapping_range() comes after ->truncate_range,
there is no need to call it a third time.

Export shmem_truncate_range() and add it to the list in shmem_fs.h, so
that i915_gem_object_truncate() can call it explicitly in future; get
this patch in first, then update drm/i915 once this is available (until
then, i915 will just be doing the truncate_inode_pages() twice).

Though introduced five years ago, no other filesystem is implementing
->truncate_range, and its only other user is madvise(,,MADV_REMOVE): we
expect to convert it to fallocate(,FALLOC_FL_PUNCH_HOLE,,) shortly,
whereupon ->truncate_range can be removed from inode_operations -
shmem_truncate_range() will help i915 across that transition too.

Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>