aboutsummaryrefslogtreecommitdiffstats
path: root/virt/kvm
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2010-04-26 03:08:27 -0400
committerPaul Mundt <lethal@linux-sh.org>2010-04-26 03:08:27 -0400
commite19553427c2e8fdb04fdd98e407164bb59a840ba (patch)
tree5332234b2dad07c03c27e4608afb16f297f41e61 /virt/kvm
parent35f6cd4a06432034665a1499ca4b022437423aac (diff)
parent83515bc7df812555e20cda48614674e2f346f9f5 (diff)
Merge branch 'sh/stable-updates'
Conflicts: arch/sh/kernel/dwarf.c drivers/dma/shdma.c Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'virt/kvm')
-rw-r--r--virt/kvm/assigned-dev.c1
-rw-r--r--virt/kvm/coalesced_mmio.c1
-rw-r--r--virt/kvm/eventfd.c1
-rw-r--r--virt/kvm/ioapic.c1
-rw-r--r--virt/kvm/irq_comm.c1
-rw-r--r--virt/kvm/kvm_main.c19
6 files changed, 18 insertions, 6 deletions
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c
index 057e2cca6af5..02ff2b19dbe2 100644
--- a/virt/kvm/assigned-dev.c
+++ b/virt/kvm/assigned-dev.c
@@ -16,6 +16,7 @@
16#include <linux/spinlock.h> 16#include <linux/spinlock.h>
17#include <linux/pci.h> 17#include <linux/pci.h>
18#include <linux/interrupt.h> 18#include <linux/interrupt.h>
19#include <linux/slab.h>
19#include "irq.h" 20#include "irq.h"
20 21
21static struct kvm_assigned_dev_kernel *kvm_find_assigned_dev(struct list_head *head, 22static struct kvm_assigned_dev_kernel *kvm_find_assigned_dev(struct list_head *head,
diff --git a/virt/kvm/coalesced_mmio.c b/virt/kvm/coalesced_mmio.c
index 5169736377a3..36e258029649 100644
--- a/virt/kvm/coalesced_mmio.c
+++ b/virt/kvm/coalesced_mmio.c
@@ -10,6 +10,7 @@
10#include "iodev.h" 10#include "iodev.h"
11 11
12#include <linux/kvm_host.h> 12#include <linux/kvm_host.h>
13#include <linux/slab.h>
13#include <linux/kvm.h> 14#include <linux/kvm.h>
14 15
15#include "coalesced_mmio.h" 16#include "coalesced_mmio.h"
diff --git a/virt/kvm/eventfd.c b/virt/kvm/eventfd.c
index 7016319b1ec0..b81f0ebbaaad 100644
--- a/virt/kvm/eventfd.c
+++ b/virt/kvm/eventfd.c
@@ -30,6 +30,7 @@
30#include <linux/list.h> 30#include <linux/list.h>
31#include <linux/eventfd.h> 31#include <linux/eventfd.h>
32#include <linux/kernel.h> 32#include <linux/kernel.h>
33#include <linux/slab.h>
33 34
34#include "iodev.h" 35#include "iodev.h"
35 36
diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c
index 3db15a807f80..03a5eb22da2b 100644
--- a/virt/kvm/ioapic.c
+++ b/virt/kvm/ioapic.c
@@ -33,6 +33,7 @@
33#include <linux/smp.h> 33#include <linux/smp.h>
34#include <linux/hrtimer.h> 34#include <linux/hrtimer.h>
35#include <linux/io.h> 35#include <linux/io.h>
36#include <linux/slab.h>
36#include <asm/processor.h> 37#include <asm/processor.h>
37#include <asm/page.h> 38#include <asm/page.h>
38#include <asm/current.h> 39#include <asm/current.h>
diff --git a/virt/kvm/irq_comm.c b/virt/kvm/irq_comm.c
index 9fd5b3ebc517..a0e88809e45e 100644
--- a/virt/kvm/irq_comm.c
+++ b/virt/kvm/irq_comm.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/kvm_host.h> 22#include <linux/kvm_host.h>
23#include <linux/slab.h>
23#include <trace/events/kvm.h> 24#include <trace/events/kvm.h>
24 25
25#include <asm/msidef.h> 26#include <asm/msidef.h>
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index 548f9253c195..c82ae2492634 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -22,7 +22,6 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/errno.h> 23#include <linux/errno.h>
24#include <linux/percpu.h> 24#include <linux/percpu.h>
25#include <linux/gfp.h>
26#include <linux/mm.h> 25#include <linux/mm.h>
27#include <linux/miscdevice.h> 26#include <linux/miscdevice.h>
28#include <linux/vmalloc.h> 27#include <linux/vmalloc.h>
@@ -46,6 +45,7 @@
46#include <linux/compat.h> 45#include <linux/compat.h>
47#include <linux/srcu.h> 46#include <linux/srcu.h>
48#include <linux/hugetlb.h> 47#include <linux/hugetlb.h>
48#include <linux/slab.h>
49 49
50#include <asm/processor.h> 50#include <asm/processor.h>
51#include <asm/io.h> 51#include <asm/io.h>
@@ -341,7 +341,11 @@ static void kvm_mmu_notifier_release(struct mmu_notifier *mn,
341 struct mm_struct *mm) 341 struct mm_struct *mm)
342{ 342{
343 struct kvm *kvm = mmu_notifier_to_kvm(mn); 343 struct kvm *kvm = mmu_notifier_to_kvm(mn);
344 int idx;
345
346 idx = srcu_read_lock(&kvm->srcu);
344 kvm_arch_flush_shadow(kvm); 347 kvm_arch_flush_shadow(kvm);
348 srcu_read_unlock(&kvm->srcu, idx);
345} 349}
346 350
347static const struct mmu_notifier_ops kvm_mmu_notifier_ops = { 351static const struct mmu_notifier_ops kvm_mmu_notifier_ops = {
@@ -648,7 +652,7 @@ skip_lpage:
648 652
649 /* Allocate page dirty bitmap if needed */ 653 /* Allocate page dirty bitmap if needed */
650 if ((new.flags & KVM_MEM_LOG_DIRTY_PAGES) && !new.dirty_bitmap) { 654 if ((new.flags & KVM_MEM_LOG_DIRTY_PAGES) && !new.dirty_bitmap) {
651 unsigned dirty_bytes = ALIGN(npages, BITS_PER_LONG) / 8; 655 unsigned long dirty_bytes = kvm_dirty_bitmap_bytes(&new);
652 656
653 new.dirty_bitmap = vmalloc(dirty_bytes); 657 new.dirty_bitmap = vmalloc(dirty_bytes);
654 if (!new.dirty_bitmap) 658 if (!new.dirty_bitmap)
@@ -768,7 +772,7 @@ int kvm_get_dirty_log(struct kvm *kvm,
768{ 772{
769 struct kvm_memory_slot *memslot; 773 struct kvm_memory_slot *memslot;
770 int r, i; 774 int r, i;
771 int n; 775 unsigned long n;
772 unsigned long any = 0; 776 unsigned long any = 0;
773 777
774 r = -EINVAL; 778 r = -EINVAL;
@@ -780,7 +784,7 @@ int kvm_get_dirty_log(struct kvm *kvm,
780 if (!memslot->dirty_bitmap) 784 if (!memslot->dirty_bitmap)
781 goto out; 785 goto out;
782 786
783 n = ALIGN(memslot->npages, BITS_PER_LONG) / 8; 787 n = kvm_dirty_bitmap_bytes(memslot);
784 788
785 for (i = 0; !any && i < n/sizeof(long); ++i) 789 for (i = 0; !any && i < n/sizeof(long); ++i)
786 any = memslot->dirty_bitmap[i]; 790 any = memslot->dirty_bitmap[i];
@@ -1186,10 +1190,13 @@ void mark_page_dirty(struct kvm *kvm, gfn_t gfn)
1186 memslot = gfn_to_memslot_unaliased(kvm, gfn); 1190 memslot = gfn_to_memslot_unaliased(kvm, gfn);
1187 if (memslot && memslot->dirty_bitmap) { 1191 if (memslot && memslot->dirty_bitmap) {
1188 unsigned long rel_gfn = gfn - memslot->base_gfn; 1192 unsigned long rel_gfn = gfn - memslot->base_gfn;
1193 unsigned long *p = memslot->dirty_bitmap +
1194 rel_gfn / BITS_PER_LONG;
1195 int offset = rel_gfn % BITS_PER_LONG;
1189 1196
1190 /* avoid RMW */ 1197 /* avoid RMW */
1191 if (!generic_test_le_bit(rel_gfn, memslot->dirty_bitmap)) 1198 if (!generic_test_le_bit(offset, p))
1192 generic___set_le_bit(rel_gfn, memslot->dirty_bitmap); 1199 generic___set_le_bit(offset, p);
1193 } 1200 }
1194} 1201}
1195 1202