Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 356787
b: refs/heads/master
c: b7f69c5
h: refs/heads/master
i:
  356785: b31180d
  356783: 3df1df6
v: v3
  • Loading branch information
Alex Williamson authored and Marcelo Tosatti committed Dec 14, 2012
1 parent 90b3c2b commit 5b16861
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: e40f193f5bb022e927a57a4f5d5194e4f12ddb74
refs/heads/master: b7f69c555ca430129b6cde81e9f0927531420c5c
21 changes: 14 additions & 7 deletions trunk/virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@ int __kvm_set_memory_region(struct kvm *kvm,
unsigned long npages;
struct kvm_memory_slot *memslot, *slot;
struct kvm_memory_slot old, new;
struct kvm_memslots *slots, *old_memslots;
struct kvm_memslots *slots = NULL, *old_memslots;

r = check_memory_region_flags(mem);
if (r)
Expand Down Expand Up @@ -832,18 +832,25 @@ int __kvm_set_memory_region(struct kvm *kvm,
* - kvm_is_visible_gfn (mmu_check_roots)
*/
kvm_arch_flush_shadow_memslot(kvm, slot);
kfree(old_memslots);
slots = old_memslots;
}

r = kvm_arch_prepare_memory_region(kvm, &new, old, mem, user_alloc);
if (r)
goto out_free;
goto out_slots;

r = -ENOMEM;
slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots),
GFP_KERNEL);
if (!slots)
goto out_free;
/*
* We can re-use the old_memslots from above, the only difference
* from the currently installed memslots is the invalid flag. This
* will get overwritten by update_memslots anyway.
*/
if (!slots) {
slots = kmemdup(kvm->memslots, sizeof(struct kvm_memslots),
GFP_KERNEL);
if (!slots)
goto out_free;
}

/* map new memory slot into the iommu */
if (npages) {
Expand Down

0 comments on commit 5b16861

Please sign in to comment.