]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/log
mirror_ubuntu-disco-kernel.git
13 years agoblock: move bd_set_size() above rescan_partitions() in __blkdev_get()
Tejun Heo [Mon, 23 May 2011 11:24:54 +0000 (13:24 +0200)]
block: move bd_set_size() above rescan_partitions() in __blkdev_get()

02e352287a4 (block: rescan partitions on invalidated devices on
-ENOMEDIA too) relocated partition rescan above explicit bd_set_size()
to simplify condition check.  As rescan_partitions() does its own bdev
size setting, this doesn't break anything; however,
rescan_partitions() prints out the following messages when adjusting
bdev size, which can be confusing.

  sda: detected capacity change from 0 to 146815737856
  sdb: detected capacity change from 0 to 146815737856

This patch restores the original order and remove the warning
messages.

stable: Please apply together with 02e352287a4 (block: rescan
        partitions on invalidated devices on -ENOMEDIA too).

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: Tony Luck <tony.luck@gmail.com>
Tested-by: Tony Luck <tony.luck@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMerge branch 'kvm-updates/2.6.40' of git://git.kernel.org/pub/scm/virt/kvm/kvm
Linus Torvalds [Mon, 23 May 2011 15:42:08 +0000 (08:42 -0700)]
Merge branch 'kvm-updates/2.6.40' of git://git.kernel.org/pub/scm/virt/kvm/kvm

* 'kvm-updates/2.6.40' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (131 commits)
  KVM: MMU: Use ptep_user for cmpxchg_gpte()
  KVM: Fix kvm mmu_notifier initialization order
  KVM: Add documentation for KVM_CAP_NR_VCPUS
  KVM: make guest mode entry to be rcu quiescent state
  KVM: x86 emulator: Make jmp far emulation into a separate function
  KVM: x86 emulator: Rename emulate_grpX() to em_grpX()
  KVM: x86 emulator: Remove unused arg from emulate_pop()
  KVM: x86 emulator: Remove unused arg from writeback()
  KVM: x86 emulator: Remove unused arg from read_descriptor()
  KVM: x86 emulator: Remove unused arg from seg_override()
  KVM: Validate userspace_addr of memslot when registered
  KVM: MMU: Clean up gpte reading with copy_from_user()
  KVM: PPC: booke: add sregs support
  KVM: PPC: booke: save/restore VRSAVE (a.k.a. USPRG0)
  KVM: PPC: use ticks, not usecs, for exit timing
  KVM: PPC: fix exit accounting for SPRs, tlbwe, tlbsx
  KVM: PPC: e500: emulate SVR
  KVM: VMX: Cache vmcs segment fields
  KVM: x86 emulator: consolidate segment accessors
  KVM: VMX: Avoid reading %rip unnecessarily when handling exceptions
  ...

13 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
Linus Torvalds [Mon, 23 May 2011 15:39:24 +0000 (08:39 -0700)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (27 commits)
  bnx2x: allow device properly initialize after hotplug
  bnx2x: fix DMAE timeout according to hw specifications
  bnx2x: properly handle CFC DEL in cnic flow
  bnx2x: call dev_kfree_skb_any instead of dev_kfree_skb
  net: filter: move forward declarations to avoid compile warnings
  pktgen: refactor pg_init() code
  pktgen: use vzalloc_node() instead of vmalloc_node() + memset()
  net: skb_trim explicitely check the linearity instead of data_len
  ipv4: Give backtrace in ip_rt_bug().
  net: avoid synchronize_rcu() in dev_deactivate_many
  net: remove synchronize_net() from netdev_set_master()
  rtnetlink: ignore NETDEV_RELEASE and NETDEV_JOIN event
  net: rename NETDEV_BONDING_DESLAVE to NETDEV_RELEASE
  bridge: call NETDEV_JOIN notifiers when add a slave
  netpoll: disable netpoll when enslave a device
  macvlan: Forward unicast frames in bridge mode to lowerdev
  net: Remove linux/prefetch.h include from linux/skbuff.h
  ipv4: Include linux/prefetch.h in fib_trie.c
  netlabel: Remove prefetches from list handlers.
  drivers/net: add prefetch header for prefetch users
  ...

Fixed up prefetch parts: removed a few duplicate prefetch.h includes,
fixed the location of the igb prefetch.h, took my version of the
skbuff.h code without the extra parentheses etc.

13 years agoMerge branch 'exec_rm_compat' of git://git.kernel.org/pub/scm/linux/kernel/git/oleg...
Linus Torvalds [Mon, 23 May 2011 15:28:34 +0000 (08:28 -0700)]
Merge branch 'exec_rm_compat' of git://git.kernel.org/pub/scm/linux/kernel/git/oleg/misc

* 'exec_rm_compat' of git://git.kernel.org/pub/scm/linux/kernel/git/oleg/misc:
  exec: document acct_arg_size()
  exec: unify do_execve/compat_do_execve code
  exec: introduce struct user_arg_ptr
  exec: introduce get_user_arg_ptr() helper

13 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes
Linus Torvalds [Mon, 23 May 2011 15:24:09 +0000 (08:24 -0700)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes

* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes:
  GFS2: Wait properly when flushing the ail list
  GFS2: Wipe directory hash table metadata when deallocating a directory

13 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
Linus Torvalds [Mon, 23 May 2011 15:20:44 +0000 (08:20 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-ktest

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-2.6-ktest:
  ktest: Allow options to be used by other options
  ktest: Create variables for the ktest config files
  ktest: Reboot after each patchcheck run
  ktest: Reboot to good kernel after every bisect run
  ktest: If test failed due to timeout, print that
  ktest: Fix post install command

13 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke...
Linus Torvalds [Mon, 23 May 2011 05:43:01 +0000 (22:43 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke/nilfs2

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ryusuke/nilfs2:
  nilfs2: use mark_buffer_dirty to mark btnode or meta data dirty
  nilfs2: always set back pointer to host inode in mapping->host
  nilfs2: get rid of NILFS_I_NILFS
  nilfs2: use list_first_entry
  nilfs2: use empty_aops for gc-inodes
  nilfs2: implement resize ioctl
  nilfs2: add truncation routine of segment usage file
  nilfs2: add routine to move secondary super block
  nilfs2: add ioctl which limits range of segment to be allocated
  nilfs2: zero fill unused portion of super root block
  nilfs2: super root size should change depending on inode size
  nilfs2: get rid of private page allocator
  nilfs2: merge list_del()/list_add_tail() to list_move_tail()

13 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-2.6
Linus Torvalds [Mon, 23 May 2011 05:08:32 +0000 (22:08 -0700)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-2.6:
  ide/ide-scan-pci.c: Use for_each_pci_dev().
  ide: Use linux/mutex.h
  IDE: ide-floppy, remove unnecessary NULL check
  drivers/ide/pmac.c: Remove unnecessary casts of pci_get_drvdata
  ide: fix use after free in ide-acpi

13 years agoMerge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6
Linus Torvalds [Mon, 23 May 2011 05:06:24 +0000 (22:06 -0700)]
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/sparc-next-2.6: (28 commits)
  sparc32: fix build, fix missing cpu_relax declaration
  SCHED_TTWU_QUEUE is not longer needed since sparc32 now implements IPI
  sparc32,leon: Remove unnecessary page_address calls in LEON DMA API.
  sparc: convert old cpumask API into new one
  sparc32, sun4d: Implemented SMP IPIs support for SUN4D machines
  sparc32, sun4m: Implemented SMP IPIs support for SUN4M machines
  sparc32,leon: Implemented SMP IPIs for LEON CPU
  sparc32: implement SMP IPIs using the generic functions
  sparc32,leon: SMP power down implementation
  sparc32,leon: added some SMP comments
  sparc: add {read,write}*_be routines
  sparc32,leon: don't rely on bootloader to mask IRQs
  sparc32,leon: operate on boot-cpu IRQ controller registers
  sparc32: always define boot_cpu_id
  sparc32: removed unused code, implemented by generic code
  sparc32: avoid build warning at mm/percpu.c:1647
  sparc32: always register a PROM based early console
  sparc32: probe for cpu info only during startup
  sparc: consolidate show_cpuinfo in cpu.c
  sparc32,leon: implement genirq CPU affinity
  ...

13 years agoMerge branch 'for-linus' of git://neil.brown.name/md
Linus Torvalds [Mon, 23 May 2011 05:03:03 +0000 (22:03 -0700)]
Merge branch 'for-linus' of git://neil.brown.name/md

* 'for-linus' of git://neil.brown.name/md:
  md: allow resync_start to be set while an array is active.
  md/raid10:  reformat some loops with less indenting.
  md/raid10: remove unused variable.
  md/raid10: make more use of 'slot' in raid10d.
  md/raid10: some tidying up in fix_read_error
  md/raid1: improve handling of pages allocated for write-behind.
  md/raid1: try fix_sync_read_error before process_checks.
  md/raid1: tidy up new functions: process_checks and fix_sync_read_error.
  md/raid1: split out two sub-functions from sync_request_write
  md: make error_handler functions more uniform and correct.
  md/multipath: discard ->working_disks in favour of ->degraded
  md/raid1: clean up read_balance.
  md: simplify raid10 read_balance
  md/bitmap: fix saving of events_cleared and other state.
  md: reject a re-add request that cannot be honoured.
  md: Fix race when creating a new md device.

13 years agowireless: fix fatal kernel-doc error + warning in mac80211.h
Randy Dunlap [Mon, 23 May 2011 00:22:45 +0000 (17:22 -0700)]
wireless: fix fatal kernel-doc error + warning in mac80211.h

Fix new kernel-doc Error and Warning in <net/mac80211.h>:

  Error(linux-2.6.39-git5/include/net/mac80211.h:550): cannot understand prototype: 'struct ieee80211_sched_scan_ies '
  Warning(linux-2.6.39-git5/include/net/mac80211.h:2289): No description found for parameter 'sta'

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agox86: setup_smep needs to be __cpuinit
Linus Torvalds [Mon, 23 May 2011 04:37:01 +0000 (21:37 -0700)]
x86: setup_smep needs to be __cpuinit

The setup_smep function gets calle at resume time too, and is thus not a
pure __init function.  When marked as __init, it gets thrown out after
the kernel has initialized, and when the kernel is suspended and
resumed, the code will no longer be around, and we'll get a nice "kernel
tried to execute NX-protected page" oops because the page is no longer
marked executable.

Reported-and-tested-by: Parag Warudkar <parag.lkml@gmail.com>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: "H. Peter Anvin" <hpa@linux.intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoRemove prefetch() from <linux/skbuff.h> and "netlabel_addrlist.h"
Linus Torvalds [Sun, 22 May 2011 23:51:43 +0000 (16:51 -0700)]
Remove prefetch() from <linux/skbuff.h> and "netlabel_addrlist.h"

Commit e66eed651fd1 ("list: remove prefetching from regular list
iterators") removed the include of prefetch.h from list.h.  The skbuff
list traversal still had them.

Quoth David Miller:
  "Please just remove the prefetches.

  Those are modelled after list.h as I intend to eventually convert
  SKB list handling to "struct list_head" but we're not there yet.

  Therefore if we kill prefetches from list.h we should kill it from
  these things in skbuff.h too."

Requested-by: David Miller <davem@davemloft.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoAdd appropriate <linux/prefetch.h> include for prefetch users
Paul Gortmaker [Sun, 22 May 2011 20:47:17 +0000 (16:47 -0400)]
Add appropriate <linux/prefetch.h> include for prefetch users

After discovering that wide use of prefetch on modern CPUs
could be a net loss instead of a win, net drivers which were
relying on the implicit inclusion of prefetch.h via the list
headers showed up in the resulting cleanup fallout.  Give
them an explicit include via the following $0.02 script.

 =========================================
 #!/bin/bash
 MANUAL=""
 for i in `git grep -l 'prefetch(.*)' .` ; do
  grep -q '<linux/prefetch.h>' $i
  if [ $? = 0 ] ; then
  continue
  fi

  ( echo '?^#include <linux/?a'
  echo '#include <linux/prefetch.h>'
  echo .
  echo w
  echo q
  ) | ed -s $i > /dev/null 2>&1
  if [ $? != 0 ]; then
  echo $i needs manual fixup
  MANUAL="$i $MANUAL"
  fi
 done
 echo ------------------- 8\<----------------------
 echo vi $MANUAL
 =========================================

Signed-off-by: Paul <paul.gortmaker@windriver.com>
[ Fixed up some incorrect #include placements, and added some
  non-network drivers and the fib_trie.c case    - Linus ]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agosparc32: fix build, fix missing cpu_relax declaration
Sam Ravnborg [Sat, 21 May 2011 20:55:17 +0000 (22:55 +0200)]
sparc32: fix build, fix missing cpu_relax declaration

Fix following sparc (32 bit) build error:

  CC      arch/sparc/kernel/asm-offsets.s
In file included from include/linux/seqlock.h:29:0,
                 from include/linux/time.h:8,
                 from include/linux/timex.h:56,
                 from include/linux/sched.h:57,
                 from arch/sparc/kernel/asm-offsets.c:13:
include/linux/spinlock.h: In function 'spin_unlock_wait':
include/linux/spinlock.h:360:2: error: implicit declaration of function 'cpu_relax'

Most likely caused by commit e66eed651fd1 ("list: remove
prefetching from regular list iterators") due to include
changes.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: allow device properly initialize after hotplug
Dmitry Kravkov [Sun, 22 May 2011 10:11:26 +0000 (10:11 +0000)]
bnx2x: allow device properly initialize after hotplug

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: fix DMAE timeout according to hw specifications
Dmitry Kravkov [Sun, 22 May 2011 10:09:19 +0000 (10:09 +0000)]
bnx2x: fix DMAE timeout according to hw specifications

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: properly handle CFC DEL in cnic flow
Vladislav Zolotarov [Sun, 22 May 2011 10:08:09 +0000 (10:08 +0000)]
bnx2x: properly handle CFC DEL in cnic flow

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobnx2x: call dev_kfree_skb_any instead of dev_kfree_skb
Vladislav Zolotarov [Sun, 22 May 2011 10:06:58 +0000 (10:06 +0000)]
bnx2x: call dev_kfree_skb_any instead of dev_kfree_skb

replace function calls when possible call in both irq/non-irq contexts

Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com>
Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: filter: move forward declarations to avoid compile warnings
Heiko Carstens [Sun, 22 May 2011 07:08:11 +0000 (07:08 +0000)]
net: filter: move forward declarations to avoid compile warnings

Get rid of this compile warning:

In file included from arch/s390/kernel/compat_linux.c:37:0:
include/linux/filter.h:139:23: warning: 'struct sk_buff' declared inside parameter list

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agopktgen: refactor pg_init() code
WANG Cong [Sun, 22 May 2011 00:52:08 +0000 (00:52 +0000)]
pktgen: refactor pg_init() code

This also shrinks the object size a little.

   text    data     bss     dec     hex filename
  28834     186       8   29028    7164 net/core/pktgen.o
  28816     186       8   29010    7152 net/core/pktgen.o.AFTER

Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
Cc: "David Miller" <davem@davemloft.net>,
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agopktgen: use vzalloc_node() instead of vmalloc_node() + memset()
WANG Cong [Sun, 22 May 2011 00:17:11 +0000 (00:17 +0000)]
pktgen: use vzalloc_node() instead of vmalloc_node() + memset()

Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: skb_trim explicitely check the linearity instead of data_len
Emmanuel Grumbach [Sat, 21 May 2011 19:46:09 +0000 (19:46 +0000)]
net: skb_trim explicitely check the linearity instead of data_len

The purpose of the check on data_len is to check linearity, so use the inline
helper for this. No overhead and more explicit.

Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoipv4: Give backtrace in ip_rt_bug().
Dave Jones [Sat, 21 May 2011 07:16:42 +0000 (07:16 +0000)]
ipv4: Give backtrace in ip_rt_bug().

Add a stack backtrace to the ip_rt_bug path for debugging

Signed-off-by: Dave Jones <davej@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: avoid synchronize_rcu() in dev_deactivate_many
Eric Dumazet [Thu, 19 May 2011 23:42:09 +0000 (23:42 +0000)]
net: avoid synchronize_rcu() in dev_deactivate_many

dev_deactivate_many() issues one synchronize_rcu() call after qdiscs set
to noop_qdisc.

This call is here to make sure they are no outstanding qdisc-less
dev_queue_xmit calls before returning to caller.

But in dismantle phase, we dont have to wait, because we wont activate
again the device, and we are going to wait one rcu grace period later in
rollback_registered_many().

After this patch, device dismantle uses one synchronize_net() and one
rcu_barrier() call only, so we have a ~30% speedup and a smaller RTNL
latency.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Patrick McHardy <kaber@trash.net>,
CC: Ben Greear <greearb@candelatech.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: remove synchronize_net() from netdev_set_master()
Eric Dumazet [Thu, 19 May 2011 19:37:40 +0000 (19:37 +0000)]
net: remove synchronize_net() from netdev_set_master()

In the old days, we used to access dev->master in __netif_receive_skb()
in a rcu_read_lock section.

So one synchronize_net() call was needed in netdev_set_master() to make
sure another cpu could not use old master while/after we release it.

We now use netdev_rx_handler infrastructure and added one
synchronize_net() call in bond_release()/bond_release_all()

Remove the obsolete synchronize_net() from netdev_set_master() and add
one in bridge del_nbp() after its netdev_rx_handler_unregister() call.

This makes enslave -d a bit faster.

Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
CC: Jiri Pirko <jpirko@redhat.com>
CC: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agortnetlink: ignore NETDEV_RELEASE and NETDEV_JOIN event
Amerigo Wang [Thu, 19 May 2011 23:06:32 +0000 (23:06 +0000)]
rtnetlink: ignore NETDEV_RELEASE and NETDEV_JOIN event

These two events are not expected to be caught by userspace.

Signed-off-by: WANG Cong <amwang@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: rename NETDEV_BONDING_DESLAVE to NETDEV_RELEASE
Amerigo Wang [Thu, 19 May 2011 21:39:12 +0000 (21:39 +0000)]
net: rename NETDEV_BONDING_DESLAVE to NETDEV_RELEASE

s/NETDEV_BONDING_DESLAVE/NETDEV_RELEASE/ as Andy suggested.

Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Cc: Neil Horman <nhorman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agobridge: call NETDEV_JOIN notifiers when add a slave
Amerigo Wang [Thu, 19 May 2011 21:39:11 +0000 (21:39 +0000)]
bridge: call NETDEV_JOIN notifiers when add a slave

In the previous patch I added NETDEV_JOIN, now
we can notify netconsole when adding a device to a bridge too.

Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Neil Horman <nhorman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonetpoll: disable netpoll when enslave a device
Amerigo Wang [Thu, 19 May 2011 21:39:10 +0000 (21:39 +0000)]
netpoll: disable netpoll when enslave a device

V3: rename NETDEV_ENSLAVE to NETDEV_JOIN

Currently we do nothing when we enslave a net device which is running netconsole.
Neil pointed out that we may get weird results in such case, so let's disable
netpoll on the device being enslaved. I think it is too harsh to prevent
the device being ensalved if it is running netconsole.

By the way, this patch also removes the NETDEV_GOING_DOWN from netconsole
netdev notifier, because netpoll will check if the device is running or not
and we don't handle NETDEV_PRE_UP neither.

This patch is based on net-next-2.6.

Signed-off-by: WANG Cong <amwang@redhat.com>
Cc: Neil Horman <nhorman@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agomacvlan: Forward unicast frames in bridge mode to lowerdev
David Ward [Thu, 19 May 2011 02:53:20 +0000 (02:53 +0000)]
macvlan: Forward unicast frames in bridge mode to lowerdev

Unicast frames between macvlan interfaces in bridge mode are not otherwise
sent to network taps on the lowerdev (as all other macvlan frames are), so
forward the frames to the receive queue of the lowerdev first.

Signed-off-by: David Ward <david.ward@ll.mit.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: Remove linux/prefetch.h include from linux/skbuff.h
David S. Miller [Mon, 23 May 2011 00:54:11 +0000 (20:54 -0400)]
net: Remove linux/prefetch.h include from linux/skbuff.h

No longer needed.

Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoipv4: Include linux/prefetch.h in fib_trie.c
David S. Miller [Mon, 23 May 2011 00:53:43 +0000 (20:53 -0400)]
ipv4: Include linux/prefetch.h in fib_trie.c

Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonetlabel: Remove prefetches from list handlers.
David S. Miller [Mon, 23 May 2011 00:42:10 +0000 (20:42 -0400)]
netlabel: Remove prefetches from list handlers.

Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agodrivers/net: add prefetch header for prefetch users
Paul Gortmaker [Sun, 22 May 2011 11:02:08 +0000 (11:02 +0000)]
drivers/net: add prefetch header for prefetch users

After discovering that wide use of prefetch on modern CPUs
could be a net loss instead of a win, net drivers which were
relying on the implicit inclusion of prefetch.h via the list
headers showed up in the resulting cleanup fallout.  Give
them an explicit include via the following $0.02 script.

 =========================================
 #!/bin/bash
 MANUAL=""
 for i in `git grep -l 'prefetch(.*)' .` ; do
  grep -q '<linux/prefetch.h>' $i
  if [ $? = 0 ] ; then
  continue
  fi

  ( echo '?^#include <linux/?a'
  echo '#include <linux/prefetch.h>'
  echo .
  echo w
  echo q
  ) | ed -s $i > /dev/null 2>&1
  if [ $? != 0 ]; then
  echo $i needs manual fixup
  MANUAL="$i $MANUAL"
  fi
 done
 echo ------------------- 8\<----------------------
 echo vi $MANUAL
 =========================================

Signed-off-by: Paul <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agorionet: Remove pointless printk of skb pointer.
David S. Miller [Mon, 23 May 2011 00:35:54 +0000 (20:35 -0400)]
rionet: Remove pointless printk of skb pointer.

Casting to u32 warns anyways.

Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agonet: Remove prefetches from SKB list handlers.
David S. Miller [Mon, 23 May 2011 00:35:29 +0000 (20:35 -0400)]
net: Remove prefetches from SKB list handlers.

Noticed by Linus.

Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocaif: Plug memory leak for checksum error
sjur.brandeland@stericsson.com [Sun, 22 May 2011 11:18:54 +0000 (11:18 +0000)]
caif: Plug memory leak for checksum error

In case of checksum error, the framing layer returns -EILSEQ, but
does not free the packet. Plug this hole by freeing the packet if
-EILSEQ is returned.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocaif: Update documentation of CAIF transmit and receive functions.
sjur.brandeland@stericsson.com [Sun, 22 May 2011 11:18:53 +0000 (11:18 +0000)]
caif: Update documentation of CAIF transmit and receive functions.

Trivial patch updating documentation in header files only.
Error handling of CAIF transmit errors was changed by commit:
      caif: Don't resend if dev_queue_xmit fails.
This patch updates the documentation accordingly.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocaif: Fix freezes when running CAIF loopback device
sjur.brandeland@stericsson.com [Sun, 22 May 2011 11:18:52 +0000 (11:18 +0000)]
caif: Fix freezes when running CAIF loopback device

Fix spinlock bugs when running out of link-ids in loopback tests and
avoid allocating link-id when error is set in link-setup-response.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocaif: Fixes freeze on Link layer removal.
sjur.brandeland@stericsson.com [Sun, 22 May 2011 11:18:51 +0000 (11:18 +0000)]
caif: Fixes freeze on Link layer removal.

CAIF Socket layer - caif_socket.c:
- Plug mem-leak at reconnect.
- Always call disconnect to cleanup CAIF stack.
- Disconnect will always report success.

CAIF configuration layer - cfcnfg.c
- Disconnect must dismantle the caif stack correctly
- Protect against faulty removals (check on id zero)

CAIF mux layer - cfmuxl.c
- When inserting new service layer in the MUX remove
  any old entries with the same ID.
- When removing CAIF Link layer, remove the associated
  service layers before notifying service layers.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agocaif: Bugfix add check NULL pointer before calling functions.
sjur.brandeland@stericsson.com [Sun, 22 May 2011 11:18:50 +0000 (11:18 +0000)]
caif: Bugfix add check NULL pointer before calling functions.

Add check on layer->dn != NULL before calling functions in
layer below.

Signed-off-by: Sjur Brændeland <sjur.brandeland@stericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
13 years agoGive up on pushing CC_OPTIMIZE_FOR_SIZE
Linus Torvalds [Sun, 22 May 2011 21:30:36 +0000 (14:30 -0700)]
Give up on pushing CC_OPTIMIZE_FOR_SIZE

I still happen to believe that I$ miss costs are a major thing, but
sadly, -Os doesn't seem to be the solution.  With or without it, gcc
will miss some obvious code size improvements, and with it enabled gcc
will sometimes make choices that aren't good even with high I$ miss
ratios.

For example, with -Os, gcc on x86 will turn a 20-byte constant memcpy
into a "rep movsl".  While I sincerely hope that x86 CPU's will some day
do a good job at that, they certainly don't do it yet, and the cost is
higher than a L1 I$ miss would be.

Some day I hope we can re-enable this.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoMerge branch 'viafb-next' of git://github.com/schandinat/linux-2.6
Linus Torvalds [Sun, 22 May 2011 19:39:58 +0000 (12:39 -0700)]
Merge branch 'viafb-next' of git://github.com/schandinat/linux-2.6

* 'viafb-next' of git://github.com/schandinat/linux-2.6: (24 commits)
  viafb: Automatic OLPC XO-1.5 configuration
  viafb: remove unused CEA mode
  viafb: try to map less memory in case of failure
  viafb: use write combining for video ram
  viafb: add X server compatibility mode
  viafb: reduce OLPC refresh a bit
  viafb: fix OLPC XO 1.5 device connection
  viafb: fix OLPC DCON refresh rate
  viafb: delete clock and PLL initialization
  viafb: replace custom return values
  viafb: some small cleanup for global variables
  viafb: gather common good, old VGA initialization in one place
  viafb: add engine clock support
  viafb: add VIA slapping capability
  viafb: split clock and PLL code to an extra file
  viafb: add primary/secondary clock on/off switches
  viafb: add clock source selection and PLL power management support
  viafb: prepare for PLL separation
  viafb: call viafb_get_clk_value only in viafb_set_vclock
  viafb: remove unused max_hres/vres
  ...

13 years agoMerge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/parisc-2.6
Linus Torvalds [Sun, 22 May 2011 19:38:40 +0000 (12:38 -0700)]
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/parisc-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/parisc-2.6:
  [PARISC] wire up syncfs syscall
  [PARISC] wire up the fhandle syscalls
  [PARISC] wire up clock_adjtime syscall
  [PARISC] wire up fanotify syscalls
  [PARISC] prevent speculative re-read on cache flush
  [PARISC] only make executable areas executable
  [PARISC] fix pacache .size with new binutils

13 years agonet: add missing prefetch.h include
Heiko Carstens [Sun, 22 May 2011 16:55:10 +0000 (18:55 +0200)]
net: add missing prefetch.h include

Fixes build errors on s390 and probably other archs as well:

  In file included from net/ipv4/ip_forward.c:32:0:
  include/net/udp.h: In function 'udp_csum_outgoing':
  include/net/udp.h:141:2: error: implicit declaration of function 'prefetch'

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agofs: add missing prefetch.h include
Heiko Carstens [Sun, 22 May 2011 16:54:21 +0000 (18:54 +0200)]
fs: add missing prefetch.h include

Fixes this build error on s390 and probably other archs as well:

  fs/inode.c: In function 'new_inode':
  fs/inode.c:894:2: error: implicit declaration of function 'spin_lock_prefetch'

Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
[ Happens on architectures that don't define their own prefetch
  functions in <asm/processor.h>, and instead rely on the default
  ones in <linux/prefetch.h>   - Linus]
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
13 years agoKVM: MMU: Use ptep_user for cmpxchg_gpte()
Takuya Yoshikawa [Sun, 1 May 2011 05:33:07 +0000 (14:33 +0900)]
KVM: MMU: Use ptep_user for cmpxchg_gpte()

The address of the gpte was already calculated and stored in ptep_user
before entering cmpxchg_gpte().

This patch makes cmpxchg_gpte() to use that to make it clear that we
are using the same address during walk_addr_generic().

Note that the unlikely annotations are used to show that the conditions
are something unusual rather than for performance.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
13 years agoKVM: Fix kvm mmu_notifier initialization order
OGAWA Hirofumi [Wed, 11 May 2011 00:28:28 +0000 (09:28 +0900)]
KVM: Fix kvm mmu_notifier initialization order

Like the following, mmu_notifier can be called after registering
immediately. So, kvm have to initialize kvm->mmu_lock before it.

BUG: spinlock bad magic on CPU#0, kswapd0/342
 lock: ffff8800af8c4000, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
Pid: 342, comm: kswapd0 Not tainted 2.6.39-rc5+ #1
Call Trace:
 [<ffffffff8118ce61>] spin_bug+0x9c/0xa3
 [<ffffffff8118ce91>] do_raw_spin_lock+0x29/0x13c
 [<ffffffff81024923>] ? flush_tlb_others_ipi+0xaf/0xfd
 [<ffffffff812e22f3>] _raw_spin_lock+0x9/0xb
 [<ffffffffa0582325>] kvm_mmu_notifier_clear_flush_young+0x2c/0x66 [kvm]
 [<ffffffff810d3ff3>] __mmu_notifier_clear_flush_young+0x2b/0x57
 [<ffffffff810c8761>] page_referenced_one+0x88/0xea
 [<ffffffff810c89bf>] page_referenced+0x1fc/0x256
 [<ffffffff810b2771>] shrink_page_list+0x187/0x53a
 [<ffffffff810b2ed7>] shrink_inactive_list+0x1e0/0x33d
 [<ffffffff810acf95>] ? determine_dirtyable_memory+0x15/0x27
 [<ffffffff812e90ee>] ? call_function_single_interrupt+0xe/0x20
 [<ffffffff810b3356>] shrink_zone+0x322/0x3de
 [<ffffffff810a9587>] ? zone_watermark_ok_safe+0xe2/0xf1
 [<ffffffff810b3928>] kswapd+0x516/0x818
 [<ffffffff810b3412>] ? shrink_zone+0x3de/0x3de
 [<ffffffff81053d17>] kthread+0x7d/0x85
 [<ffffffff812e9394>] kernel_thread_helper+0x4/0x10
 [<ffffffff81053c9a>] ? __init_kthread_worker+0x37/0x37
 [<ffffffff812e9390>] ? gs_change+0xb/0xb

Signed-off-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: Add documentation for KVM_CAP_NR_VCPUS
Pekka Enberg [Mon, 9 May 2011 19:48:54 +0000 (22:48 +0300)]
KVM: Add documentation for KVM_CAP_NR_VCPUS

Document KVM_CAP_NR_VCPUS that can be used by the userspace to determine
maximum number of VCPUs it can create with the KVM_CREATE_VCPU ioctl.

Cc: Avi Kivity <avi@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: make guest mode entry to be rcu quiescent state
Gleb Natapov [Wed, 4 May 2011 13:31:04 +0000 (16:31 +0300)]
KVM: make guest mode entry to be rcu quiescent state

KVM does not hold any references to rcu protected data when it switches
CPU into a guest mode. In fact switching to a guest mode is very similar
to exiting to userspase from rcu point of view. In addition CPU may stay
in a guest mode for quite a long time (up to one time slice). Lets treat
guest mode as quiescent state, just like we do with user-mode execution.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoMerge commit '29ce831000081dd757d3116bf774aafffc4b6b20' into next
Avi Kivity [Wed, 11 May 2011 09:56:53 +0000 (05:56 -0400)]
Merge commit '29ce831000081dd757d3116bf774aafffc4b6b20' into next

* commit '29ce831000081dd757d3116bf774aafffc4b6b20': (34 commits)
  rcu: provide rcu_virt_note_context_switch() function.
  rcu: get rid of signed overflow in check_cpu_stall()
  rcu: optimize rcutiny
  rcu: prevent call_rcu() from diving into rcu core if irqs disabled
  rcu: further lower priority in rcu_yield()
  rcu: introduce kfree_rcu()
  rcu: fix spelling
  rcu: call __rcu_read_unlock() in exit_rcu for tree RCU
  rcu: Converge TINY_RCU expedited and normal boosting
  rcu: remove useless ->boosted_this_gp field
  rcu: code cleanups in TINY_RCU priority boosting.
  rcu: Switch to this_cpu() primitives
  rcu: Use WARN_ON_ONCE for DEBUG_OBJECTS_RCU_HEAD warnings
  rcu: mark rcutorture boosting callback as being on-stack
  rcu: add DEBUG_OBJECTS_RCU_HEAD check for alignment
  rcu: Enable DEBUG_OBJECTS_RCU_HEAD from !PREEMPT
  rcu: Add forward-progress diagnostic for per-CPU kthreads
  rcu: add grace-period age and more kthread state to tracing
  rcu: fix tracing bug thinko on boost-balk attribution
  rcu: update tracing documentation for new rcutorture and rcuboost
  ...

Pulling in rcu_virt_note_context_switch().

Signed-off-by: Avi Kivity <avi@redhat.com>
* commit '29ce831000081dd757d3116bf774aafffc4b6b20': (34 commits)
  rcu: provide rcu_virt_note_context_switch() function.
  rcu: get rid of signed overflow in check_cpu_stall()
  rcu: optimize rcutiny
  rcu: prevent call_rcu() from diving into rcu core if irqs disabled
  rcu: further lower priority in rcu_yield()
  rcu: introduce kfree_rcu()
  rcu: fix spelling
  rcu: call __rcu_read_unlock() in exit_rcu for tree RCU
  rcu: Converge TINY_RCU expedited and normal boosting
  rcu: remove useless ->boosted_this_gp field
  rcu: code cleanups in TINY_RCU priority boosting.
  rcu: Switch to this_cpu() primitives
  rcu: Use WARN_ON_ONCE for DEBUG_OBJECTS_RCU_HEAD warnings
  rcu: mark rcutorture boosting callback as being on-stack
  rcu: add DEBUG_OBJECTS_RCU_HEAD check for alignment
  rcu: Enable DEBUG_OBJECTS_RCU_HEAD from !PREEMPT
  rcu: Add forward-progress diagnostic for per-CPU kthreads
  rcu: add grace-period age and more kthread state to tracing
  rcu: fix tracing bug thinko on boost-balk attribution
  rcu: update tracing documentation for new rcutorture and rcuboost
  ...

13 years agoKVM: x86 emulator: Make jmp far emulation into a separate function
Takuya Yoshikawa [Sun, 1 May 2011 17:30:48 +0000 (02:30 +0900)]
KVM: x86 emulator: Make jmp far emulation into a separate function

We introduce em_jmp_far().

We also call this from em_grp45() to stop treating modrm_reg == 5 case
separately in the group 5 emulation.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: Rename emulate_grpX() to em_grpX()
Takuya Yoshikawa [Sun, 1 May 2011 17:29:17 +0000 (02:29 +0900)]
KVM: x86 emulator: Rename emulate_grpX() to em_grpX()

The prototypes are changed appropriately.

We also replaces "goto grp45;" with simple em_grp45() call.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: Remove unused arg from emulate_pop()
Takuya Yoshikawa [Sun, 1 May 2011 17:27:55 +0000 (02:27 +0900)]
KVM: x86 emulator: Remove unused arg from emulate_pop()

The opt of emulate_grp1a() is also removed.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: Remove unused arg from writeback()
Takuya Yoshikawa [Sun, 1 May 2011 17:26:23 +0000 (02:26 +0900)]
KVM: x86 emulator: Remove unused arg from writeback()

Remove inline at this chance.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: Remove unused arg from read_descriptor()
Takuya Yoshikawa [Sun, 1 May 2011 17:25:07 +0000 (02:25 +0900)]
KVM: x86 emulator: Remove unused arg from read_descriptor()

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: Remove unused arg from seg_override()
Takuya Yoshikawa [Sun, 1 May 2011 17:23:13 +0000 (02:23 +0900)]
KVM: x86 emulator: Remove unused arg from seg_override()

In addition, one comma at the end of a statement is replaced with a
semicolon.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: Validate userspace_addr of memslot when registered
Takuya Yoshikawa [Sat, 7 May 2011 07:35:38 +0000 (16:35 +0900)]
KVM: Validate userspace_addr of memslot when registered

This way, we can avoid checking the user space address many times when
we read the guest memory.

Although we can do the same for write if we check which slots are
writable, we do not care write now: reading the guest memory happens
more often than writing.

[avi: change VERIFY_READ to VERIFY_WRITE]

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Clean up gpte reading with copy_from_user()
Takuya Yoshikawa [Sat, 7 May 2011 07:31:36 +0000 (16:31 +0900)]
KVM: MMU: Clean up gpte reading with copy_from_user()

When we optimized walk_addr_generic() by not using the generic guest
memory reader, we replaced copy_from_user() with get_user():

  commit e30d2a170506830d5eef5e9d7990c5aedf1b0a51
  KVM: MMU: Optimize guest page table walk

  commit 15e2ac9a43d4d7d08088e404fddf2533a8e7d52e
  KVM: MMU: Fix 64-bit paging breakage on x86_32

But as Andi pointed out later, copy_from_user() does the same as
get_user() as long as we give a constant size to it.

So we use copy_from_user() to clean up the code.

The only, noticeable, regression introduced by this is 64-bit gpte
reading on x86_32 hosts needed for PAE guests.

But this can be mitigated by implementing 8-byte get_user() for x86_32,
if needed.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: PPC: booke: add sregs support
Scott Wood [Wed, 27 Apr 2011 22:24:21 +0000 (17:24 -0500)]
KVM: PPC: booke: add sregs support

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoKVM: PPC: booke: save/restore VRSAVE (a.k.a. USPRG0)
Scott Wood [Wed, 27 Apr 2011 22:24:10 +0000 (17:24 -0500)]
KVM: PPC: booke: save/restore VRSAVE (a.k.a. USPRG0)

Linux doesn't use USPRG0 (now renamed VRSAVE in the architecture, even
when Altivec isn't involved), but a guest might.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoKVM: PPC: use ticks, not usecs, for exit timing
Stuart Yoder [Mon, 28 Mar 2011 20:01:56 +0000 (15:01 -0500)]
KVM: PPC: use ticks, not usecs, for exit timing

Convert to microseconds when displaying
(with fix from Bharat Bhushan <Bharat.Bhushan@freescale.com>).

This reduces rounding error with large quantities of short exits.

Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoKVM: PPC: fix exit accounting for SPRs, tlbwe, tlbsx
Scott Wood [Mon, 28 Mar 2011 20:01:24 +0000 (15:01 -0500)]
KVM: PPC: fix exit accounting for SPRs, tlbwe, tlbsx

The exit type setting for mfspr/mtspr is moved from 44x to toplevel SPR
emulation.  This enables it on e500, and makes sure that all SPRs
are covered.

Exit accounting for tlbwe and tlbsx is added to e500.

Signed-off-by: Stuart Yoder <stuart.yoder@freescale.com>
Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoKVM: PPC: e500: emulate SVR
Scott Wood [Tue, 29 Mar 2011 21:49:10 +0000 (16:49 -0500)]
KVM: PPC: e500: emulate SVR

Return the actual host SVR for now, as we already do for PVR.  Eventually
we may support Qemu overriding PVR/SVR if the situation is appropriate,
once we implement KVM_SET_SREGS on e500.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoKVM: VMX: Cache vmcs segment fields
Avi Kivity [Wed, 27 Apr 2011 16:42:18 +0000 (19:42 +0300)]
KVM: VMX: Cache vmcs segment fields

Since the emulator now checks segment limits and access rights, it
generates a lot more accesses to the vmcs segment fields.  Undo some
of the performance hit by cacheing those fields in a read-only cache
(the entire cache is invalidated on any write, or on guest exit).

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: consolidate segment accessors
Avi Kivity [Wed, 27 Apr 2011 10:20:30 +0000 (13:20 +0300)]
KVM: x86 emulator: consolidate segment accessors

Instead of separate accessors for the segment selector and cached descriptor,
use one accessor for both.  This simplifies the code somewhat.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: VMX: Avoid reading %rip unnecessarily when handling exceptions
Avi Kivity [Thu, 28 Apr 2011 12:59:33 +0000 (15:59 +0300)]
KVM: VMX: Avoid reading %rip unnecessarily when handling exceptions

Avoids a VMREAD.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: SVM: Make dump_vmcb static, reduce text
Joe Perches [Mon, 25 Apr 2011 05:00:50 +0000 (22:00 -0700)]
KVM: SVM: Make dump_vmcb static, reduce text

dump_vmcb isn't used outside this module, make it static.
Shrink text and object by ~1% by standardizing formats.

$ size arch/x86/kvm/svm.o*
   text    data     bss     dec     hex filename
  52910     580   10072   63562    f84a arch/x86/kvm/svm.o.new
  53563     580   10072   64215    fad7 arch/x86/kvm/svm.o.old

Signed-off-by: Joe Perches <joe@perches.com>
Acked-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Fix 64-bit paging breakage on x86_32
Takuya Yoshikawa [Wed, 27 Apr 2011 22:08:36 +0000 (07:08 +0900)]
KVM: MMU: Fix 64-bit paging breakage on x86_32

Fix regression introduced by
  commit e30d2a170506830d5eef5e9d7990c5aedf1b0a51
  KVM: MMU: Optimize guest page table walk

On x86_32, get_user() does not support 64-bit values and we fail to
build KVM at the point of 64-bit paging.

This patch fixes this by using get_user() twice for that condition.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Reported-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: ia64: fix sparse warnings
Jeff Mahoney [Wed, 27 Apr 2011 18:06:07 +0000 (14:06 -0400)]
KVM: ia64: fix sparse warnings

This patch fixes some sparse warning about "dubious one-bit signed bitfield."

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Originally-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Jan Blunck <jblunck@suse.de>
Acked-by: Xiantao Zhang <xiantao.zhang@intel.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: Add CPUID support for VIA CPU
BrillyWu@viatech.com.cn [Mon, 25 Apr 2011 05:55:15 +0000 (13:55 +0800)]
KVM: Add CPUID support for VIA CPU

The CPUIDs for Centaur are added, and then the features of
PadLock hardware engine on VIA CPU, such as "ace", "ace_en"
and so on, can be passed into the kvm guest.

Signed-off-by: Brilly Wu <brillywu@viatech.com.cn>
Signed-off-by: Kary Jin <karyjin@viatech.com.cn>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: call cache_all_regs() only once during instruction emulation
Gleb Natapov [Tue, 12 Apr 2011 09:36:25 +0000 (12:36 +0300)]
KVM: call cache_all_regs() only once during instruction emulation

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: Fix compound mmio
Gleb Natapov [Tue, 12 Apr 2011 09:36:24 +0000 (12:36 +0300)]
KVM: Fix compound mmio

mmio_index should be taken into account when copying data from
userspace.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: emulator: Propagate fault in far jump emulation
Gleb Natapov [Tue, 12 Apr 2011 09:36:23 +0000 (12:36 +0300)]
KVM: emulator: Propagate fault in far jump emulation

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: mmio_fault_cr2 is not used
Gleb Natapov [Tue, 12 Apr 2011 09:36:21 +0000 (12:36 +0300)]
KVM: mmio_fault_cr2 is not used

Remove unused variable mmio_fault_cr2.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: consolidate group handling
Avi Kivity [Sun, 24 Apr 2011 11:09:59 +0000 (14:09 +0300)]
KVM: x86 emulator: consolidate group handling

Move all groups into a single field and handle them in a single place.  This
saves bits when we add more group types (3 bits -> 7 groups types).

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Add unlikely() annotations to walk_addr_generic()
Avi Kivity [Sun, 24 Apr 2011 09:25:50 +0000 (12:25 +0300)]
KVM: MMU: Add unlikely() annotations to walk_addr_generic()

walk_addr_generic() is a hot path and is also hard for the cpu to predict -
some of the parameters (fetch_fault in particular) vary wildly from
invocation to invocation.

Add unlikely() annotations where appropriate; all walk failures are
considered unlikely, as are cases where we have to mark the accessed or
dirty bit, as they are slow paths both in kvm and on real processors.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: Use opcode::execute for PUSHF/POPF (9C/9D)
Takuya Yoshikawa [Sat, 23 Apr 2011 09:52:56 +0000 (18:52 +0900)]
KVM: x86 emulator: Use opcode::execute for PUSHF/POPF (9C/9D)

For this, em_pushf/popf() are introduced.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: Use opcode::execute for PUSHA/POPA (60/61)
Takuya Yoshikawa [Sat, 23 Apr 2011 09:51:07 +0000 (18:51 +0900)]
KVM: x86 emulator: Use opcode::execute for PUSHA/POPA (60/61)

For this, emulate_pusha/popa() are converted to em_pusha/popa().

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: Use opcode::execute for POP reg (58-5F)
Takuya Yoshikawa [Sat, 23 Apr 2011 09:49:40 +0000 (18:49 +0900)]
KVM: x86 emulator: Use opcode::execute for POP reg (58-5F)

In addition, the RET emulation is changed to call em_pop() to remove
the pop_instruction label.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: Use opcode::execute for Group 1, CMPS and SCAS
Takuya Yoshikawa [Sat, 23 Apr 2011 09:48:02 +0000 (18:48 +0900)]
KVM: x86 emulator: Use opcode::execute for Group 1, CMPS and SCAS

The following instructions are changed to use opcode::execute.

Group 1 (80-83)
  ADD (00-05), OR (08-0D), ADC (10-15), SBB (18-1D), AND (20-25),
  SUB (28-2D), XOR (30-35), CMP (38-3D)

CMPS (A6-A7), SCAS (AE-AF)

The last two do the same as CMP in the emulator, so em_cmp() is used.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Optimize guest page table walk
Takuya Yoshikawa [Thu, 21 Apr 2011 15:34:44 +0000 (00:34 +0900)]
KVM: MMU: Optimize guest page table walk

This patch optimizes the guest page table walk by using get_user()
instead of copy_from_user().

With this patch applied, paging64_walk_addr_generic() has become
about 0.5us to 1.0us faster on my Phenom II machine with NPT on.

Signed-off-by: Takuya Yoshikawa <yoshikawa.takuya@oss.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: SVM: Get rid of x86_intercept_map::valid
Avi Kivity [Thu, 21 Apr 2011 09:35:41 +0000 (12:35 +0300)]
KVM: SVM: Get rid of x86_intercept_map::valid

By reserving 0 as an invalid x86_intercept_stage, we no longer
need to store a valid flag in x86_intercept_map.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: Use opcode::execute for 0F 01 opcode
Avi Kivity [Thu, 21 Apr 2011 09:21:50 +0000 (12:21 +0300)]
KVM: x86 emulator: Use opcode::execute for 0F 01 opcode

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: Don't force #UD for 0F 01 /5
Avi Kivity [Thu, 21 Apr 2011 09:17:13 +0000 (12:17 +0300)]
KVM: x86 emulator: Don't force #UD for 0F 01 /5

While it isn't defined, no need to force a #UD.  If it becomes defined
in the future this can cause wierd problems for the guest.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: move 0F 01 sub-opcodes into their own functions
Avi Kivity [Thu, 21 Apr 2011 09:07:59 +0000 (12:07 +0300)]
KVM: x86 emulator: move 0F 01 sub-opcodes into their own functions

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: fix const value warning on i386 in svm insn RAX check
Randy Dunlap [Thu, 21 Apr 2011 16:09:22 +0000 (09:09 -0700)]
KVM: x86 emulator: fix const value warning on i386 in svm insn RAX check

arch/x86/kvm/emulate.c:2598: warning: integer constant is too large for 'long' type

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: avoid calling wbinvd() macro
Clemens Noss [Thu, 21 Apr 2011 19:16:05 +0000 (21:16 +0200)]
KVM: x86 emulator: avoid calling wbinvd() macro

Commit 0b56652e33c72092956c651ab6ceb9f0ad081153 fails to build:

  CC [M]  arch/x86/kvm/emulate.o
arch/x86/kvm/emulate.c: In function 'x86_emulate_insn':
arch/x86/kvm/emulate.c:4095:25: error: macro "wbinvd" passed 1 arguments, but takes just 0
arch/x86/kvm/emulate.c:4095:3: warning: statement with no effect
make[2]: *** [arch/x86/kvm/emulate.o] Error 1
make[1]: *** [arch/x86/kvm] Error 2
make: *** [arch/x86] Error 2

Work around this for now.

Signed-off-by: Clemens Noss <cnoss@gmx.de>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: ioapic: Fix an error field reference
Liu Yuan [Thu, 21 Apr 2011 06:53:57 +0000 (14:53 +0800)]
KVM: ioapic: Fix an error field reference

Function ioapic_debug() in the ioapic_deliver() misnames
one filed by reference. This patch correct it.

Signed-off-by: Liu Yuan <tailai.ly@taobao.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: MMU: Make cmpxchg_gpte aware of nesting too
Roedel, Joerg [Wed, 20 Apr 2011 13:33:16 +0000 (15:33 +0200)]
KVM: MMU: Make cmpxchg_gpte aware of nesting too

This patch makes the cmpxchg_gpte() function aware of the
difference between l1-gfns and l2-gfns when nested
virtualization is in use.  This fixes a potential
data-corruption problem in the l1-guest and makes the code
work correct (at least as correct as the hardware which is
emulated in this code) again.

Cc: stable@kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: drop x86_emulate_ctxt::vcpu
Avi Kivity [Wed, 20 Apr 2011 12:56:20 +0000 (15:56 +0300)]
KVM: x86 emulator: drop x86_emulate_ctxt::vcpu

No longer used.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: Avoid using x86_emulate_ctxt.vcpu
Avi Kivity [Wed, 20 Apr 2011 12:55:40 +0000 (15:55 +0300)]
KVM: Avoid using x86_emulate_ctxt.vcpu

We can use container_of() instead.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: add new ->wbinvd() callback
Avi Kivity [Wed, 20 Apr 2011 12:53:23 +0000 (15:53 +0300)]
KVM: x86 emulator: add new ->wbinvd() callback

Instead of calling kvm_emulate_wbinvd() directly.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: add ->fix_hypercall() callback
Avi Kivity [Wed, 20 Apr 2011 12:47:13 +0000 (15:47 +0300)]
KVM: x86 emulator: add ->fix_hypercall() callback

Artificial, but needed to remove direct calls to KVM.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: add new ->halt() callback
Avi Kivity [Wed, 20 Apr 2011 12:43:05 +0000 (15:43 +0300)]
KVM: x86 emulator: add new ->halt() callback

Instead of reaching into vcpu internals.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: make emulate_invlpg() an emulator callback
Avi Kivity [Wed, 20 Apr 2011 12:38:44 +0000 (15:38 +0300)]
KVM: x86 emulator: make emulate_invlpg() an emulator callback

Removing direct calls to KVM.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: emulate CLTS internally
Avi Kivity [Wed, 20 Apr 2011 12:32:49 +0000 (15:32 +0300)]
KVM: x86 emulator: emulate CLTS internally

Avoid using ctxt->vcpu; we can do everything with ->get_cr() and ->set_cr().

A side effect is that we no longer activate the fpu on emulated CLTS; but that
should be very rare.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: Replace calls to is_pae() and is_paging with ->get_cr()
Avi Kivity [Wed, 20 Apr 2011 12:24:32 +0000 (15:24 +0300)]
KVM: x86 emulator: Replace calls to is_pae() and is_paging with ->get_cr()

Avoid use of ctxt->vcpu.

Signed-off-by: Avi Kivity <avi@redhat.com>
13 years agoKVM: x86 emulator: drop use of is_long_mode()
Avi Kivity [Wed, 20 Apr 2011 12:21:35 +0000 (15:21 +0300)]
KVM: x86 emulator: drop use of is_long_mode()

Requires ctxt->vcpu, which is to be abolished.  Replace with open calls
to get_msr().

Signed-off-by: Avi Kivity <avi@redhat.com>